Re: insert data to mysql
| From: | Richard Crawford | Date: | Mon, 23 Apr 2001 17:47:55 +0000 |
| Subject: | Re: insert data to mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49896@lists.php.net to get a copy of this message | ||
Concatenate your string.
"...VALUES ('".$client."','".$contact."')" (etc.)
Or just replace the double-quotes within the string with single quotes.
That should do it.
>>>>>>>>>>>>>>>>>> Original Message
>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<
On 4/23/01, 10:32:47 AM, "shawn" <shawn@earthgroup.org> wrote regarding
[PHP] insert data to mysql:
> Hello,
> I am just wondering if someone can help me out with this. This is what I
have so far, but it isnt working:
> MYSQL_CONNECT($hostname, $username, $password)
> or die("Unable to connect to database");
> @mysql_select_db( "$dbName")
> or die( "Unable to select database");
> $sql = "INSERT INTO $userstable (client, contact, email, address, city,
state, zip, phone, fax, model, country, details, type)
> VALUES("$client", "$contact", "$email", "$address",
> "$city", "$state",
"$zip", "$phone", "$fax", "$model", "$country",
"$details", "$type")";
> $result = MYSQL_QUERY($sql) or die ("Couldn't execute query");
> MYSQL_CLOSE();
> Im new (no kidding?), so i hope this is easy, also, is there a address
anyone can point me to for a archive of this list?
> Thanks in advance,
> Shawn