j152 Posted July 7, 2009 Share Posted July 7, 2009 For some reason, I can't display the right row in my mysql table. I can connect to the database okay. Problems I'm experiencing - anything I type in the .html form will log me in - the information being displayed is from the very first row in the DB FUNCTIONS FILE THAT CONTAINS DB INFO <?php include 'config.php'; $did=$_SESSION['loggedin']; // Assign the Query $sql="SELECT * FROM bes_library WHERE userid='$did'"; //Execute the Query $result=mysql_query($sql); if (!$result) { die ("Could not query the database: <br />". mysql_error()); } // Fetch & Display Results Using Fetch Array | Left Column = Session Strings | Right Column = Database Columns while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id =$row["id"]; $use_id =$row["userid"]; $refer =$row["referreid"]; $up_id =$row["upnid"]; $points =$row["points"]; $max =$row["max_points"]; $last_up =$row["last_update"]; $ref_user =$row["referraluser"]; $refee =$row["referrees"]; $block =$row["blocked"]; $birth =$row["birthdate"]; $av =$row["avatar"]; $level =$row["levelrank"]; $lev_date =$row["leveldate"]; } mysql_close(); $i=0; while ($i < $num) { echo "<b>zip<hr><br>"; $i++; } ?> THIS FILE THAT SHOULD DISPLAY INFORMATION FROM DB (I've removed the extra .html code) <?php session_start(); if (!(isset($_SESSION['loggedin']) && $_SESSION['loggedin'] != '')) { header ("Location: user_registration.php"); } include 'config.php'; include 'dfunctions.php'; echo "$id"; echo "$use_id"; echo "$points"; echo "$birth"; echo "$up_id"; echo "$last_up"; ?> Any help anyone might offer would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/165080-my-mysql-query-doesnt-show-the-correct-row/ Share on other sites More sharing options...
fenway Posted July 15, 2009 Share Posted July 15, 2009 Echo the query itself. Link to comment https://forums.phpfreaks.com/topic/165080-my-mysql-query-doesnt-show-the-correct-row/#findComment-875973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.