PDA

View Full Version : How do I pass a variable into a module?


iwantcheese
11-01-2004, 06:23 PM
I have a page "leagues" which contains module "leagues" (custom content module)

module leagues accepts an input lid, so a call to

cmps_index.html?page=leagues&lid=4 should make the variable lid 4. For some reason the variable is not passed into my module.

Is there something I am doing wrong?

Thanks for your time.

Brian
11-01-2004, 07:35 PM
Are you using $_REQUEST['lid'] in your code?

Our Sponsors
 

iwantcheese
11-01-2004, 08:10 PM
This is the code I am using, is there another way I should be doing it? Thanks!

This is the error I get

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/6/d112771430/htdocs/blindclan/v5/forum/modules/page_leagues.php on line 29

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /homepages/6/d112771430/htdocs/blindclan/v5/forum/modules/page_leagues.php on line 30



<?
if ($lid){
$result = mysql_query("SELECT * FROM blind_leagues WHERE league_id=$lid");
$theLeague = mysql_fetch_array($result);
}?>


<table width="98%" cellpadding=2 cellspacing=2 border=0 align="center">
<tr>
<td class="headBg" width="80%">&nbsp;<? echo $theLeague['league_name']; ?></td>
<td class="headBg" align="right" NOWRAP>&nbsp;<a href="http://<? echo $theLeague['league_url']; ?>" target="_blank"><? echo $theLeague['league_url']; ?></a></td>
</tr>
<tr>
<td class="contBg" colspan=2>

<!--- get the teams --->
<?
$teams = mysql_query("SELECT * FROM blind_teams WHERE league_id = $lid ORDER BY team_name");
$theteam = mysql_fetch_array($teams);
$totteams = mysql_num_rows($teams);
$thisteam = 0;

while ($thisteam < $totteams){
?>
<br>
<table width="98%" cellpadding=2 cellspacing=2 border=0 align="center">
<tr>
<td class="headBg" colspan=2>&nbsp;<? echo $theteam['team_name']; ?></td>
</tr>
<tr>
<td class="headBg" width="20%">&nbsp;Date</td>
<td class="headBg" width="80%">&nbsp;Match Info</td>
</tr>
<?
$teamID = $theteam['team_id'];

$events = mysql_query("SELECT * FROM blind_events WHERE league_id = $lid and team_id=$teamID ORDER BY event_date DESC");
$theevent = mysql_fetch_array($events);
$totevents = mysql_num_rows($events);
$thisevent = 0;

while ($thisevent < $totevents){

?>


<?
$hora = substr($theevent['event_date'], 11,2);
$minuto = substr($theevent['event_date'], 14,2);
$segundo = substr($theevent['event_date'], 17,2);
$mes = substr($theevent['event_date'], 5,2);
$dia = substr($theevent['event_date'], 8,2);
$ano = substr($theevent['event_date'], 0,4);

//$eldia = $ano."|".$mes."|".$dia."|".$hora."|".$minuto."|".$segundo;

$teatime = mktime($hora, $minuto, $segundo, $mes, $dia, $ano);
$realDate = date("D M-d-y", $teatime);
$realTime = date("g:i a", $teatime);
?>


<tr>
<td class="contBg">&nbsp;<? echo $realDate;?></td>
<td class="contBg">&nbsp;

<? if($theevent['blind_score'] > $theevent['team_score']){ ?>
<strong>Win over <? echo $theevent['opponent'] ?> ( <?echo $theevent['blind_score'] ?> / <?echo $theevent['team_score'] ?> )</strong>
<? } ?>

<? if($theevent['blind_score'] < $theevent['team_score']){ ?>
Loss to <? echo $theevent['opponent'] ?> ( <?echo $theevent['team_score'] ?> / <?echo $theevent['blind_score'] ?> )
<? } ?>

<? if($theevent['blind_score'] == $theevent['team_score']){ ?>
<strong>Match versus <? echo $theevent['opponent'] ?></strong>
<? } ?>
</td>
</tr>


<?
$thisevent++;
$theevent = mysql_fetch_array($events);
}

?>
</table>
<br>
<?
$thisteam++;
$theteam = mysql_fetch_array($teams);
} ?>


</td>
</tr>
</table>