09-23-2004, 12:32 AM
Okay, I am making a script that is going to show someone's personal info using some cookies that are set when you log on. Using SELECT and a variable that is assigned the username cookie, I need to display their points. I just can't get it right! Could some one help me out on this? I'm so clueless :confused:
You'll probably get better help if you pose more punctual questions + show us the code you already have.
09-23-2004, 01:21 AM
$sql = mysql_query("SELECT * FROM _____1_____ WHERE ____2_____",$connection) or print mysql_error();
$login_check = mysql_num_rows($sql);
if($login_check > 0)
while($row = mysql_fetch_array($sql))
foreach( $row AS $key => $val )
$$key = stripslashes( $val );
HTML GOES HERE
<?php echo $row["points"]; ?>
<?php } } ?>
Now I'm going to explain.
1. This is the table in your MySQL Database that you're selecting the data from.
2. The row to select the info from... for example selecting user "dnirvine" points is username='dnirvine' Usually this is a variable such as username='$username'
$username=$_SESSION["username"]; This takes the info from the session "username" and puts it into a variable for easy use.
<?php echo $row["points"]; ?> This echos the row "points" from the database.
Hope this helps.
09-23-2004, 01:50 AM
After all the taking I was finally able to help someone! :cool: :thumbsup: