Hello ,
I want to show some images in my app using php and universal-image-loader-1.9.1 Iam an stater and I have collected some code from
another apps, My problem is when i use the same code to add the gallery in my app it was showing application stopped. If any one can help me to fisx this problem that will be help ful. Below I have added the php code and I want o us universal-image-loader to show the image in the app. In my app there was an gallery area for showing images in albums and recently added pictures so please help me..
My php Code api.php
<?php
include_once "includes/variables.php";
DEFINE ('DB_HOST', $host);
DEFINE ('DB_USER', $user);
DEFINE ('DB_PASSWORD', $pass);
DEFINE ('DB_NAME', $database);
$mysqli = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL');
@mysql_select_db (DB_NAME) OR die ('Could not select the database');
?>
<?php
mysql_query("SET NAMES 'utf8'");
//mysql_query('SET CHARACTER SET utf8');
if(isset($_GET['cat_id']))
{
$query="SELECT image AS 'images', category_name AS 'cat_name', cid FROM tbl_category c, tbl_gallery n WHERE c.cid=n.cat_id and c.cid='".$_GET['cat_id']."' ORDER BY n.id DESC";
$resouter = mysql_query($query);
}
else if(isset($_GET['latest']))
{
$limit=$_GET['latest'];
$query="SELECT * FROM tbl_category c,tbl_gallery n WHERE c.cid=n.cat_id ORDER BY n.id DESC LIMIT $limit";
$resouter = mysql_query($query);
}
else
{
$query="SELECT * FROM tbl_category ORDER BY cid DESC";
$resouter = mysql_query($query);
}
$set = array();
$total_records = mysql_num_rows($resouter);
if($total_records >= 1){
while ($link = mysql_fetch_array($resouter, MYSQL_ASSOC)){
$set['MaterialWallpaper'][] = $link;
}
}
echo $val= str_replace('\\/', '/', json_encode($set));
?>
My connection code in app Constant
package com.solodroid.materialwallpaper;
import java.io.Serializable;
public class Constant implements Serializable {
private static final long serialVersionUID = 1L;
public static final String SERVER_IMAGE_UPFOLDER_CATEGORY = "http://192.168.1.1/demo/wallpaper/upload/category/";
public static final String SERVER_IMAGE_UPFOLDER_THUMB = "http://192.168.1.1/demo/wallpaper/upload/thumbs/";
public static final String SERVER_IMAGE_DETAILS = "http://192.168.1.1/demo/wallpaper/upload/";
public static final String LATEST_URL = "http://192.168.1.1/demo/wallpaper/api.php?latest=50";
public static final String CATEGORY_URL = "http://192.168.1.1/demo/wallpaper/api.php";
public static final String CATEGORY_ITEM_URL = "http://192.168.1.1/demo/wallpaper/api.php?cat_id=";
public static final int NUM_OF_COLUMNS = 2;
public static final int GRID_PADDING = 5;
public static final String LATEST_ARRAY_NAME = "MaterialWallpaper";
public static final String LATEST_IMAGE_CATEGORY_NAME = "category_name";
public static final String LATEST_IMAGE_URL = "image";
public static final String CATEGORY_ARRAY_NAME = "MaterialWallpaper";
public static final String CATEGORY_NAME = "category_name";
public static final String CATEGORY_CID = "cid";
public static final String CATEGORY_IMAGE_URL = "category_image";
public static final String CATEGORY_ITEM_ARRAY = "MaterialWallpaper";
public static final String CATEGORY_ITEM_CATNAME = "cat_name";
public static final String CATEGORY_ITEM_IMAGEURL = "images";
public static final String CATEGORY_ITEM_CATID = "cid";
public static String CATEGORY_ITEM_CATIDD;
public static String CATEGORY_TITLE;
public static String CATEGORY_ID;
}