[PROBLEM SOLVED]
I have this in my eyes simple SELECT query which is supposed to gather some information from the database.
When I run the page it does however not print out anything? I ran the query in the dos-client and I received "Empty set" (but I now for a fact that there is info to be fetched).
Here is my code, including my db-structure. Hopefully you'll see something wrong in my SELECT query.
<?
$visa = "SELECT presentation.pid, presentation.Rubrik, presentation.texten, presentation.kid, presentation.sid, kategori.kid, kategori.kategori FROM presentation INNER JOIN kategori on kategori.kid = presentation.kid WHERE presentation.sid=1 ORDER BY kategori.kategori ASC";
$result = mysql_query($visa,$db_link);
$rows = mysql_num_rows($result);
for($index = 0; $index< $rows; $index++) {
$pid = mysql_result($result,$index,"pid");
$rubrik = mysql_result($result,$index,"Rubrik");
$texten = mysql_result($result,$index,"texten");
$kid = mysql_result($result,$index,"kid");
$sid = mysql_result($result,$index,"sid");
$kategori = mysql_result($result,$index,"kategori");
echo "<img src=\"layout/a-top.gif\"> <a href=\"main.php?id=$pid\">hej: $kategori</a> ";
}
?>
mysql> describe presentation;
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| pid | int(11) | | PRI | NULL | auto_increment |
| Rubrik | varchar(70) | YES | | NULL | |
| texten | longblob | YES | | NULL | |
| kid | int(11) | YES | | NULL | |
| sid | int(11) | YES | | NULL | |
+--------+-------------+------+-----+---------+----------------+
mysql> describe kategori;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| kid | int(11) | | PRI | NULL | auto_increment |
| kategori | varchar(30) | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+