[thelist] PHP - Invalid Query

Sarah Sweeney mr.sanders at designshift.com
Fri Jun 11 10:41:12 CDT 2004


Rob Smith wrote:
> I'm getting an "invalid query" in the INSERT query below with PHP. Can you
> see anything that may cause it to barf:
> 
> Original:
> $sql = "INSERT INTO newsarchive (newssubject, newsarchivetext) VALUES ('" .
> $subject . "', '" . $message . "')";
> mysql_query($sql, $link) or die ("Invalid query");
> 
> Actual:
> INSERT INTO newsarchive (newssubject, newsarchivetext) VALUES ('Just a Quick
> Hello', 'Hi Everyone, My name is Rob and I built this Newsletter System.
> I've been having some difficulties with it lately and would like for you to
> respond to either me at my at addres.com  if you received this newsletter.
> Thank you so much, Rob p.s. See you later!
> --------------------------------------------------------- Please reply to
> this message if you have questions. If you would like to unsubscribe from
> this mailing list click this link:
> http://www.mysite.com/unsubscribe.php?nid=1.')
> 
> It's PHP and MySQL.

Have you tried running this query directly in MySQL to see if it works? 
That should at least help you narrow down the source of the error.

-- 
Sarah Sweeney
Web Developer & Programmer
Portfolio :: http://sarah.designshift.com
Blog, etc :: http://hardedge.ca


More information about the thelist mailing list