يطلع لي هذا الخطأ وش الحل
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
<html>
<head>
<title> HAJJ </title>
</head>
<body BGCOLOR ="#81d4fa" >
<form action="hello1.php" method="post"> username:<br>
<input type="text"name="username">
<br> <br>
password:<br>
<input type="password" id="password" name="password"><br><br>
<input type="submit">
</body>
</html>
وهذا ملف Hello1.php
<html>
<head>
<title>Hajj</title>
</head>
<?php
$con= mysqli_connect('localhost','root','')
or die('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>