Re: What is wrong with this INSERT?
| From: | Angelo Zanetti | Date: | Thu, 29 Mar 2007 14:23:00 +0000 |
| Subject: | Re: What is wrong with this INSERT? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251615@lists.php.net to get a copy of this message | ||
Rahul Sitaram Johari wrote:
Oh I¹m sorry! I was messing with the code when I copied it to the mailing list. This is the actual code:you still doing the same thing running mysql_query on mysql_query, see the other guy's post for the correct answer ------------------------------------------------------------------------ Angelo Zanetti Systems developer ------------------------------------------------------------------------ *Telephone:* +27 (021) 469 1052$sql = mysql_query("INSERT INTO olivejuice (WHEN, WHAT, WHO) VALUES('$WHEN','$WHAT','$WHO')"); And the entire code:<?php //Add Record Function if($_POST['Submit']) { $db = mysql_connect("localhost","usr","pwd"); mysql_select_db("thedb",$db) or die("Critical Error :".mysql_error()); $WHEN = date(mdyHi); $WHAT = $_POST['WHAT']; $WHO = $_POST['WHO']; echo "<SPAN CLASS='BlackText'>$WHEN, $WHAT, $WHO</SPAN><br>"; $sql = mysql_query("INSERT INTO tbl (WHEN, WHAT, WHO) VALUES('$WHEN','$WHAT','$WHO')");$result = mysql_query($sql) or die("Fatal Error :".mysql_error()); echo "<span class='SmallText'><EM><STRONG>~: message sent:~</STRONG></EM></span><BR><BR>";} ?>
*Mobile:* +27 (0) 72 441 3355 *Fax:* +27 (0) 86 681 5885* Web:* http://www.zlogic.co.za *E-Mail:* angelo@zlogic.co.za <mailto:angelo@zlogic.co.za>