Amal ALkhaldy
asked on
How to do project with database with php and mysql?
ASKER
How do I connect to a a mysql database using php?
How do I list all records in a table or query using mysql an dphp?
How do I show just one record using mysql and php?
How do I list all records in a table or query using mysql an dphp?
How do I show just one record using mysql and php?
You can use PDO or MySQLi
http://php.net/manual/en/pdo.connections.php
Assume you have a table called FOO with two fields, ID and Name
You html will looks like thing like
Try and get that far and see how it goes. If you have any issues, post back here.
http://php.net/manual/en/pdo.connections.php
Assume you have a table called FOO with two fields, ID and Name
// Assume database is located on localhost and the name of the database is called test
$user = "myUserName";
$pass = "myPassword";
try {
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
foreach($dbh->query('SELECT ID, Name from FOO') as $row) {
$id = $row['ID'];
$name = $row['Name'];
echo "<a href='detail.php?id=$id'>Click to go to detail for $name</a><br>";
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
You html will looks like thing like
<a href="detail.php?id=1">Click to go to detail for thing1</a><br>
<a href="detail.php?id=2">Click to go to detail for thing2</a><br>
<a href="detail.php?id=3">Click to go to detail for thing3</a><br>
Try and get that far and see how it goes. If you have any issues, post back here.
ASKER
If there is something similar to the online student and teacher and register if you know send me
I don't know of any outside of searching, "online course registration system project in php" which includes
https://github.com/gauravgaikwad777/Course-Registration-System-PHP-MySQL
https://github.com/iamtusharbhatia/Online-Course-Registration-System
You may want to look at those systems and get an idea of how to make your own.
https://github.com/gauravgaikwad777/Course-Registration-System-PHP-MySQL
https://github.com/iamtusharbhatia/Online-Course-Registration-System
You may want to look at those systems and get an idea of how to make your own.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window
Teacher
ID – primary key
name
password
Student
ID- primary key
Name
Email
Password
Age
Department
File
Phone number
Request
ID- primary key
Name
Email
Password
Age
Department
File
Phone number
Comment
Status
With questions like this, the best thing to do is break things into parts such as:
How do I create new tables in a database and assign a primary key?
How do I join tables?
How do I connect to a a mysql database using php?
How do I list all records in a table or query using mysql an dphp?
How do I show just one record using mysql and php?
How do I create a link in html?
How do I create a link in html generated from my database that links to a page to show just one record?
Just take one step at a time. But first, I think you need to give us more details of what you want and narrow the scope of this question even if it is, "Where do I begin?" or one of the questions above. Once you have one question answered move to the next. Splitting up like that will make it easier on you and the Experts.