السلام عليكم
كيف احصل على قيمة عنصر معين من الداتابيز
مثلا في حالتي اريد الحصول على قيمة admin_adminlte_theme_skin و account_activate_email
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
$tablename = "myTable";
$conn = new mysqli($servername, $username, $password, $dbname);
$conn->connect_error and die("Connection failed: " . $conn->connect_error);
$sql = "SELECT name,value FROM $tablename
WHERE name='account_activate_email'
OR name='admin_adminlte_theme_skin'
LIMIT 2";
$result = $conn->query($sql);
$output = [];
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$output[$row['name']] = $row['value'];
}
}
$conn->close();
echo 'account_activate_email = ' . $output['account_activate_email'] . '<br>';
echo 'admin_adminlte_theme_skin = ' . $output['admin_adminlte_theme_skin'] . '<br>';
?>
التعليقات