Jump to content

Getting data out of mysql database


eivfur

Recommended Posts

<?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?

Link to comment
https://forums.phpfreaks.com/topic/824-getting-data-out-of-mysql-database/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.