Page 1 of 1

URGENT. Need help with Code for Updating

Posted: Thu Oct 06, 2005 11:42 am
by nmpku
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I am having problems updating data in a table. Below is my code. Can someone please help? I keep on getting a "Query Empty" message. 

Code:

Code: Select all

<?php
$username = $_COOKIE[iscqc];
$membershipemail = $_POST['email1']; 
$membershiporderID = $_POST['orderID'];
$membershipstatus = $_POST['status'];
$membershipcountry = $_POST['country'];
$membershiptype = "Full";
$membershipdate = date('Y-m-d H:i:s');
$db_name = "dbname";
$table_name = "registration";
$connection = mysql_connect("www.xyz.com", "staff", "password") or die(mysql_error());
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "UPDATE registration SET
membershipemail = '$membershipemail', 
membershiporderID = '$membershiporderID',
membershipstatus = '$membershipstatus',
membershipcountry = '$membershipcountry',
membershiptype = '$membershiptype',
membershipdate = '$membershipdate'
WHERE username = '$username'";
$result = mysql_query($sql,$connection) or die(mysql_error());
?>

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Oct 06, 2005 11:49 am
by feyd
  • emit $sql to see if it's what you think it should be.
  • quote all named array indices unless they are infact defined constants:

    Code: Select all

    $username = $_COOKIE[iscqc];
    should be

    Code: Select all

    $username = $_COOKIE['iscqc'];