mysql+php page between the display picture problem, how to make the product name and corresponding picture normal display it.
1,index.php
....... Omitted in front
"Width=" height= "135" border= "3" >
Product Name:
<{$myrow [data].tb_commodity_id}>
<{$myrow [data].tb_commodity_name}>
2,head_picture.php
$query = "SELECT * from Tb_commodity where tb_commodity_id=". $recid;
$result =mysql_query ($query);
if (! $result) die ("Error:mysql query");
$num =mysql_num_rows ($result);
if ($num <1) die ("Error:no this recorder");
$data = mysql_result ($result, 0, "tb_commodity_picture");
Mysql_close ($conn);
Echo $data;
?>
3, the database table contains: Tb_commodity_id,tb_commodity_name,tb_commodity_picture field.
In the index page, the product name can display the database in the 5 data, including tb_commodity_id and Tb_commodity_name are normal display, only the picture can not display properly, if the head_picture.php inside $query= "SELECT * from Tb_commodity where tb_commodity_id=". $recid; Direct change to: $query = "SELECT * from Tb_commodity where tb_commodity_id=1", (or 2,3,4,5, that is, the corresponding tb_commodity_id in the database) to display the picture properly, There are currently 5 data in the database;
Change to: $query = "SELECT * from Tb_commodity where tb_commodity_id=". $myrow [data].tb_commodity_id; show tb_commodity_id=5 pictures;
Click on the index page can not display the picture, in the new tab to open the picture, the Address bar URL is: The machine name/head_picture.php?recid=5 (point recid corresponding to the picture, will show the corresponding recid), the page shows: Error:mysql Query
Reply to discussion (solution)
Native name/head_picture.php?recid=5 (point recid corresponding to the picture, will show the corresponding recid), the page is displayed: Error:mysql query
Focus here print out the SQL statement show look
Native name/head_picture.php?recid=5 (point recid corresponding to the picture, will show the corresponding recid), the page is displayed: Error:mysql query
Focus here print out the SQL statement show look
Print out the result is this, did not take the value of the. $recid to $query= "select * from Tb_commodity where tb_commodity_id=". $recid inside.
Error:mysql Query:select * from tb_commodity where tb_commodity_id=
$query = "SELECT * from Tb_commodity where tb_commodity_id=". $_get[' RecId '];
It's good to find the crux.
$recid, change to $_get[' RecId '];
or extract first ($_get);
OK, thanks @xuzuning and @anyilaoliu.