Re: Re: php/mysql weblog - addnews function problems

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

 



On Wed, 18 Feb 2004 09:35:22 -0000, Slippyaah wrote:

>Well basically I think it's a problem with the declaration of variables
>and/or the way they are being processed by the form.
>
>Here is the individual addNews function:
>
>function addNews() {
>       global $db;
>
>       /* declare variables here? */
>
>
>
>       /* insert the new news entry */
>       $query = "INSERT INTO news" .
>          "VALUES('',$id,'{$_POST['postdate']}'," .
>          "'{$_POST['title']}',".
>          "'{$_POST['newstext']}')";

I haven't been following this thread, but you need to do your part to help the parser.

	$query = "INSERT INTO news ";
	$query .= "VALUES('',$id,'".$_POST['postdate']."',";
	$query .= "'".$_POST['title']."',";
	$query .= "'".$_POST['newstext']."')";

You should also add some db error checking and reporting, then you wouldn't get the erroneous "success" message.

hth,
Doug

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux