macman73 Posted September 15, 2008 Share Posted September 15, 2008 Hope someone here can help I am no PHP expert so please excuse me i took a logon/user mangement script that someone else designed and have been adding to it since and been doing OK but i am stuck on this. I have a userinfo page that displays data to the user that is relevent to them this is the section of the userinfo file that i am working on user info.php /* Display requested user information */ $req_user_info = $database->getUserInfo($req_user); $req_game_a = $database->getGameA($req_user); /* Username */ echo "<b>Username: ".$req_user_info['username']."</b><br>"; /* Email */ echo "<b>Email:</b> ".$req_user_info['email']."<br>"; /* Game A */ echo "<b>Weekly Game:</b> ".$req_game_a['comment_text']."<br>"; its the last line here that i am specifically working with(the call for the "comment_text" data as you can see on line 5 i am calling a function from a database.php file which is show below datbase.php */ function getGameA($username){ $q = "SELECT * FROM ".TBL_COMMENT." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); /* Error occurred, return given name by default */ if(!$result || (mysql_numrows($result) < 0)){ return NULL; } /* Return result array */ $dbarray = mysql_fetch_array($result); return $dbarray; } /** My problem is this it will only display the last record that the user entered I dont know if i am doing it right but a user enters information into this table and they may have several entrys against there username and i am trying to diplay all the users entrys. i hope i have been clear in my problem and that someone can help i have trawled the net for a couple of days and tried various changes but am getting nowhere I have a headache ??? thanks in advance macman73 Link to comment https://forums.phpfreaks.com/topic/124320-display-multiple-records-from-mysql-on-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.