Re: MYSQL: INsert html form data;
| From: | David Robley | Date: | Tue, 30 Apr 2002 22:19:46 +0000 |
| Subject: | Re: MYSQL: INsert html form data; | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18918@lists.php.net to get a copy of this message | ||
In article <200204302056.g3UKuKQ14987@siteb-art.com>, info@best-it.biz
says...
> I have a problem writing form data to a table in MySQL. I have an action.php file
> that it called when the information is submitted and it looks something like this:
>
> <?php
>
> $connection = mysql_connect("@localhost","root", "password")
> or die ("The DataBase is Down!");
>
> mysql_select_db("web_feedback", $connection)
> or die ("I Can't connect at database!");
>
> $query_st_name = mysql_query("INSERT into name_email (col1) values($name)");
> $query_st_email = mysql_query("INSERT into name_email (col2) values($email)");
> mysql_close($connection); // Close this connection
> ?>
>
> Thanks for submitting your name and e-mail, I will contact you soon to discuss your
> interest in more detail.
>
> I can tell the file is being called since the previous message appears in the window.
> But when I go to check out my table there are no records. Anyone see where this may
> be going wrong? I also set a php_error log path in the PHP.ini and I do not get any
> errors written there. I think it may be something else but not sure what...
>
> the site: www.best-it.biz
> the link: services
> thanks in advance!
> /Tim
Why are you doing two inserts? In any case, its likely that your error is
not having single quotes around the values you are trying to insert -
presumably they are char type fields? Use mysql_error after each of your
mysql_query to see if an error is being returned by mysql.
--
David Robley
Temporary Kiwi!
Quod subigo farinam