PDA

View Full Version : log file info to specific user[]


bakraa
01-17-2006, 10:24 AM
Hi i am new to PHP,

I have a logfile with 18 columes which I transfer to MySql database in a table called "logfile".

I have one more table name "users" with columes `id` `pass` and info.

I have a registration system where the adminstrator creat users and there information are saved in the
"users" table.

Now what I am trying to do is to show the users when they login there information from the "logfile" table.

FOR EXAMPLE:
in the "logfile" table there is a colume named 'members' which have entries like A1,A1,A5,A7,A1,A5...
i want to assign all the entries having 'A1' in them to the user created by the admistrator, so that when he
login with the newly created username and password, he can see information from his log.

$query_log = "SELECT * FROM logfile where `members` LIKE '_A11_'";

i am able to show all the entry related to member A11 by using this, and have added the page link to a User 'user1' so when user1 login to his
account he sees all the data related to A11. But this is very static and not a good approch, if i have 200 users i have to assign 200 pages
with the information, and it is also not secure.


Please help me with this. and Guide me where i am going wrong... ???:confused:

degsy
01-17-2006, 01:53 PM
How do you associate the data between the user and the logfile table?

You need a unique association.

Usually you would do this with an auto ID as a primary key in the users table and a foreign key in the logfile table.

bakraa
01-17-2006, 04:48 PM
Thank you very much degsy for replying...

actually the logfile data is sort of pre-made, all the values in it are daily generated and then the logfile is placed in a folder from which by runing a PHP script it is inserted into the mysql.

Now there are 18 comma seperated colums in the logfile, so i have to define 18 colums in the mysql, if for instance i define 19 colums in the mysql the 19th being the ID as primery key then the script for updating the table throuth the text file gives error and do not update.

How ever there is a Unique field in the logfile which is like a serial number 1456787 every row have a diffrent one, but they are not auto incrementing but are there randomly. i have named that colume "serial".

where as in the "users" table i have the 'id' as being the primery key whihci is auto incremented with each user.

Now houw can i perform a unique association in this situation ?

bakraa
01-17-2006, 10:53 PM
still no help....

bakraa
01-18-2006, 07:33 AM
someone please consider my problem...

degsy
01-18-2006, 02:28 PM
You need to post the data in a readable format for the users here to understand the structure.

From what you've posted there is no unique assocaiation between the user ID and the log file entry.