PHP Problems

[php]$conn = mysql_connect(‘server’, ‘username’, ‘password’);
if (!$conn) {
die(‘Could not connect, contact administrator.’) . mysql_error());
};

mysql_select_db("dbo.statuspanel", $conn);
$dbselect = "SELECT
            unlock,
 discharges,
 receptions,
 dutymanager,
 dutyofficer
 FROM dbo.statuspanel
 ";

echo "<html>
		<body>
			<h1>CMS Rollboard</h1>
		</body>
	  </html>
	 ";
echo "<table border='2'>
		<tr>
	  <th>SECURITY STATUS - HEIGHTENED</th>
	  </tr>
	  <tr>
	  <th>	TOTAL UNLOCK			$unlock</th>
	  </tr>
	  <tr>
	  <th>	TOTAL DISCHARGES		$discharges</th>
	  </tr>
	  <tr>
	  <th>	TOTAL RECEPTIONS		$receptions</th>
	  </tr>
	  <tr>
	  <th>	TOTAL ROLL COUNT       $unlock - $discharges + $receptions</th>
	  </tr>
		";

mysql_close($con);[/php]

I’m trying to create a simple webpage with a table, i cant seem to get the variables in the table to be variables, just posts them as text. Also, is there anything else i need to do?

You need to execute the query - mysql_query($dbselect), after that, add a loop.

while($row = mysql_fetch_array($dbselect)) {

// display code

}

Sponsor our Newsletter | Privacy Policy | Terms of Service