Cant get data to show from mysql.
Posted: Wed May 16, 2012 3:11 pm
I have some code so far, but it is not working. It seems as if it should, I have been over it 100 times and cannot find a problem.
As you can see, I am quite a newbie...
I am not getting any errors, but no data will show when I add them to a table such as:
ALL advice is very much appreciated
As you can see, I am quite a newbie...
Code: Select all
$result = mysql_query("SELECT * FROM inv_items ORDER BY RAND() LIMIT 0,5");
$i=0;
$img=array();
$id=array();
$name=array();
while($row= mysql_fetch_array($result)){
$img1 = strstr($row[desc_picture],':');
$img2 = substr($img1,1);
$result1= mysql_query("select filename from images where id=$img2");
$row6= mysql_fetch_array($result1);
$img[i] = substr($row6[filename], 0, strpos($row6[filename],'[')-1);
$id[i]=$row[id];
$name[i]=$row[desc_name];
$i++;
Code: Select all
<img src=\"/images/products/{$img[0]}T.jpg\"/></td><td valign='middle'>
<p>{$name[0]}</td><td valign=\"middle\">
<input type=\"text\" value=\"1\" name=\"additem_{$id[0]}\" class=\"inpAddToCartQty\" /></td><td valign=\"middle\">
<input type=\"submit\" value=\"Add to Cart\" class=\"inpAddToCartBtn\" />
<input type=\"hidden\" value=\"{$id[0]}\" class=\"rowItemId\" />