Susan, try the following:
> > $sql = "UPDATE newdacs
> > SET emailfwd='$emailfwd',
> > mformat='$mformat',
> > filter_code='$filter_code'"; // close query string
> > if ($FUNC=='USERPOST') {
> > $sql. = ",unote='$unote'"; // append
additional condition to query
> > }
> > WHERE user_id='$user_id'";
If I'm reading things properly, it looks like the parser doesn't know that
you want to append another condition to the query.
Hope this helps.
Rich
> -----Original Message-----
> From: Susan Ator [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2003 11:18 AM
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] Is this query even possible?
>
>
> > This is what I am trying to do:
> >
> > if ($FUNC==("USERPOST") || $FUNC==("MODU")) {
> > $sql = "UPDATE newdacs
> > SET emailfwd='$emailfwd',
> > mformat='$mformat',
> > filter_code='$filter_code'
> > if ($FUNC=='USERPOST') {
> > ,unote='$unote'
> > }
> > WHERE user_id='$user_id'";
> > $set_newdacs_result = mysql_query($sql) or print
> > mysql_error();
> > }
> >
> > There are several more queries like this which is why I
> want to avoid
> > duplicating the code since there are only 1 or 2
> differences between them
> > depending on function call.
> >
> > This is the error I am getting:
> >
> > You have an error in your SQL syntax near 'if
> (USERPOST=='USERPOST')
> > { ,unote='' } WHERE user_id='2'' at line 5
> >
> > Is what I am attempting possible or am I spinning my wheels?
> >
> > susan
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php