Page 1 of 1

help!!--string error i have no idea what is wrong

Posted: Thu Nov 09, 2006 8:32 pm
by giarkcom
i am using this code for a site i am designing. i need it for the news on the home page.

Code: Select all

<?php 
		  $database='ffleag00_thg';
			include('connect.php');
			$sql='SELECT*FROM newspost ORDER BY id LIMIT 5';
			$result=mysql_query('$sql);
			while ($row=mysql_fetch_assoc($result)) {
		print '<h2>'.$row['title'].'</h2><p>'.$row['body'].'<br><i>by '.$row['user'].'</i></p>'; // line 12
			}
?>
and it comes up with this error:
Image
please help

Posted: Thu Nov 09, 2006 8:36 pm
by brendandonhue
You have an opening quote before $sql)

Posted: Thu Nov 09, 2006 8:47 pm
by giarkcom
thank you so much!

Posted: Thu Nov 09, 2006 8:53 pm
by brendandonhue
No problem :)