Jump to content

[SOLVED] Outputting MYSQL query


$username

Recommended Posts

 

Hello People,

    I need to do a select on a field from a table in MYSQL and then make that select equal a variable.

I am not able to do so with my code. can someone tell me what I am doing wrong

 

Here is my code

<?PHP
include 'dbopen.php';
include 'dbconnect.php';
$username = ($_COOKIE["user"]);
$RandomGen = ($_COOKIE["RandomGen"]);
echo "<br>Random Value = ".rand(1000000000,9999999999);  
print_r($_COOKIE);
//SELECT RandomGen FROM `admin` WHERE username = \ 'test\' 
$sql102 = mysql_query("SELECT RandomGen FROM admin WHERE username = '$username'");
$row102 = mysql_fetch_array($sql102) or die ("no data");
$RandomGenDB = $row102;
echo $RandomGenDB, $username, $RandomGen ;
?>

Link to comment
https://forums.phpfreaks.com/topic/78840-solved-outputting-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.