PDA

View Full Version : Rate script help



gyrbo
June 25th, 2001, 14:57
I'm writing a small rate script. Here is what I got allready.


<html><head><title>Rate 32</title></head>
<body>
<?php
// including config
require("config.inc.php");

// connecting to db
$db_con = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_select,$db_con);

// checking vars
if(!cat){$cat=0;}

// displaying the main categorie name
if($cat!=0)
{
$querry = mysql_query("SELECT * FROM rate32_cat WHERE id = $cat",$db_con);
$row = mysql_fetch_array($querry);
echo "[-] $row[name]";
}

// loading categories
$querry = mysql_query("SELECT * FROM rate32_cat WHERE cat=$cat",$db_con);
while($row = mysql_fetch_array($querry)) // line 24
{
echo "[+] <a href=\"./?cat=$row[id]\">$row[name]</a>";
}

// loading items
$querry = mysql_query("SELECT * FROM rate32_item WHERE cat = $cat",$db_con);
while($row = mysql_fetch_array($querry)) // line 31
{
/*** here comes how the items will be displayed ***/
echo "$row[name]<br>";
echo "<font size=-1>$row[param]</font><br>";
echo "<a href=\"$row[param2]\">$row[param2]</a><br>";
}
?>
</body>
</html>
Here's the MySQL db:


rate32_cat:
id cat name
1 0 Perl
2 0 PHP

rate32_id:
id cat name param param2 count rate
101 1 Perl Script Just some stupid Perl script http://www.perl.com/script 0 0
102 2 PHP script A PHP script http://php.net/info.php 0 0

Here are the errors:
Warning: Supplied argument is not a valid MySQL result resource in d:/www/docs/rate32/index.php on line 24

Warning: Supplied argument is not a valid MySQL result resource in d:/www/docs/rate32/index.php on line 31

gyrbo
June 25th, 2001, 15:04
Whoops, nevermind, I got it fixed (sort of)