PHP Display From Database Script?

Micro Sniff

New member
I have the following code below. I keep getting the same error as follows:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/35/6821535/html/elktownshipsoccer/photos.php on line 85

I tried but I couldn't see anything. Can anyone tke a look at the code below and tell me whats wrong? I also have the right database information filled out, it's just blank so no one seess it.

<?php

$host="randomdata34.db.6821535.hostedresource.com";
$username="randomdata34";
$password="Patrick1";
$db_name="randomdata34";
$tbl_name="ets_photos";

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$year=$_GET["year"];
$season=$_GET["season"];
$gender=$_GET["gender"];
$team=$_GET["team"];

$sql="SELECT * FROM $tbl_name WHERE year='$year' season='$season' gender='$gender' team='$team'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){
?>
<table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td width="10%"><? echo $rows['id']; ?></td>
<td width="30%"><? echo $rows['year']; ?></td>
<td width="30%"><? echo $rows['season']; ?></td>
<td width="30%"><? echo $rows['gender']; ?></td>
<td width="30%"><? echo $rows['team']; ?></td>
<td width="30%"><? echo $rows['link']; ?></td>
</tr>
</table>
<?
}

mysql_close();
?>
 
Back
Top