Hi all i need some help with my code. i have a page where i want to update a row 'key' in my table users with a new value that i have generated.
<?php $dbname = 'phplogin'; $link = mysql_connect("localhost","root","") or die("Couldn't make connection."); $db = mysql_select_db($dbname, $link) or die("Couldn't select database"); ?>
<?php session_start(); include ('dbc.php'); $keys = rand(1000,9999); $id = $_SESSION['user_name']; echo $id; echo $keys; mysql_query("UPDATE users SET key = '$keys' WHERE id = '$id'"); ?>
i am able to echo the values id and keys, and it gives me legitimate results. however, the sql query does not update the row like i want it to.