<html><head><title>Hajj</title></head><?php
$con= mysqli_connect('localhost','root','')ordie('Error connecting to MySQL server.');
$q1="CREATE DATABASE hajj";if(mysqli_query($con,$q1)){ echo "Database created successfully"."<br>";}if($con= mysqli_connect('localhost','root','','hajj')){ echo "Database is already created and it is selected"."<br>";}else{ echo "Error creating or selecting database";}
$q2="CREATE TABLE users (username VARCHAR(8) NOT NULL,password INT(8) NOT NULL);";if(mysqli_query($con,$q2)){echo "Table created successfully"."<br>";}else{ echo "Error creating Table";}
$username=$_POST['username'];
$password=$_POST['password'];
$q3 ="INSERT INTO users VALUES ('$username','$password');";if(mysqli_query($con, $q3)){ echo "New record created successfully";}else{ echo "Error creating record! ";}?></html>
السؤال
p shahad
يطلع لي هذا الخطأ وش الحل
Fatal error: Uncaught mysqli_sql_exception: Can't create database 'hajj'; database exists in C:\xampp\htdocs\cs211\hello1.php:11 Stack trace: #0 C:\xampp\htdocs\cs211\hello1.php(11): mysqli_query(Object(mysqli), 'CREATE DATABASE...') #1 {main} thrown in C:\xampp\htdocs\cs211\hello1.php on line 11
هذا كود النموذج. ملف Fram1.html
وهذا ملف Hello1.php
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.