Originally posted by laserlight
Nope, you must then assign $_GET['artikel'] to $gwert, but frankly I try to minimise the number of variables used.
The php code is pretty big, $gwert is being assigned earlier. Just now the MySQL part is starting. Sorry, it's just some value in $gwert which was processed earlier by an URL.
I filled in data into the table now:
$sql = "INSERT INTO kommentare SET artikel='$ANr'";
And changed your code to:
$sql = "SELECT * FROM kommentare WHERE artikel='$gwert'";
$query=mysql_query($sql) or die(mysql_error().'<br />'.$sql); //run the query
if ( mysql_num_rows($query) == 0) {
echo 'no data';
//insert into kommentare table
} else {
echo 'data available';
//do nothing, the result has been selected
}
So in fact "data available" should be displayed, but it displays "no data"