Jump to content

Exit Stops Rest Of Document...


Mencarta

Recommended Posts

When I use "exit;" inside a php script that is inside the middle of the page php doesn't display the rest of the page! Any alternative?Sample:

<body><?php$a = 1if ($a != 2) { exit; }?>Hia!</body>

Sample Output(Source Code):

<body>

Link to comment
Share on other sites

You can check if mysql_num_rows() is 0 and then print something else if it is:

if(mysql_num_rows($query)) {  // Show the database information} else {  echo "There are no database entries.";}

Link to comment
Share on other sites

My code still doesn't work...listcast.php

<?php	require_once("dbconnect.php");	$updates = array();		$sql = "SELECT * FROM cast";	$result = mysql_query($sql);	if (mysql_num_rows($result) == 0) {		echo "No Cast...";		exit;	}	else {		while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {			$updates[] = $row["person"];		}		sort($updates);				echo "<table border=\"0px\">";		foreach ($updates as &$id) {			echo "<tr>";			$select = "SELECT * FROM meets WHERE id='$id'";			$result = mysql_query($select);			$row = mysql_fetch_array($result);			echo "<td>".$row["character"]."</td><td>".$row["person"]."</td>";			echo "</tr>";		}		echo "</table>";	}?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...