Good day to all members!
Anybody could help me or could give me a php code.
What I need is I want to put link on each data that I had retrieved through array from mySQL database so that when I'm going to click each of them it will display their additional information. I had tried, but I got always the data in the last row of the table. To be more vivid here is my code:

Table information.
roland-table name
1. name
2. fname
3. email
4. address
5. age
6. b-day
7. tel
8. mobile

$query = "SELECT * FROM roland";
$result = mysql_query($query, $link);

while ($rs = mysql_fetch_array($result)){
//I want to print only these two fields (name, fname)
$name = $rs;
$fname = $rs;
print("Name: $name $fname");

Name: Haydee Roy
Name: Rolando Casinillo
Name: Ricky Santos

Now, the output I want to be like these:

Name: Haydee Roy
Name: Rolando Casinillo
Name: Ricky Santos

So that when I'm going to click each of them I will get or display their additional informations.

Any codes relevant to above mentioned you can give are big help for me and I will highly appriated.

More power to this site!

Thank very much in advance....


12 Years
Discussion Span
Last Post by DGStudios

Try this code
//note echo is the same thing as print... its preference on that.
echo ' Name: <a href = "URL">'. $name .' '. $fname. '</a>';

Also note that a single quote will never interfere with the double quote in php, and vice versa. USE THIS TO YOU'RE ADVANTAGE. In doing this it links up. Also remember it only outputs what the ECHO commands tell it to, and no matter how much code is inbetween them you can link up commands.

echo ' <img src = "';

//Code here

echo 'URL">';

This works fine and still links the image perfectly fine. String manipulation is one of the BEST things about PHP as far as ease of playing with the HTML code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.