Help in sintax error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
petite
Forum Newbie
Posts: 2
Joined: Wed Sep 21, 2011 9:07 pm

Help in sintax error

Post 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
Dodon
Forum Commoner
Posts: 64
Joined: Wed Aug 03, 2011 4:11 am
Location: Netherlands

Re: Help in sintax error

Post by Dodon »

Maybe newsORDER needs a space? Does it work then?
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Re: Help in sintax error

Post 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.
petite
Forum Newbie
Posts: 2
Joined: Wed Sep 21, 2011 9:07 pm

Re: Help in sintax error

Post 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
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Re: Help in sintax error

Post 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.
Post Reply