Answer the question
In order to leave comments, you need to log in
Warning: mysql_fetch_array(): why?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\OpenServer\domains\php\show_users.php on
line mysql something is wrong. tell? here is the code
<?php
require_once 'scripts/app_config.php';
require_once 'scripts/database_connection.php';
//Создание инструкции select
$select_users = "SELECT user_id, first_name, last_name, email" . "FROM users";
//Запусук запроса
$result = mysql_query($select_users);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Получение пльзователей</title>
<link rel="stylesheet" href="css/phpMM.css">
<script type="javascript">
function delete_user(user_id) {
if (confirm("Вы уверены в своем выборе?" + "\nВернуть его уже не получиться")) {
window.location = "delete_user.php?user_id=" + user_id;
}
}
</script>
</head>
<body>
<div class="header"><h1>ПРОШАРИВАНИЕ 10</h1></div>
<div class="example">Пользователи</div>
<div class="content">
<ul>
<?php
while ($user = mysql_fetch_array($result)) {
$user_row = sprintf(
"<li><a href='show_user.php?user_id=%d'> %s %s </a> " . "(<a href='mailto: %s'>%s</a>)" .
"<a href='javascript:delete_user(%d);'><img class='delete_user' src='phpMM/images/delete.png'" . "width='15' /></a></li>" ,
$user['user_id'], $user['first_name'], $user['last_name'], $user['email'], $user['user_id']);
echo $user_row;
}
?>
</ul>
</div>
<div id="footer"></div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
in general, the solution lay in
and also confused with the number
%s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question