Jag har laddat ner ett färdigt php-script, men jag får det inte till att fungera riktigt. :(
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/PROTECTED/public_html/PROTECTED/index.php on line 109
Felet ska tydligen ligga i
while ($rows = mysql_fetch_array($query)){
Från index.php
<?
$query = mysql_query("SELECT id,catname FROM db_cam_cat ORDER BY catname");
while ($rows = mysql_fetch_array($query)){
echo "<OPTION VALUE=\"$rows[id]\"";
if ($sort == $rows[id]){
echo " SELECTED";
}
$totalc = "SELECT id from db_cam WHERE cat = '$rows[id]' AND active = '1'";
$totalsc = mysql_query($totalc);
$total_rowsc = mysql_num_rows($totalsc);
echo ">$rows[catname] ($total_rowsc)\n";
}
?>
Tabellen ser ut såhär:
CREATE TABLE db_cam_cat (
id int(11) NOT NULL auto_increment,
description varchar(255) default NULL,
PRIMARY KEY (id)
);
INSERT INTO db_cam_cat VALUES (1, 'Girls with Webcams', 'Webcams from different girls around the world...');
INSERT INTO db_cam_cat VALUES (2, 'Boys with Webcams', 'Webcams from different boys around the world...');
INSERT INTO db_cam_cat VALUES (3, 'Other Live Webcams', 'Webcams from different places around the world...');
INSERT INTO db_cam_cat VALUES (4, 'Online City Cams', 'Webcams from different citys around the world...');
INSERT INTO db_cam_cat VALUES (5, 'Animals & Zoo', 'Live cams around the world of animals and from Zoo\'s around...');
INSERT INTO db_cam_cat VALUES (6, 'Live beach cams', 'Online cams at seashores and beaches around the world...');
INSERT INTO db_cam_cat VALUES (7, 'Live Sex Cams', 'Live sex and nude cams around the world...');
INSERT INTO db_cam_cat VALUES (8, 'Live Boat Cams', 'Cams that are mounted on boat\'s around the world...');
INSERT INTO db_cam_cat VALUES (9, 'Live Wired Cams', 'Strange and Wired Cams around the world...');
INSERT INTO db_cam_cat VALUES (10, 'Live Airport Cams', 'Live cams from airports around the world...');
Hoppas att någon kan hjälpa mig att hitta felet!? :q