Re: [PHP] Query help needed
It looks OK, but I have lousy track record of writing out "perfect" sql which doesn't work. Syntax looks OK. 1. What does it look like if you write out the update statement, assign it to a var and then echo the var? 2. Can you try it at the console? 3. Try " or die(mysql_error) ;" to see if you get a more specific error 4. Are your date and time fields of type char in the database? Yo may not need the surrounding single quotes. 5. Try building the sucker up bit by bit, until you hit where it breaks. Miles At 11:31 AM 11/29/2001 +, Payzillee wrote: >Hi, could anyone tell me what is wrong with this Insert query? I get an >'Invalid query' error but I can't see the problem at all. All the fields >match exactly what is in my database, it's all in lowercase too. > >Cheers. > >mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, >org_name, address1, address2, address3, address4, city, region, postal_code, >country, email, mob_phone, tel_number, fax_number, org_web_address, >personal_web_address, special_interests, date, time) > >VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', >'$address1', '$address2', '$address3', '$address4', '$city', '$region', >'$postal_code', '$country', '$email', '$mob_phone', '$tel_number', >'$fax_number', '$org_web_address', '$personal_web_address', >'$special_interests', '$date','$time')") > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: [PHP] Query Help Needed
that seems to be easy: put every string and varchar in single quotes eg '$surname' and every number like $fax_number without quotes regards martin -Ursprüngliche Nachricht- Von: Payzillee [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 29. November 2001 13:16 An: [EMAIL PROTECTED] Betreff: Re: [PHP] Query Help Needed error message is 'Invalid Query'. "Douglas McKenzie" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Could be that the value you're trying to insert doesn't match up with > the field type in the database - you know, putting a word in a number > field. What exactly is the error message? > > Payzillee wrote: > > >Hi, could anyone tell me what is wrong with this Insert query? I get an > >'Invalid query' error but I can't see the problem at all. All the fields > >match exactly what is in my database, it's all in lowercase too. > > > >Cheers. > > > >mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, > >org_name, address1, address2, address3, address4, city, region, postal_code, > >country, email, mob_phone, tel_number, fax_number, org_web_address, > >personal_web_address, special_interests, date, time) > > > >VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', > >'$address1', '$address2', '$address3', '$address4', '$city', '$region', > >'$postal_code', '$country', '$email', '$mob_phone', '$tel_number', > >'$fax_number', '$org_web_address', '$personal_web_address', > >'$special_interests', '$date','$time')") > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query Help Needed
error message is 'Invalid Query'. "Douglas McKenzie" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Could be that the value you're trying to insert doesn't match up with > the field type in the database - you know, putting a word in a number > field. What exactly is the error message? > > Payzillee wrote: > > >Hi, could anyone tell me what is wrong with this Insert query? I get an > >'Invalid query' error but I can't see the problem at all. All the fields > >match exactly what is in my database, it's all in lowercase too. > > > >Cheers. > > > >mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, > >org_name, address1, address2, address3, address4, city, region, postal_code, > >country, email, mob_phone, tel_number, fax_number, org_web_address, > >personal_web_address, special_interests, date, time) > > > >VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', > >'$address1', '$address2', '$address3', '$address4', '$city', '$region', > >'$postal_code', '$country', '$email', '$mob_phone', '$tel_number', > >'$fax_number', '$org_web_address', '$personal_web_address', > >'$special_interests', '$date','$time')") > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query Help Needed
Could be that the value you're trying to insert doesn't match up with the field type in the database - you know, putting a word in a number field. What exactly is the error message? Payzillee wrote: >Hi, could anyone tell me what is wrong with this Insert query? I get an >'Invalid query' error but I can't see the problem at all. All the fields >match exactly what is in my database, it's all in lowercase too. > >Cheers. > >mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, >org_name, address1, address2, address3, address4, city, region, postal_code, >country, email, mob_phone, tel_number, fax_number, org_web_address, >personal_web_address, special_interests, date, time) > >VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', >'$address1', '$address2', '$address3', '$address4', '$city', '$region', >'$postal_code', '$country', '$email', '$mob_phone', '$tel_number', >'$fax_number', '$org_web_address', '$personal_web_address', >'$special_interests', '$date','$time')") > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query Help Needed
I've got my names, web addresses etc. set up as Varchar and my telephone/fax numbers as Bigint. Special interests field as text. Only other field in the database is an auto increment number field. "Michael Hall" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Do those field names need single quotes too? Can't remember right now ... > Are there any datatype problems (wrong kind of datatype for a field)? > What about a semi-colon at the end? > > Mick > > On Thu, 29 Nov 2001, Payzillee wrote: > > > Hi, could anyone tell me what is wrong with this Insert query? I get an > > 'Invalid query' error but I can't see the problem at all. All the fields > > match exactly what is in my database, it's all in lowercase too. > > > > Cheers. > > > > mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, > > org_name, address1, address2, address3, address4, city, region, postal_code, > > country, email, mob_phone, tel_number, fax_number, org_web_address, > > personal_web_address, special_interests, date, time) > > > > VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', > > '$address1', '$address2', '$address3', '$address4', '$city', '$region', > > '$postal_code', '$country', '$email', '$mob_phone', '$tel_number', > > '$fax_number', '$org_web_address', '$personal_web_address', > > '$special_interests', '$date','$time')") > > > > > > > > > > > > > > -- > > Michael Hall > [EMAIL PROTECTED] > [EMAIL PROTECTED] > http://openlearningcommunity.org > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
AW: [PHP] Query Help Needed
take a look at your table definiton. maybe some of your fields have a diferent definition as the value you want to insert. e.g. fax_number in your query-string is defined as string and in your table as integer or something like this regards martin -Ursprüngliche Nachricht- Von: Payzillee [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 29. November 2001 12:37 An: [EMAIL PROTECTED] Betreff: [PHP] Query Help Needed Hi, could anyone tell me what is wrong with this Insert query? I get an 'Invalid query' error but I can't see the problem at all. All the fields match exactly what is in my database, it's all in lowercase too. Cheers. mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, org_name, address1, address2, address3, address4, city, region, postal_code, country, email, mob_phone, tel_number, fax_number, org_web_address, personal_web_address, special_interests, date, time) VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', '$address1', '$address2', '$address3', '$address4', '$city', '$region', '$postal_code', '$country', '$email', '$mob_phone', '$tel_number', '$fax_number', '$org_web_address', '$personal_web_address', '$special_interests', '$date','$time')") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query Help Needed
Do those field names need single quotes too? Can't remember right now ... Are there any datatype problems (wrong kind of datatype for a field)? What about a semi-colon at the end? Mick On Thu, 29 Nov 2001, Payzillee wrote: > Hi, could anyone tell me what is wrong with this Insert query? I get an > 'Invalid query' error but I can't see the problem at all. All the fields > match exactly what is in my database, it's all in lowercase too. > > Cheers. > > mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, > org_name, address1, address2, address3, address4, city, region, postal_code, > country, email, mob_phone, tel_number, fax_number, org_web_address, > personal_web_address, special_interests, date, time) > > VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', > '$address1', '$address2', '$address3', '$address4', '$city', '$region', > '$postal_code', '$country', '$email', '$mob_phone', '$tel_number', > '$fax_number', '$org_web_address', '$personal_web_address', > '$special_interests', '$date','$time')") > > > > > > -- Michael Hall [EMAIL PROTECTED] [EMAIL PROTECTED] http://openlearningcommunity.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Query Help Needed
Hi, could anyone tell me what is wrong with this Insert query? I get an 'Invalid query' error but I can't see the problem at all. All the fields match exactly what is in my database, it's all in lowercase too. Cheers. mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, org_name, address1, address2, address3, address4, city, region, postal_code, country, email, mob_phone, tel_number, fax_number, org_web_address, personal_web_address, special_interests, date, time) VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', '$address1', '$address2', '$address3', '$address4', '$city', '$region', '$postal_code', '$country', '$email', '$mob_phone', '$tel_number', '$fax_number', '$org_web_address', '$personal_web_address', '$special_interests', '$date','$time')") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Query help needed
Hi, could anyone tell me what is wrong with this Insert query? I get an 'Invalid query' error but I can't see the problem at all. All the fields match exactly what is in my database, it's all in lowercase too. Cheers. mysql_query ("INSERT INTO listserve (title, surname, forename, job_title, org_name, address1, address2, address3, address4, city, region, postal_code, country, email, mob_phone, tel_number, fax_number, org_web_address, personal_web_address, special_interests, date, time) VALUES ('$title', '$surname', '$forename', '$job_title', '$org_name', '$address1', '$address2', '$address3', '$address4', '$city', '$region', '$postal_code', '$country', '$email', '$mob_phone', '$tel_number', '$fax_number', '$org_web_address', '$personal_web_address', '$special_interests', '$date','$time')") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]