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

$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" ); 
}

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.