Forums

PHP

This topic is locked

Insert Record :) Update Record :(

Posted 19 Jun 2003 02:18:33
1
has voted
19 Jun 2003 02:18:33 Dean Blackborough posted:
Hi

Working through this book and trying to build my own management system, only one example record created in the book and the record is inserted by hand-coded php. Only ever really messed with PHP though DMX so not really sure what is going on.
<pre id=code><font face=courier size=2 id=code>// Insert Data
$myquery = "INSERT INTO tblusers (Username, Password, Status) VALUES
('$username', '$password', '$status')";
$result = mysql_query($myquery, $mysql);
if (!$result) {
$error = "Cannot run Query";
return $error;
}</font id=code></pre id=code>

Now I would like to continue to work this way as I am trying to learn php but how do I modify the above to update a record based on a certain username which I have managed to store in a cookie.

Assuming it is the same command but something with a WHERE Username = $HTTP_COOKIE_VARS['UsernameID'] or something similar in it.

If anyone can point me in the right direction I will very much appreciate it.

Reply to this topic