PHP gevorderde |
|
Hoi,
Ik heb het volgende script:
<?PHP
require("config.php");
$links = mysql_result(mysql_query("SELECT COUNT(id) FROM links WHERE naam='$title'"),0);
if($links == 0)
{
mysql_query("INSERT INTO links (date, naam, hits) VALUES ('".date("dmy")."', '$title', '1')") or die (mysql_error());
$aantal = mysql_result(mysql_query("SELECT * FROM Reis WHERE title='$title'"),0);
if($aantal == 0)
{
$res2 = mysql_query("SELECT * FROM Winter_Reis WHERE title='$title'") or die("res2:". mysql_error());
while ($obj=mysql_fetch_object($res2)) {
$link = $obj->link;
}
header("Refresh: 0; URL= ".$link."");
exit;
}
else
{
$res2 = mysql_query("SELECT * FROM Reis WHERE title='$title'") or die("res2:". mysql_error());
while ($obj=mysql_fetch_object($res2)) {
$link = $obj->link;
}
header("Refresh: 0; URL= ".$link."");
exit;
}
}
else
{
$res1 = mysql_query("SELECT * FROM links WHERE naam='$title'") or die("res2:". mysql_error());
while ($obj=mysql_fetch_object($res1)) {
$hits = $obj->hits;
}
$new_hits = $hits + 1;
mysql_query("UPDATE links SET date='".date("dmy")."', hits='$new_hits' WHERE naam='$title'") or die (mysql_error());
$aantal = mysql_result(mysql_query("SELECT * FROM Reis WHERE title='$title'"),0);
if($aantal == 0)
{
$res2 = mysql_query("SELECT * FROM Winter_Reis WHERE title='$title'") or die("res2:". mysql_error());
while ($obj=mysql_fetch_object($res2)) {
$link = $obj->link;
}
header("Refresh: 0; URL= ".$link."");
exit;
}
else
{
$res2 = mysql_query("SELECT * FROM Reis WHERE title='$title'") or die("res2:". mysql_error());
while ($obj=mysql_fetch_object($res2)) {
$link = $obj->link;
}
header("Refresh: 0; URL= ".$link."");
exit;
}
}
?>
<?PHP require("config.php"); if($links == 0) { if($aantal == 0) { $link = $obj->link; } header("Refresh: 0; URL= ".$link.""); } else { $link = $obj->link; } header("Refresh: 0; URL= ".$link.""); } } else { $hits = $obj->hits; } $new_hits = $hits + 1; if($aantal == 0) { $link = $obj->link; } header("Refresh: 0; URL= ".$link.""); } else { $link = $obj->link; } header("Refresh: 0; URL= ".$link.""); } } ?>
Helaas krijg ik de volgende fout:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 8 in /var/www/html/link_teller.php on line 9
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/link_teller.php:9) in /var/www/html/link_teller.php on line 16
Weet iemand wat dit is, en hoe dit op te lossen is?
Groetjes,
Roy
|