ممكن ترفق الكود الخاص بك هنا لنساعدك أو ممكن مشاهدة الكود المرفق لكيفية ربط PHP بقاعدة البيانات
<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
exit();
}
?>
وهذا مثال على عملية جلب البيانات
<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
exit();
}
$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result = $mysqli -> query($sql);
$row = $result -> fetch_assoc();
printf ("%s (%s)\n", $row["Lastname"], $row["Age"]);
$result->free_result();
$mysqli->close();
?>