switching between tables in database

Hi, i’m a college student and i have to do a timetable viewer as my project.

You can check my website here to get a clearer view: http://blackbiri.host.dev4web.co/KYTTV/index.php

So, the idea is to change the table that belongs to the option everytime i choose an option.

Note: every teacher has their own table to store their timetable data

My problem is, how do you use this code :

             <form action="">
                <select class="timetable">
                   <option>Main Timetable</option>
                   <option>Teacher #1</option>
                   <option>Teacher #2</option>
                <input type="submit" />

to change the “x” in “WHERE teachers = x” to make it switch with other table everytime i choose other option


<?php // Setup document: include('config/setup.php'); // Make a MySQL Connection mysql_connect("localhost", "blackbir", "") or die(mysql_error()); mysql_select_db("blackbir_KYTTV") or die(mysql_error()); // Retrieve all the data from the "main_timetable" table $result = mysql_query("SELECT * FROM main_timetable WHERE teachers = x") or die(mysql_error()); // store the record of the "main_timetable" table into $row $row = mysql_fetch_array( $result ); ?>


or, if you have any other solution, you are very welcome to show me.

Thank you very much!!

and if possible, can you also help me to do a simple working login form (with a way to logout too). I’ve searched online, but everything i get is either a buggy login form, a login form with complicated means of logging out or a very complex code which is hard for me to understand.

Thanks again! :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service