If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Cant INSERT more than 2 fields at once

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-29-04, 00:15
philip pluckros philip pluckros is offline
Registered User
 
Join Date: Jan 2004
Posts: 17
Cant INSERT more than 2 fields at once

I have a strange problem inserting data to my database.
The script below works perfectly

<?php
printf ("Name =%s<br>",$name);
printf ("Style =%s<br>",$style);
printf ("Address=%s<br>",$address);

$db=mysql_connect("localhost","xxx","xxx");
mysql_select_db("xxx",$db);
$sql = "INSERT INTO xxx (name,style) VALUES ('$name','$style')";
mysql_query ($sql,$db);
?>

As soon as I change the query line to the following nothing works !!

$sql = "INSERT INTO xxx (name,style,address) VALUES ('$name','$style','$address')";

$Address does contain valid data, I have tested that by printing it at the start of the script.
This is even the exact SQL script which MySQL Admin generates when I do it manually and that DOES work.

It seems to be limiting me to inserting only two fields at a time, if I submit $name & $address it works, add $style to the query and nothing again !!

Can anyone please help !!
This is driving me nuts !

Thanks
Phil.
Reply With Quote
  #2 (permalink)  
Old 03-29-04, 12:58
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
Do you get an error message or do the fields not get updated when you try using three of them? From your code I see no reason that it shouldn't work.
Reply With Quote
  #3 (permalink)  
Old 03-29-04, 16:57
philip pluckros philip pluckros is offline
Registered User
 
Join Date: Jan 2004
Posts: 17
No error message at all.
The database just doesnt update.
If I do it manually wth three fields from MyphpAdmin it does update.

Grrrr!!
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On