Jump to content

Recommended Posts

Hi. I am not sure if this falls under MySQL or PHP help so i have posted this in both!

I have created a script that looks up a table on my phpMySQL database and displays the whole table. I am Trying to create an online tracker and need to add in code to filter the information to only display the data from the table that is relevent to whome ever is logged in. the script for what i have done so far is:

 

<?php

$database="db231930750";

mysql_connect ("**************", "***********", "**********");

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

$result = mysql_query( "SELECT Userid, ClientName, DateOfAction, Action, Status FROM OnlineTracker" )

or die("SELECT Error: ".mysql_error());

$num_rows = mysql_num_rows($result);

print "There are $num_rows records.<P>";

print "<table width=900 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";

?>

 

 

 

When someone logs in it sets the session :  if ( isset($_SESSION['User']) )

 

the relevent field to filter in the table is "UserId" i.e. only show fields that the "UserId" equals the session User.

 

1st would i do this in mysql database or write script in php and add to the script above. if so what would the script be.

 

thanks!!!

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.