Jump to content

Why is this query giving me a value of resource 10?


ghurty

Recommended Posts

I am trying to have a sql command pull up the "name" value for a "group" number of the same record. I have a table has both fields.

 

$queryid = "SELECT 'name'  FROM `users` WHERE `group` = " . $GROUP;
$resultid = mysql_query($queryid)
    or die("Web site query failed");

if ($debug) :
fputs($stdlog, "Name has been set to=". $resultid. "\n" ); 
endif ;

 

For some reason the debug is showing that it has been set to "resource #10".

 

What should I change?

 

Thank You

Link to comment
Share on other sites

$queryid = "SELECT 'name'  FROM `users` WHERE `group` = " . $GROUP;
$resultid = mysql_query($queryid) or die("Web site query failed");
$row = mysql_fetch_assoc($resultid);
if ($debug) :
fputs($stdlog, "Name has been set to={$rwo['name']}\n" ); 
}

Link to comment
Share on other sites

When I have the code like:

$queryid = "SELECT `name` FROM `users` WHERE `group` = " . $GROUP;
$resultid = mysql_query($queryid) or die("Web site query failed");
$row = mysql_fetch_assoc($resultid);
if ($debug) :
fputs($stdlog, "Name has been set to={$row[`name`]}\n" ); 
}

It locks up and doesnt process it. It appears the problem is this line:

fputs($stdlog, "Name has been set to={$row[`name`]}\n" ); 

Because when I remove it, it does complete the script.

 

When I have:

fputs($stdlog, "Name has been set to= $row\n" ); 

 

It displays:

Name has been set to=Array

 

 

Thank You

Link to comment
Share on other sites

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.