<?php require("databaselogin.php"); // Log on to the database. $guideinnhold = mysql_query("SELECT `*` FROM `guide`"); // Get all the info needed from the database guide and store it in guideinnhold $guidenr = mysql_num_rows($guideinnhold); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if($guidenr > 0){ echo "<select>"; } while ($row_guideinnhold = mysql_fetch_assoc($guideinnhold)) { echo"<option value=\""; echo $row_guideinnhold['gnr']; echo "\">"; echo $row_guideinnhold['navn']; // This block of code prints the select box with all the guide names and id's echo "</option>"; echo "\n"; } if($guidenr > 0){ echo "</select>"; } echo $guidenr; // Print the contents of the variable guidenr to the screen to check it's contents. it's empty!?>