What is wrong with this INSERT?
| From: | Rahul Sitaram Johari | Date: | Thu, 29 Mar 2007 14:27:52 +0000 |
| Subject: | What is wrong with this INSERT? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-251618@lists.php.net to get a copy of this message | ||
Ave,
For total clarity, I¹m starting this post again. I messed up big time with
my posts.
So here¹s my actual 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 = "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>";
}
?>
Now, this part is working absolutely fine and printing out echo values:
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>";
But this part is not working and not giving any errors:
$sql = "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>";
}
Thanks!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.
W: http://www.rahulsjohari.com
E: sleepwalker@rahulsjohari.com
³I morti non sono piu soli ... The dead are no longer lonely²