Re: Re: php/mysql weblog - addnews function problems
| From: | Doug Thompson | Date: | Wed, 18 Feb 2004 13:01:10 +0000 |
| Subject: | Re: Re: php/mysql weblog - addnews function problems | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32999@lists.php.net to get a copy of this message | ||
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