sim_tcr Posted March 21, 2013 Share Posted March 21, 2013 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 code is below, <?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? Link to comment https://forums.phpfreaks.com/topic/275965-php-mysql-help-need-to-create-a-dynamic-url-based-on-the-table-value/ Share on other sites More sharing options...
haku Posted March 21, 2013 Share Posted March 21, 2013 echo '<a href="http://iplocation.truevue.org/' . $row['ip_address'] . '">' . $row['ip_address'] . '</a>'; Link to comment https://forums.phpfreaks.com/topic/275965-php-mysql-help-need-to-create-a-dynamic-url-based-on-the-table-value/#findComment-1420067 Share on other sites More sharing options...
sim_tcr Posted March 21, 2013 Author Share Posted March 21, 2013 echo '<a href="http://iplocation.truevue.org/' . $row['ip_address'] . '">' . $row['ip_address'] . '</a>'; Thank you. That did it. Link to comment https://forums.phpfreaks.com/topic/275965-php-mysql-help-need-to-create-a-dynamic-url-based-on-the-table-value/#findComment-1420068 Share on other sites More sharing options...
sim_tcr Posted March 21, 2013 Author Share Posted March 21, 2013 small issue. Now the url becomes, http://iplocation.truevue.org/142.4.97.173 .html is missing. I want url to be http://iplocation.truevue.org/142.4.97.173.html Link to comment https://forums.phpfreaks.com/topic/275965-php-mysql-help-need-to-create-a-dynamic-url-based-on-the-table-value/#findComment-1420140 Share on other sites More sharing options...
sim_tcr Posted March 21, 2013 Author Share Posted March 21, 2013 Fixed it myself. echo '<a href="http://iplocation.truevue.org/' . $row['ip_address'] . '.html">' . $row['ip_address'] . '</a>'; Link to comment https://forums.phpfreaks.com/topic/275965-php-mysql-help-need-to-create-a-dynamic-url-based-on-the-table-value/#findComment-1420141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.