Jump to content

Recommended Posts

I have a query that gets only distinct values from one column in a mysql table. I have my php script set to print out the actual sql that is being sent by the script for debugging. When I copy and paste the output:

SELECT DISTINCT addby FROM T_USERS

into the phpmyadmin sql sender, it returns exactly what I need. However in the php script I get an error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

the line it references is:

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){

and yes, $result is the correct variable for the mysql_query statement in my script.

could it be that fetch_array is the incorrect method for a single column result set?

Your help is greatly appreciated!

Curt

Probably you are not doing it correctly.
Remember, $result mustn't be the query itself, but the [b]result resource[/b].

Read:

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95441\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=95441[/a]
[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95443\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=95443[/a]
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.