Forum Moderators: coopster

Message Too Old, No Replies

cant get anything from mysql

         

UnikRasu

9:21 pm on Dec 7, 2002 (gmt 0)

10+ Year Member



hello why cant i get anything from mysql in this file

<html>
<head>
<title>Martins telefonbok</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
$db = "telebok";
$table = "telebok_table";

$conn = mysql_connect("localhost") or
die("gick inte att ansluta till databasen");
echo "ansluten till databasen";

mysql_select_db($db) or
die("kunde inte välja database");
echo "du har valt database";

echo "<h2>Telefonbok</h2>";
$query = "select * from $table";
$result = mysql_query($query) or
die(mysql_error());

while ($row = mysql_fetch_array($result));
{
echo " Namn:";
echo $row["namn"];
echo "<br>";
echo "Telenummer";
echo $row["telenr"];
echo "<br>";
echo "Mobilnummer";
echo "<br>";
echo $row["mobilnr"];
echo "Address";
echo "<br>";
echo $row["address"];
echo "Postnummer";
echo "<br>";
echo $row["postnr"];
echo "Postort";
echo "<br>";
echo $row["postort"];
echo "<br><br>";
}
?>
skriv in fler addresser <a href = "telebok.htm">här</a>

</body>
</html>

i get no error mesage but it will not write out anything from mysql but there is things in it

lorax

1:51 am on Dec 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



UnikRasu,

Try specifying the Resource identifier for the db connection like so:

mysql_select_db($db, $conn)