Dit is mn database:
CREATE TABLE tutorials (
id int(5) DEFAULT '0' NOT NULL auto_increment,
FileName varchar(50) NOT NULL,
FileURL varchar(255) NOT NULL,
Count smallint(5) NOT NULL,
PRIMARY KEY (id)
);Dit is view.php
<?
include "connect.php";
$x ="SELECT * from tutorials order by FileName";
$result = mysql_query($x) or die
("Could not execute query : $x." . mysql_error());
echo "<p align=center><b>File Download</b></p>";
while ($row=mysql_fetch_array($result))
{
$id = $row["id"];
$FileName = $row["FileName"];
$FileURL = $row["FileURL"];
$Count =$row["Count"];
echo "<a href=download.php?id=$id target=blank>$FileName</a></br>";
}
echo "visited: $Count";
?>
en dit is download.php
<?php
include "connect.php";
$x ="SELECT * from tutorials where id='$id'";
$result = mysql_query($x) or die
("Could not execute query : $x." . mysql_error());
while ($row = mysql_fetch_array($result))
{
$id = $row["id"];
$FileName = $row["FileName"];
$FileURL = $row["FileURL"];
$Count = $row["Count"];
header('Location: '.$FileURL);
$x ="update tutorials set Count=Count+1 where id='$id'";
$result = mysql_query($x) or die
("Could not execute query : $x." . mysql_error());
}
?>
nou is het probleem dat de link niet verwijst naar de in de database genoemte link ...
http://test.scratch-design.nl/view.php is de link
alvast bedankt