RE: [PHP-DB] INSERT Problem
| From: | Jeff Oien | Date: | Wed, 09 May 2001 16:44:52 +0000 |
| Subject: | RE: [PHP-DB] INSERT Problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9197@lists.php.net to get a copy of this message | ||
OK, did that and it's just printing the INSERT command back to me.
INSERT INTO OVEvents (First_Name, Last_Name) VALUES("Jeff", "Oien")
Any help from here? Thanks.
Jeff Oien
> <HINT>
> echo $sql;
> </HINT>
>
> always helpful, then paste that into the command line client and check the
> error
>
>
> Cameron
>
> Jeff Oien wrote:
>
> > This is driving me nuts. I can't insert anything into a mysql database
> > using PHP. I can insert from the command line when logged in with Telnet.
> > Using PHP I can connect and retrieve data from the database, just can't
> > INSERT anything.
> >
> > This is what doesn't work:
> > $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> > VALUES (\"Jeff\", \"Oien\")";
> > $result = mysql_query($sql,$connection) or die("Failed");
> >
> > or
> >
> > $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> > VALUES (\"$First_Name\", \"$Last_Name\")";
> > $result = mysql_query($sql,$connection) or die("Failed");
> >
> > yet this will work from the command line:
> > INSERT INTO TheTable (First_Name, Last_Name)
> > VALUES ("Jeff", "Oien");
> >
> > Am I missing something? Thanks for any help.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>