On Wednesday 15 January 2003 18:57, Frank Keessen wrote:
> Thanks, but not working:
>
> The error message:
> Error in query: SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> . You have an error in your SQL syntax near '' at line 1
>
> Here are both lines:
>
> $query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =
> {$_GET['id']}";
>
>
>  $result = mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());

Let's put this straight when referring to items in an array inside a 
double-quoted string that is the correct syntax to use. IE:

$query = "SELECT Newsheadline, News, Contact FROM news WHERE Newsid =  
{$_GET['id']}";

Your problem now is clearly one of SQL syntax as the error states so 
explicitly. 

If Newsid is not numerical type then you need single quotes around the 
expression that it is being compared to. IOW your query should look like:

  $query = "SELECT Newsheadline, 
                   News, 
                   Contact 
              FROM news 
             WHERE Newsid = '{$_GET['id']}'";

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
If we see the light at the end of the tunnel, it's the light of an
oncoming train.
                -- Robert Lowell
*/


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

Reply via email to