Jump to content

[SOLVED] php help on explode


onthespot

Recommended Posts

hey guys, this just keeps returning too many rows.

can anyone help?

 

<?php
$fixtures = mysql_query("SELECT * FROM fixtures WHERE comp =  '$_GET[comp]' AND (home_user like '$_SESSION[username]' or away_user like '$_SESSION[username]')");

while( $row = mysql_fetch_assoc($fixtures)) {

extract($row);

$info = explode("_",$row[comp]);

?>     <h1 class="pagetitle"><? echo $info[2]?></h1><?

} ?>

 

The problem is that this keeps returning the row "comp" as many times as the amount of rows in total in that table.

How can I stopthis?

Link to comment
https://forums.phpfreaks.com/topic/167055-solved-php-help-on-explode/
Share on other sites

$fixtures = mysql_query("SELECT * FROM fixtures WHERE comp =  '$_GET[comp]' AND (home_user like '$_SESSION[username]' or away_user like '$_SESSION[username]')");

while( $row = mysql_fetch_assoc($fixtures)) {
$title=$row['comp'];
echo"<h1 class=\"pagetitle\">$title</h1><table cellspacing=\"10\">
<tr>
<td>Competition</td>
<td>Game</td>
<td>Format</td>
</tr>";

}

 

I tried this but still just returns the title as many times as the number of rows at the top. Just over and over.

4 fixtures, 4 titles, just this time each title is one after another at the top of the page.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.