I'm using PHP 4.3.1 and I am learning PHP. I have a MySQL server running, a database called 'nistarr' that has a table 'jokes' and that table has one entry 'joketext' that I am simply trying to display to a webpage: Here is my php:
<?php
$mydatabase = nistarr;
$link = mysql_connect("localhost", "root", "MYPASSWORD")
or die("Could not connect: " . mysql_error());
$db = mysql_select_db($mydatabase)
or die("Count not connect: " . mysql_error());
mysql_close($link);
?>
<P> Here are all the jokes in our database: </P>
<BLOCKQUOTE>
<?php
// Request the text of all the jokes
$result = mysql_query("SELECT joketext FROM jokes")
or die("Invalid query: " . mysql_error());
}
while ($row = mysql_fetch_array($result)) {
echo("$row["joketext"]");
}
?>
Also, there is no error on the webpage, its just the data in the SQL server for 'joketext' isnt displayed. What have I done wrong?
michael