Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
if (isset($_GET['uid']) && !empty($_GET['uid'])) {
$id = $_GET['uid'];
$sql = "SELECT * FROM `apps` WHERE `id` = ". mysql_real_escape_string($id) ." LIMIT 1";
if ($result = mysql_query($sql)) {
if (mysql_num_rows($result) == 1) {
while($row = mysql_fetch_assoc($result)){
$username = $row["MCName"];
echo'
//Here is a ton of rows and some html.
';
}
$sql = "SELECT * FROM `apps` WHERE `MCName` = ". $username;
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
}else {
die('Record not found.');
}
}
}
Ive tried everything, it keeps failing. I'm not really master of SQL nor PHP. I want to count how many rows there is with the "MCName" I'm not sure if I could do it in the first SQL query. Also, the error appears on line 44, aka the line which does mysql_num_rows. The DB is connected earlier on the script.
Sorry if this is a really dumb question, believe me. I searched for a hour or so for a fix ^^