|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
pop a echo infront of you $sql ....
echo $sql = "INSERT INTO xxx (name,style,address) VALUES ('$name','$style','$address')"; and make sure the query looks ok in the first palce. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Cant INSERT more than 2 fields at once |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|