hi there! im a newbie and i have problems generating output using the code below view.php $result = mysql_query("select * from property_listings order by property_num desc") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<a href=view_post.php?xval="; echo $row["property_num"]; echo ">"; echo $row["property_heading"]; echo "</a>"; echo "<br><br>"; } mysql_free_result($result); PHP: view_post.php $result = mysql_query("select * from property_listings where property_num='".mysql_real_escape_string($_GET['xval'])."'") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { echo $row["property_heading"]; } mysql_free_result($result); PHP: what i want, is that once a link is clicked on view.php it will go to view_post.php and will display the data generated by the sql query. my problem is that everytime i run view.php and i clicked a specific link on it, and once it opens view_post.php it doesnt display anything. property_num is a mediumint and im really not sure if the codes i entered in view_post.php are correct. PLEaSE HELp!
The value you're passing in view.php comes from the property_num field, but in view_post.php you're trying to fetch a row where this value equals property_heading. Maybe that's the issue?
Try this. $result = mysql_query(" SELECT * FROM property_listings ORDER BY property_num desc ") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { echo '<a href="view_post.php?xval=' . $row["property_num"] . '">' . $row["property_heading"] . "</a><br /><br />\n"; } mysql_free_result($result); PHP: $result = mysql_query(" SELECT * FROM property_listings WHERE property_num = '" . mysql_real_escape_string($_GET['xval']) . "' LIMIT 1 ") or die (mysql_error()); $property = mysql_fetch_assoc($result); mysql_free_result($result); echo $property["property_heading"]; PHP: