Jump to content


Photo

Getting data out of mysql database


  • Please log in to reply
1 reply to this topic

#1 eivfur

eivfur
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 August 2003 - 03:49 PM

<?php
//Printer ut table taggen
print(\'<table width=\"500\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#000000\">\');
//Sender setningen mot database som skal hente ut infoen
$setning = @mysql_query(\"SELECT * FROM navn\");
//Bruker en loop for aa faa all informasjonen ut
while($adresser = @mysql_fetch_array($setning))
{
//Naa er informasjonen lagret i arrays
print(\"<tr>\");
print(\"<td width=\"500\" background=\"meny.gif\" colspan=\"2\">$adresser[overskrift]</td>\");
print(\"<tr>\");

// here is the start of the link

print(\"<td bgcolor=\"#EAEAEA\" width=\"250\">Lagt til av: <a href=\"mailto:\" . $adresser[\"mail\"] . \"\">\" . $adresser[navn] . \"</a></td>\");

// here is the end of the link

print(\"<td bgcolor=\"#EAEAEA\" width=\"250\"></td>\");
print(\"</tr>n\");
print(\"<tr>\");
print(\"<td bgcolor=\"#FFFFFF\" colspan=\"2\" width=\"500\">$adresser[artikkel]</td>\");
print(\"</tr>n\");
}
//Slutter av tabellen
print(\'</table>\');
print(\'<br>\');
print(\'<br>\');
?>

This is the code for acessing the database and print the information out. But i want to show the mail adress that i sin the database, But with this code i cant see the link, anybody that can help me with how to get the link to work correctly?

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 03 August 2003 - 09:51 AM

Try it with quotes around \"navn\"

[php:1:5a0db61e95]<?php
print(\"<td bgcolor=\"#EAEAEA\" width=\"250\">Lagt til av: <a href=\"mailto:\" . $adresser[\"mail\"] . \"\">\" . $adresser[\"navn\"] . \"</a></td>\");



?>[/php:1:5a0db61e95]

hth
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users