sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

php-mysql help. Create a dynamic url based on table value.

Mon Mar 18, 2013 10:34 am

Hello,

I have a database named 'counter' and a table named 'info'. which stores the information of client ip address (ip_address), client brower details (user_agent) and date and time visited my website (datetime).
I have a php webpage which displays above information in a table format http://raspisimon.no-ip.org/view.php
code is below,

Code: Select all

<?php

// ########################
// ### Display visitors ###
// ########################

echo '<h3> Visitors </h3>' ;

$result = mysql_query("SELECT * FROM $dbtableinfo ORDER BY id DESC") 
or die(mysql_error());  

echo "<table width='100%' border='0'>";
echo '<tr> <td width="200" bgcolor="#1AC414">  IP </td> <td height="2" bgcolor="#1AC414" width="400">User agent</td> <td height="2" bgcolor="#1AC414" width="169"> Date & Time</td></tr>';

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) 
{
	// Print out the contents of each row into a table
	echo '<tr><td bgcolor="#75D169">'; 
echo $row['ip_address'];
	echo '</td><td bgcolor="#75D169">'; 
	echo $row['user_agent'];
	echo '</td><td bgcolor="#75D169">'; 
	echo $row['datetime'];
	echo "</td></tr>"; 		
} 
	echo "<tr><td bgcolor=\"#1AC414\"> <strong> Total unique IP´s </strong> </td><td bgcolor=\"#1AC414\"> <strong> $totalips </strong> </td></tr>" ;
	echo "</table><br /> ";

	?>
First coulmn in the web page is the ip address of the client. Now I would like to make that as a hyperlink with this url http://iplocation.truevue.org/<ip_address>.html

Can someone assist?
Last edited by sim_tcr on Thu Mar 21, 2013 7:55 am, edited 2 times in total.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: php-mysql help. Create a dynamic url based on table valu

Wed Mar 20, 2013 3:18 am

can anyone please help?
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: php-mysql help. Create a dynamic url based on table valu

Thu Mar 21, 2013 8:24 am

Its resolved. Below is the code.

Code: Select all

echo '<a href="http://iplocation.truevue.org/' . $row['ip_address'] . '.html">' . $row['ip_address'] . '</a>';
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

Return to “General discussion”