Jump to content

Recommended Posts

I'm following a members page tutorial. I have everything copied just like he does but I keep getting this error.

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/13/6987913/html/tutorials/user_profiles/core/inc/user.inc.php on line 8

 

Code

 

<?php
// fetches all of the users from the table
function fetch_users(){
$result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`');	

$users = array();

while (($row = mysql_fetch_assoc($result)) !== false){
	$users[] = $row;

}

return $users;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/242142-what-does-this-error-mean/
Share on other sites

It means your mysql result set is not valid, which leads to that your mysql query fails. Try adding mysql_error in your query and see what error it is giving.

 

$result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`') or die(mysql_error());

It means your mysql result set is not valid, which leads to that your mysql query fails. Try adding mysql_error in your query and see what error it is giving.

 

$result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`') or die(mysql_error());

 

Ok wow thanks I see the problem

 

Unknown column 'user_username' in 'field list'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.