Page 1 of 1

Help in sintax error

Posted: Wed Sep 21, 2011 9:15 pm
by petite
Hello I am new in this Forum and I am begginner in PHP, I just followed a web tutorial about php and dreamweaver, I found a
error sintax in the followed code, I dont to know, what is the mistake, if somebody can help, I will appreciate.

this is the lines of code,
-----------------------------------------------------------------------------------------------------------------------
$query_getdisplay ="SELECT news.title, news.blog_entry, DATE_FORMAT(news.updated, '%M %e, %Y')
AS formatted FROM newsORDER BY news.updated DESC LIMIT 2";
)
$getdisplay = mysql_query($query_getdisplay, $check_mag) or die(mysql_error());
$row_getdisplay = mysql_fetch_assoc($getdisplay);
$totalRows_getdisplay = mysql_num_rows($getdisplay);

------------------------------------------------------
the sintax error, appear in the line: AS formatted FROM newsORDER BY news.update DESC LIMIT 2" ';



Thanks for any help.
Petite

Re: Help in sintax error

Posted: Thu Sep 22, 2011 2:40 am
by Dodon
Maybe newsORDER needs a space? Does it work then?

Re: Help in sintax error

Posted: Thu Sep 22, 2011 11:46 am
by malakiahs
I agree with Dodon. Since news seems to be the table you are using for your query you should separate it with ORDER BY.

Re: Help in sintax error

Posted: Thu Sep 22, 2011 2:24 pm
by petite
Hello, guys. thanks for your help, I dont know, if I understood good. I just separated ORDER BY, from news.

but still there is a sintax error. in the line of code.

Any other suggestions?

Thanks.

Petite

Re: Help in sintax error

Posted: Thu Sep 22, 2011 3:27 pm
by malakiahs
Well I also see an extra parenthesis

AS formatted FROM newsORDER BY news.updated DESC LIMIT 2";
)
$getdisplay = mysql_query($query_getdisplay, $check_mag) or die(mysql_error());


maybe you should remove it so that i can look like this

AS formatted FROM newsORDER BY news.updated DESC LIMIT 2";

$getdisplay = mysql_query($query_getdisplay, $check_mag) or die(mysql_error());


But its difficult to tell if you are using that parenthesis with some code that you are not providing. Try removing the parenthesis if you are not using it with anything else.