Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.