php not executing

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
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

php not executing

Post by psychotomus »

my php code wont execute or even show any of the html.

it works on the rest of the site http://www.sundaybrew.com
it wont show any on http://www.sundaybrew.com/linklist.php

any ideas/

Code: Select all

<table width="100%"  border="0">
	  <tr>
		<td><div align="center">Site</div></td>
		<td><div align="center">Hits In</div></td>
		<td><div align="center">Hits Out</div></td>
	  </tr>
<?php

include("dbsetts.php")
$conn=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname) or die ("Unable to connect to MySQL");

$result = mysql_query( "SELECT * FROM sites ORDER BY hits_in DESC" ) or die("SELECT Error: ".mysql_error());

while($row=mysql_fetch_array($result) )
{
	print '
	  <tr>
		<td><div align="center"><a href="' . $row['site_url'] . '">' . $row['site_title'] . '</a></div></td>
		<td><div align="center">' . $row['hits_in'] . '</div></td>
		<td><div align="center">' . $row['hits_out'] . '</div></td>
	  </tr>';

}

?>
</table>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You have a parse error.
wildwobby
Forum Commoner
Posts: 66
Joined: Sat Jul 01, 2006 8:35 pm

Post by wildwobby »

error_reporting('E_ALL');

??
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You're missing a semicolon after your include. If you are developing locally, you could always turn error reporting on so you can see where the error is.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

wildwobby wrote:error_reporting('E_ALL');
Lose the quotes around the E_ALL and add an

Code: Select all

ini_set('display_errors', true);
and your there!
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Keep in mind that turning on display_errors using ini_set() would still not have shown this parse error.
Post Reply