Jump to content

[SOLVED] Insert VALUES(...)


otuatail

Recommended Posts

I have heard of this type of problem before. I am copying some data from one table to another but one of the values of a text field has a space in it.

 

$name = "Paul";

$address = "My House";

 

$sql = "Insert into Newtable (name , address) VALUSE ($name , $address )";

Result ERROR near House

 

This is going to cuse a big problem with spaces in strings. I believe there is a solution to this.

 

Desmond.

 

Link to comment
https://forums.phpfreaks.com/topic/62628-solved-insert-values/
Share on other sites

There are no single quotes in the query

 

INSERT INTO Accounts( f_name, l_name, friendly, address, PC, email, user, pwd, GUID, pwd2, Validate )

VALUES (

 

Michael, Jackson, Mickey, My Home, YO30 6BT, michael.jackson@neverland - park.com, Neverland, Thriller, 1184422857, 41ce88c91e341fce1c4d961ef9244c32, Y

)

Link to comment
https://forums.phpfreaks.com/topic/62628-solved-insert-values/#findComment-311729
Share on other sites

This is the SQL

 

    $sql_out = "INSERT INTO Accounts (f_name , l_name , friendly , address , PC , email , user , pwd , GUID , pwd2 , Validate) ";

    $sql_out .= " VALUES ($f_name , $l_name , $friendly , $address , $PC , $email , $user , $pwd , $GUID , $md5 , $Validate)";

 

Do I have to put single quotes around every value as in

 

VALUES ( " ' " . $f_name . " ' , '"

Link to comment
https://forums.phpfreaks.com/topic/62628-solved-insert-values/#findComment-311736
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.