I have some php code and heres parts of it:
$user_name = $_SESSION[‘user_name’];
$varnotes = $_POST[‘formnotes’];
$sql_insert = "INSERT into notestable
(user_name
,notes
) VALUES (’$user_name’,’$varnotes’) ";
I need a php script that allows me to show the last saved ‘note’ that the specific USER that is signed in has made… i got it to save the note to the database, but im clueless on how to have the LAST SAVED NOTE from THAT USER shown on the page…
‘Daveismyname’ had posted: (In which btw, thanks very much)
//select all fields from the database where user_name is the same as the one stored in the session order by the id in descending order and limit to 1 so only 1 record will be returned
$query = mysql_query(“SELECT * FROM notestable WHERE user_name=’”.mysql_real_escape_string($_SESSION[‘user_name’])."’ ORDER BY id DESC LIMIT 1");
//add record to an object
$row = $mysql_fetch_object($query);
//print out the result
echo $row->notes.’ by: '.$row->user_name;
But when i try to use it i get this error:
Fatal error: Function name must be a string in /home/content/11/8156011/html/login/notes/notes.php on line 69
HOW CAN I FIX THIS?? THanks.