I have prefixed the custom and deafaults tables of wordpress.
Also I have put data in tables but I'm getting result 0.
Connection to database is ok and working
$sql = "SELECT u_name, u_email FROM jobify_user";
$result = $conn->query($sql);
if ($result->num_rows> 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
return "id: " . $row["u_name"]. "name:".$row["u_email"]. " <br>";
}
}
else {
return "0 results";
}
$conn->close();
Considering so the prefix is "jobify" and you're using wordpress tables, and according to https://codex.wordpress.org/Database_Description#Table:_wp_users , the table_name must be jobify_users, and columns must be user_name and user_email.
So, your query must surely be :
$sql = "SELECT user_name, user_email FROM jobify_users";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.