Jump to content

[SOLVED] Retrieving no data from a table


lil_bugga

Recommended Posts

I'm trying to display the data from inside one of my database tables using the code below, but all I'm getting returned is white space. Any ideas?, I have the connection to the database all set up correctly too

 

// sets up queries
$get_data_qry = "SELECT id, subcat_id, item_title, item_price, item_desc, item_image FROM store_items ORDER BY id";

// sets up query calls
$get_data_res =  mysqli_query($mysqli, $get_data_qry) or die(mysqli_error($mysqli));

//get and show 1st level navigation
if (mysqli_num_rows($get_data_res) < 1)
{
$display_content = "<p><em>Sorry, no categories to browse.</em></p>\n";
} 
else
{	
	while ($data = mysqli_fetch_array($get_data_res)) 
	{
		$id = $cats['id'];
		$subcat_id  = $cats['subcat_id'];
		$item_title = ucwords(stripslashes($cats['cat_title']));
		$item_price = $cats['item_price'];
		$item_desc = $cats['item_desc'];
		$item_image = $cats['item_image'];
		$display_content .= "blah ".$id."<br />\n ".$subcat_id."<br />\n ".$item_title."<br />\n ".$item_price."<br />\n ".$items_desc."<br />\n ".$item_image;
	}

}

 

Below is the table i'm selecting from, i haven't listed the image coloumn to save time

id  subcat_id  item_title                          item_price  item_desc

1  1            Mens Vest Top                  4.00          A sleeveless vest top, ideal for those hot summer ...

2  1            Mens Short Sleeved T-shirt  5.00          A short sleeved, round neck T-shirt.

3  1            Mens Long Sleeved T-shirt  7.00          A long sleeved, round neck T-shirt. 

4  1            Mens Hoodie                      10.00          Made of thicker material to keep the heat in the h...

5  1          Mens Reversable Rugby Shirt  20.00          A reversable rugby shirt that shows a white stripe...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.