Re: What is wrong with this INSERT?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Awesome! This helps. I¹ll start using this method from now on ­ certainly
seems a lot more compliant and also actually helps eliminating the ³Submit²
button name confusion.

Thanks! Appreciated.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: sleepwalker@xxxxxxxxxxxxxxxx

³I morti non sono piu soli ... The dead are no longer lonely²



On 3/29/07 10:40 AM, "Daniel Brown" <parasane@xxxxxxxxx> wrote:

> 
>     That's correct, Rahul.  Anything sent using the HTTP POST method would be
> picked up.  Conversely, the same applies with if($_GET), which would be the
> case in almost all web-based coding, since GET is the default method.  And
> great job on Tij's part there.  I wasn't even paying attention to the reserved
> words.... guess I should finally go get a cup of coffee and start my day....
> 
> 
> On 3/29/07, Rahul Sitaram Johari <sleepwalker@xxxxxxxxxxxxxxxx> wrote:
>> 
>> Daniel I like your code ­ it's definitely cleaner and compact.
>> I have a question for you ­ I have never used "if($_POST) {", instead, always
>> felt I needed to specify the $Submit variable to check if form is submitted.
>> So basically if I use "if($_POST) {", would it automatically mean it's
>> checking if the form has been submitted?
>> 
>> BTW: figured out the problem, as resolved by Tijnema, "WHEN" is a reserved
>> word in mySQL.
>> 
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Rahul Sitaram Johari
>> CEO, Twenty Four Seventy Nine Inc.
>> 
>> W: http://www.rahulsjohari.com
>> E: sleepwalker@xxxxxxxxxxxxxxxx
>> 
>> "I morti non sono piu soli ... The dead are no longer lonely"
>> 
>> 
>> 
>> On 3/29/07 10:32 AM, "Daniel Brown" <parasane@xxxxxxxxx> wrote:
>> 
>>> 
>>>     Try this code, cleaned up and made a little more compliant.
>>> 
>>> <?
>>> //Add Record Function
>>> if($_POST) {
>>>         $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>";
>>> }
>>> ?>
>> 
> 
> 



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux