Jump to content

echo Hyperlink search results


gavenf

Recommended Posts

Hi peoples,

 

I need help desperatly.

 

My problem is that I would like the following code to link through to a page that will display the full results for the person that is selected on from this page. I have made the hyperlink the "first name" in this code.  I have tried a hundred different ways to get it to work but I dont know what I am doign wrong.  At the moment all that happens is it takes me to a blank page.  How do I make the full record appear in a table on a new page.  The full record for each person contains the following colums in the mysql table:

name

lastname

dob

address

suburb

state

postcode

country

phone

fax

email

 

Any help would be greatly appreciated.

 

This page is called srch.php3

<html> 

<style type="text/css"> 
<!-- 
a:link { 
   color: #0000FF; 
   text-decoration: none; 
} 
a:visited { 
   text-decoration: none; 
   color: #FF0000; 
} 
a:hover { 
   text-decoration: none; 
   color: #FF0000; 
} 
a:active { 
   text-decoration: none; 
   color: #FF0000; 
} 
--> 
</style> 

<body> 
<? 
if ($search) // perform search only if a string was entered. 
{ 
mysql_connect('localhost','xxxxxx','xxxxxx') or die ("Problem connecting to DataBase"); 
$srch="%".$search."%"; 
$query = "select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'"; 

$result = mysql_db_query("xxxxxx", $query); 

if ($result) 
{ 
echo "Here are the results:<br><br>"; 
echo "<table width=90% align=center border=1><tr> 
<td align=center bgcolor=#00FFFF>Visit time and date</td> 
<td align=center bgcolor=#00FFFF>User Name</td> 
<td align=center bgcolor=#00FFFF>Last Name</td> 
<td align=center bgcolor=#00FFFF>Email</td> 
</tr>"; 

while ($r = mysql_fetch_array($result)) { // Begin while 
$ts = $r["TimeStamp"]; 
$name = $r["Name"]; 
$last = $r["Last"]; 
$email = $r["email"]; 
$comment = $r["comment"]; 
echo "<tr> 
<td>$ts</td> 
<td><a href= $name>$name</td> 
<td>$last</td> 
<td><a href= mailto:$email>$email</td></tr> 
<tr> <td colspan=4 bgcolor=\"#ffffa0\">$comment</td> 
</tr>"; 
} // end while 
echo "</table>"; 
} else { echo "problems...."; } 
} else { 
echo "Search string is empty. <br> Go back and type a string to search"; 
} 
include ('links.x'); 
?> 
</body> 
</html> 

Link to comment
https://forums.phpfreaks.com/topic/80390-echo-hyperlink-search-results/
Share on other sites

also mate, you might want to load your results into an array, that will make it easier as you dont need to call each result seperatly,

 

cheers

I hate to sound like a tool (but I will anyway) but I dont know how to do what you are saying.  I have learnt all this on my own and it has taken me ages so far.

 

Can you offer an example to what you are saying please?

 

Also by doing this will it make the full results appear on a new page?

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.