parse error

This is a discussion on parse error within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm really going crazy with this query : $insert = "INSERT INTO utilisateur(nom_utilisateur,mot_de_passe,prenom, " + "nom,...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-09-2005
Alexandre
 
Posts: n/a
Default parse error

Hi,

I'm really going crazy with this query :

$insert = "INSERT INTO utilisateur(nom_utilisateur,mot_de_passe,prenom, " +
"nom,date_de_naissance,site_internet, " +
"avatard,no_telephone,statut) VALUES " +
"('$nom_utilisateur','$mot_de_passe','$prenom' , " +
"'$nom,$date_de_naissance', " +
"'$site_internet', " +
"'/avatard/.$nom_utilisateur','$no_telephone', '1'");

I got Parse error: parse error, unexpected ')' at the last line

thx for your kindly help

Reply With Quote
  #2 (permalink)  
Old 01-09-2005
Roy W. Andersen
 
Posts: n/a
Default Re: parse error

Alexandre wrote:
>
> "'/avatard/.$nom_utilisateur','$no_telephone', '1'");
>


Your closing bracket is placed after the end quote of the string.

Your current statement reads $insert = "string"); which doesn't work
very well ;)


Roy W. Andersen
--
ra at broadpark dot no / http://roy.netgoth.org/

"Hey! What kind of party is this? There's no booze
and only one hooker!" - Bender, Futurama
Reply With Quote
  #3 (permalink)  
Old 01-09-2005
News Me
 
Posts: n/a
Default Re: parse error

Alexandre wrote:
> Hi,
>
> I'm really going crazy with this query :
>
> $insert = "INSERT INTO utilisateur(nom_utilisateur,mot_de_passe,prenom, " +
> "nom,date_de_naissance,site_internet, " +
> "avatard,no_telephone,statut) VALUES " +
> "('$nom_utilisateur','$mot_de_passe','$prenom' , " +
> "'$nom,$date_de_naissance', " +
> "'$site_internet', " +
> "'/avatard/.$nom_utilisateur','$no_telephone', '1'");
>
> I got Parse error: parse error, unexpected ')' at the last line
>
> thx for your kindly help
>


"'/avatard/.$nom_utilisateur','$no_telephone', '1'");

should be

"'/avatard/.$nom_utilisateur','$no_telephone', '1')";

NM

--
convert uppercase WORDS to single keystrokes to reply
Reply With Quote
  #4 (permalink)  
Old 01-09-2005
Alexandre
 
Posts: n/a
Default Re: parse error

really thx for your response but it's still doesn't work, if I try to do a
simple echo $insert;
I get this error message : 0 Erreurr SQL !0

I can't understand, how do you debug your query ?

thx in advance

"Roy W. Andersen" <roy-news@netgoth.org> wrote:
>Alexandre wrote:
>>
>> "'/avatard/.$nom_utilisateur','$no_telephone', '1'");
>>

>
>Your closing bracket is placed after the end quote of the string.
>
>Your current statement reads $insert = "string"); which doesn't work
>very well ;)
>
>
>Roy W. Andersen
>--
>ra at broadpark dot no / http://roy.netgoth.org/
>
>"Hey! What kind of party is this? There's no booze
>and only one hooker!" - Bender, Futurama


Reply With Quote
  #5 (permalink)  
Old 01-09-2005
Alexandre
 
Posts: n/a
Default Re: parse error

I found it :)

Alexandre <no@msn.com> wrote:
>really thx for your response but it's still doesn't work, if I try to do a
>simple echo $insert;
>I get this error message : 0 Erreurr SQL !0
>
>I can't understand, how do you debug your query ?
>
>thx in advance
>
>"Roy W. Andersen" <roy-news@netgoth.org> wrote:
>>Alexandre wrote:
>>>
>>> "'/avatard/.$nom_utilisateur','$no_telephone', '1'");
>>>

>>
>>Your closing bracket is placed after the end quote of the string.
>>
>>Your current statement reads $insert = "string"); which doesn't work
>>very well ;)
>>
>>
>>Roy W. Andersen
>>--
>>ra at broadpark dot no / http://roy.netgoth.org/
>>
>>"Hey! What kind of party is this? There's no booze
>>and only one hooker!" - Bender, Futurama

>


Reply With Quote
  #6 (permalink)  
Old 01-09-2005
Pedro Graca
 
Posts: n/a
Default Re: parse error

Alexandre wrote:
> I'm really going crazy with this query :
>
> $insert = "INSERT INTO utilisateur(nom_utilisateur,mot_de_passe,prenom, " +

111111111111111 222222222222 333333
> "nom,date_de_naissance,site_internet, " +

444 55555555555555555 6666666666666
> "avatard,no_telephone,statut) VALUES " +

7777777 888888888888 999999

It appears that you are inserting into nine columns, but ...
> "('$nom_utilisateur','$mot_de_passe','$prenom' , " +

111111111111111111 222222222222222 333333333
> "'$nom,$date_de_naissance', " +

4444444444444444444444444
> "'$site_internet', " +

5555555555555555
> "'/avatard/.$nom_utilisateur','$no_telephone', '1'");

6666666666666666666666666666 777777777777777 888

you only have eight columns specified in the VALUES group.



There are two more thing wrong here:

a) (I´m not sure if this is wrong or is really what you want)
You have "'/avatard'.$nom_utilisateur',..."

When $nom_utilisateur is "Pedro" this will create "/avatard/.Pedro"

b) As other posters have said, your closing parentheses is outside the
string

You have $insert = "whatever");
which should be $insert = "whatever";

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0