Displaying Latest Data Saved

Hi guys, just want to check if you can figure out what’s wrong with my code? I can’t seem to get the value of the data i saved. Thank so much…

INCLUDE ("conn.php");
if (isset( $_GET ['q_no']))
{

$edit=$_GET['q_no'];

$sql="select quote_no, quote_name, quote_by, quote_date, c_name, c_add from quote where quote_no=$edit";
$result=mysql_query($sql);

if (!$result)
		exit ("Not Found.");
	$row =mysql_fetch_array($result);
	$getno=$row['quote_no'];
	}
	echo " < input type=text value=$getno> ";
?>

Precisely what happens? Does it return nothing, or get the wrong data? How far through the code does it get before it stops running the way you wanted it to? Have you checked that the field name on your form is correct? Can you show the code that you call this page from, in case there’s a typo?

Also have a look at PDO or mysqli to access your database - the old-style MySQL calls are deprecated now.

I also find it eaiser to work with arguments (variables) that are true than false.

For example:

if ($result) {
  echo 'Congratulations the data was successfully saved, loaded, or what have you';
} else {
  // Do the fail portion here:
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.