Re: What is wrong with this INSERT?

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

 



Agreed, if there are multiple forms, I will definitely have to use either
Submit name or some form of identifier.

Thanks!


On 3/29/07 10:47 AM, "Zoltán Németh" <znemeth@xxxxxxxxxxxxxx> wrote:

> 2007. 03. 29, csütörtök keltezéssel 10.38-kor Rahul Sitaram Johari ezt
> írta:
>> 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?
> 
> if there is $_POST then you have received some POST data. so the form
> has been submitted (but make sure that the same php script is handler
> for only one form to avoid confusion)
> 
> greets
> Zoltán Németh
> 
>> 
>> 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>";
>>> }
>>> ?>
>> 
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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