troubleshooting Question

Making sense of MySQL table

Avatar of eezar21
eezar21 asked on
7 Comments1 Solution360 ViewsLast Modified:

I have a database that I have set up which is being fed data from a pixel I have on my site, to tell me where my users are coming from, the time they are on the site, the page they are on etc.

I've now in the past couple of days massed up a load of data, which I can display using the PHP code below.  This is clearly starting to become quite unwieldy.  What I would ideally like to be able to do is to be able to create an interface that I can select variables to just show a summary of the number of finds and then the data presented in a table (as I have done below)

I have database columns of id, time, url, user agent and ip address.  I'm stuck on how to use what is input into the POST field I have and using that to sort and display the rows that this is related to.  When it comes to the URL I would need to segment the URLs e.g. be able to enter the page i.e. news and then look for where the URL string CONTAINS that word.

Sorry if this is way over complicated (it seems so to me) but I would really appreciate any pointers (or assistance).  Thanks in advance



<title>Your Page Title</title></head> 

<form method = "post" action = "<?php echo $_SERVER['PHP_SELF'];?>">
<table width = "450" align = "center">
		<td><b><i>Please select <strong class="highlight">site</strong> in the field below </i></b></td>
		<input type = "text" name = "refer">
		<td align = "center">
			<input type = "submit" name = "find" value = "SEARCH">
			<input type = "reset" value = "CLEAR FORM">


@mysql_select_db($database) or die( "Unable to select database");

$site = trim($_POST['refer']);

$result = mysql_query( "SELECT * FROM data" ) 
or die("SELECT Error: ".mysql_error()); 
$num_rows = mysql_num_rows($result); 
print "There are $num_rows records.<P>"; 
print "<table width=400 border=1>\n"; 
while ($get_info = mysql_fetch_row($result)){ 
print "<tr>\n"; 
foreach ($get_info as $field) 
print "\t<td><font face=arial size=1/>$field</font></td>\n"; 
print "</tr>\n"; 
print "</table>\n"; 


Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros