jamesxg1 Posted April 9, 2009 Share Posted April 9, 2009 <?php session_start(); ini_set('display_errors', 1); error_reporting(E_ALL); include 'Database/Connection.php'; include 'Database/Utility.php'; isloggedin(); accessneeded("C"); $userid = $_SESSION['userid']; $count = 0; $query = mysql_query(sprintf("SELECT * FROM contacts WHERE holder = '$userid'")) or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { if ($count!=0){echo "<hr>";} print "First Name: <font color='red'>$row->firstname<br></font>Last Name: <font color='red'>$row->lastname<br></font>Address: <font color='red'>$row->address<br></font>Postcode: <font color='red'>$row->postcode<br></font>Email: <font color='red'>$row->email<br></font>Phone Number: <font color=red>$row->pnumber<br></font>"; $count++; } ?> Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 Notice: Trying to get property of non-object in C:\xampp\htdocs\family\ContactsView.php on line 19 First Name: Last Name: Address: Postcode: Email: Phone Number: Many thanks James. Link to comment https://forums.phpfreaks.com/topic/153314-solved-notice-trying-to-get-property-of-non-object-help/ Share on other sites More sharing options...
Yesideez Posted April 9, 2009 Share Posted April 9, 2009 $row isn't an object unless you use this: while ($row = mysql_fetch_object($query)) { Link to comment https://forums.phpfreaks.com/topic/153314-solved-notice-trying-to-get-property-of-non-object-help/#findComment-805436 Share on other sites More sharing options...
jamesxg1 Posted April 9, 2009 Author Share Posted April 9, 2009 $row isn't an object unless you use this: while ($row = mysql_fetch_object($query)) { oh christ my bad sorry mate. Link to comment https://forums.phpfreaks.com/topic/153314-solved-notice-trying-to-get-property-of-non-object-help/#findComment-805463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.