Superharas
New member
Hi,
I'm trying to display data taken from a MySQL DataBase in HTML. But, it doens't seem to be working.
This is the code:
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$con = mysql_connect("localhost","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM my_tb");
while($row = mysql_fetch_array($result))
{
echo $row['Type'] . " " . $row['Website'];
echo "<br />";
}
mysql_close($con);
?>
</html>
Now, I'd like to display this information in the Body tags, like this:
<a href="<?php echo $row['Website']; ?>"><? echo $row['Type']; ?></a>
However, this doesn't work... How can I make this work?
Thanks, in advance.
As I said, I would like the information to appear in a Hyperlink like:
<a href="<?php echo $row['Website']; ?>"><? echo $row['Type']; ?></a>
But, nothing shows up...
I'm trying to display data taken from a MySQL DataBase in HTML. But, it doens't seem to be working.
This is the code:
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$con = mysql_connect("localhost","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM my_tb");
while($row = mysql_fetch_array($result))
{
echo $row['Type'] . " " . $row['Website'];
echo "<br />";
}
mysql_close($con);
?>
</html>
Now, I'd like to display this information in the Body tags, like this:
<a href="<?php echo $row['Website']; ?>"><? echo $row['Type']; ?></a>
However, this doesn't work... How can I make this work?
Thanks, in advance.
As I said, I would like the information to appear in a Hyperlink like:
<a href="<?php echo $row['Website']; ?>"><? echo $row['Type']; ?></a>
But, nothing shows up...