Still getting #1064s!!!?!!?!!

Hello all... I'm always getting these 1064 errors... For example I have
a mySQL dbase that i can connect to fine.. read values etc fine.. but I
want to update a field with different text and it won't work.. I've
tried numerous variations, but here is one of them.

p.s. the vars are as follows:
$globalYear = "2006";
$dayAsWord = "twentythree";
$updatedText = "What I want to insert";
$globalMonth = "dek" // I had "dec" but that was a reserved word so i
changed it.

$theQuery = "UPDATE '{$globalYear}' SET '{$dayAsWord}' =
'{$updatedText}' WHERE 'months' LIKE '{$globalMonth}'";


My table is as Follows:

month | start | days | one | two | etc....
___________________________________
dek | 3 | 31 | | |


If anyone can point me in the right direction on how to avoid the
#1064 errors I would greatly appreciate it!!!!!!!!!!!!!!!!!!!!!! I've
tried removing ' away from certain words and adding to others and no
combination has helped at all... this language is EASY except for this
part, which I don't understand..... Thanks again ahead of time!!!!
Mwahahahahaaahaa [ So, 10 Dezember 2006 03:17 ] [ ID #1563181 ]

Re: Still getting #1064s!!!?!!?!!

BTW.. I also tried:
$theQuery = "UPDATE '{$globalYear}' SET '{$dayAsWord}' =
'{$updatedText}' WHERE 'month' = '{$globalMonth}'";

which ECHO'd:

UPDATE '2006' SET 'one' = 'dddd' WHERE 'month' = 'dek'


Don't know what is wrong.. 2006 is my table. "one" is an accurate
field. so is "month" and so is the value "dek". I also tried changing
'month' to 'months' to see if it was a used keyword, but it didn't
change the results
Mwahahahahaaahaa [ So, 10 Dezember 2006 04:34 ] [ ID #1563183 ]

Re: Still getting #1064s!!!?!!?!!

Mwahahahahaaahaa wrote:
> Hello all... I'm always getting these 1064 errors... For example I have
> a mySQL dbase that i can connect to fine.. read values etc fine.. but I
> want to update a field with different text and it won't work.. I've
> tried numerous variations, but here is one of them.
>
> $theQuery = "UPDATE '{$globalYear}' SET '{$dayAsWord}' =
> '{$updatedText}' WHERE 'months' LIKE '{$globalMonth}'";

$theQuery = "UPDATE `{$globalYear}` SET `{$dayAsWord}` =
'{$updatedText}' WHERE `months` LIKE '{$globalMonth}'";

Do you see the difference?


//Aho
Shion [ So, 10 Dezember 2006 07:19 ] [ ID #1563184 ]

Re: Still getting #1064s!!!?!!?!!

It worked! I don't see any difference thought?! What was the error?
Thanks so much!

> > $theQuery = "UPDATE '{$globalYear}' SET '{$dayAsWord}' =
> > '{$updatedText}' WHERE 'months' LIKE '{$globalMonth}'";
>
> $theQuery = "UPDATE `{$globalYear}` SET `{$dayAsWord}` =
> '{$updatedText}' WHERE `months` LIKE '{$globalMonth}'";
>
> Do you see the difference?
>
>
> //Aho
Mwahahahahaaahaa [ So, 10 Dezember 2006 07:28 ] [ ID #1563185 ]

Re: Still getting #1064s!!!?!!?!!

Mwahahahahaaahaa wrote:
> It worked! I don't see any difference thought?! What was the error?
> Thanks so much!
>
>>> $theQuery = "UPDATE '{$globalYear}' SET '{$dayAsWord}' =
>>> '{$updatedText}' WHERE 'months' LIKE '{$globalMonth}'";
>> $theQuery = "UPDATE `{$globalYear}` SET `{$dayAsWord}` =
>> '{$updatedText}' WHERE `months` LIKE '{$globalMonth}'";
>>
>> Do you see the difference?


You use `` around column names and '' around values.



//Aho
Shion [ So, 10 Dezember 2006 09:49 ] [ ID #1563186 ]

Re: Still getting #1064s!!!?!!?!!

> You use `` around column names and '' around values.

I see!!! LOL, those barely look different! Now I know where half of my
problems are coming from. Thanks again Aho, for all your help!
Mwahahahahaaahaa [ So, 10 Dezember 2006 23:39 ] [ ID #1563188 ]
PHP » alt.php.sql » Still getting #1064s!!!?!!?!!

Vorheriges Thema: Finding specific column names
Nächstes Thema: Create new function for a select statement - TIA