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

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
giarkcom
Forum Newbie
Posts: 24
Joined: Thu Nov 09, 2006 8:22 pm

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

Post 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
brendandonhue
Forum Commoner
Posts: 71
Joined: Mon Sep 25, 2006 3:21 pm

Post by brendandonhue »

You have an opening quote before $sql)
giarkcom
Forum Newbie
Posts: 24
Joined: Thu Nov 09, 2006 8:22 pm

Post by giarkcom »

thank you so much!
brendandonhue
Forum Commoner
Posts: 71
Joined: Mon Sep 25, 2006 3:21 pm

Post by brendandonhue »

No problem :)
Post Reply