|
-
Jul 30th, 2006, 02:35 AM
#1
Thread Starter
Addicted Member
[RESOLVED] PHP, MYSQL updating a value
I'm extreamly new to php and mysql but i've manadged to get the basics of retriving a value from a mysql table.
but now i would like to know how i can write to the same table/data/value
what ive got so far is
PHP Code:
<?php
$Ref = $_GET['ID'];
$host = 'localhost';
$db = 'sf_ref';
$user = '*'; //Beeped out for foums ;)
$pass = '*'; //Beeped out for foums ;)
$sql = mysql_connect($host, $user, $pass);
$dbHandle = mysql_select_db($db);
$result = mysql_query("SELECT * FROM `name` WHERE `Ref_Id` = '".$_GET['ID']."';", $sql);
$data = mysql_fetch_assoc($result);
$Name = $data['Name'];
$Number = $data['Ref_Num'];
$Number2 = $Number;
$Number2++;
$sql = "UPDATE name SET Ref_Num='$Number2' WHERE Name = '$Name'" ;
$result = mysql_query($sql) or die("SQL Update failed");
?>
but it doesnt work, can anyone tell me how to make it work or fix my code,
cheers Jazz
Last edited by Jazz00006; Aug 3rd, 2006 at 08:58 PM.
Reason: resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|