Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
>hi
I have problem in my project in php
I want to display list from database
eg.
             teacher                      student
         marya - 12121             sami - 0909
         jon - 13131                 anosh - 0707
         carmen - 14141          zarina - 0606

then I want when user click on "jon - 13131"
open new file "teacher.php" and make "jon - 13131" as public
(because I want to see her profile, information ..etc)
if the user chick on "zarina - 0606"
open file"student.php" make "zarina - 0606" as public
(because also I want to see her profile, information ..etc)

how can I do that ?!?!

I use this code to display list
PHP
$db_name="****";
        $tbl_name="students";
        mysql_connect("localhost", "root", "");
        mysql_select_db("$db_name");
        session_start();
$ID=$_SESSION['tID'];
        $sql=mysql_query("SELECT * FROM $tbl_name WHERE user=$ID") or die(mysql_error());
        while($mysqlf =mysql_fetch_array($sql))
        {
            $student=$mysqlf['name'];
            echo "$student &nbsp&nbsp&nbsp";
            $id=$mysqlf['ID'];
            echo"$id<br>";
Posted
Comments
Joan M 25-May-11 10:15am    
Do you want to send the user choice as a parameter for the teacher.php file? Is that what you are searching for? Or do you need to make all the recordset assigned to any of the choices completely public in order to allow any of the files to be able to get access to it?
Or is it any other thing? Could you explain it a little bit more?
malemar 25-May-11 12:23pm    
yes,
I need to make all the recordset assigned to any of the choices completely public in order to allow any of the files to be able to get access to it

1 solution

You should take a look at those links...

The first one is a question [^] I posted in the PHP forum some days ago. Take a look at the answers from nickmaroulis[^]. The ones marked in red (5ed) are the ones in which he makes nice suggestions to solve the problem.

Apart of that you could get more information here[^].

Typically it is not a good idea to use globals (I do it only to store the language selected) and you should try to use functions or other methods to harvest data.

Hope this helps you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900