Jump to content

my mysql query doesn't show the correct row...


Recommended Posts

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!

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.