call the first raw of a while loop from another file
Posted: Sun May 17, 2009 12:50 am
The while loop below uses mysql_fetch_assoc and it has several rows and it is located in a file call example1.php. But what I want is to call the first row of this while loop found in example1.php from another file call shoe.php. it's that possible?
Code: Select all
$sql = 'SELECT id,Subject FROM menusubjects;';
$result = mysql_query($sql);
if($result && mysql_num_rows($result)!=0) {
echo '<ul id="nav-categories">';
while($row = mysql_fetch_assoc($result)) {
$uri = 'example1.php?subject='.urlencode($row['id']);
$class = !is_null($cat) && $cat==$row['id']?' class="selected"':'';
echo "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'].'</a>';
if($submenu==false && !is_null($cat) && $cat == $row['id']) {