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
Share on other sites

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.