montymoose
Posts: 85
|
| Posted: 01/13/2008, 9:06 AM |
|
global $DBMySQL;
$SQL = "UPDATE contact SET contact_type = 2 WHERE contact_id = 20";
$DBMySQL->query($SQL);
This event is meant to occur when the user clicks a button... any ideas why it doesn't work?
Thanks,
M00S3
|
 |
 |
ckroon
Posts: 869
|
| Posted: 01/13/2008, 5:24 PM |
|
I believe you need ' ' marks around the 2 and the 20.. but I am by no means an expert. that is what I would try.
_________________
Walter Kempees...you are dearly missed. |
 |
 |
montymoose
Posts: 85
|
| Posted: 01/14/2008, 2:13 AM |
|
global $DBMySQL;
$SQL = "UPDATE contact SET contact_type = '2' WHERE contact_id = '20'";
$DBMySQL->query($SQL);
Thanks mate, but that still doesn't work... any more suggestions?
|
 |
 |
datadoit
|
| Posted: 01/14/2008, 5:46 AM |
|
montymoose wrote:
> global $DBMySQL;
> $SQL = "UPDATE contact SET contact_type = 2 WHERE contact_id = 20";
> $DBMySQL->query($SQL);
>
> This event is meant to occur when the user clicks a button... any ideas why it
> doesn't work?
>
> Thanks,
>
> M00S3
> ---------------------------------------
Make sure there's already a connection on the page, otherwise using the
existing connection won't work. I always like to use new connections
just to avoid any surprises.
global $DBMySQL;
$db = new clsDBMySQL();
$SQL = "UPDATE contact SET contact_type = '2' WHERE contact_id = '20'";
$db->query($SQL);
$db->close();
Secondly, as already suggested, may want to use semi-quotes on your
field values. Not always necessary, but will avoid throwing SQL errors
on blank values.
Finally, make absolute certain that you have a field with a contact_id
value of 20.
|
|
|
 |
dbeckett90
Posts: 1
|
| Posted: 01/14/2008, 11:36 AM |
|
$db->query("UPDATE contact SET contact_type = 2 WHERE contact_id= 20 ");
Been fighting it too, this worked for me :)
|
 |
 |
montymoose
Posts: 85
|
| Posted: 01/14/2008, 11:40 AM |
|
Cheers dude...! CCS is like an old cherished car... you love it to bits but sometimes when you can't get it to go it does your head in!!
|
 |
 |
|