Having a DUH Moment with mysql_fetch_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok,

 

I'm a PHP newbie and I'm having a problem.  All I want to do is parse
some information out of a database and send someone and email stating
that their posting has been approved.  

 

I've verified that my SQL is indeed returning the correct value for
$key, but when I go to fetch the array for the row so that I can extract
the pertinent tidbits of information from that row, I get nada.  My
troubleshooting echo statements give me the following out put.  I've
included the actual snippet of code below.  

 

54
SELECT * FROM jobs WHERE pk_job = '54'
Resource id #4
Array

0

 

 

//use the date to find the record we're looking for approved but not yet
posted

$findkey = "SELECT pk_job from jobs WHERE (display = 'Yes') AND
(approval_stamp = '$matchnow') AND (posted IS NULL)";

list($getkey) = mysql_fetch_row(mysql_query ($findkey));

$key = ($getkey);

echo $key; //note this is returning the correct and expected value

echo "<br>"; 

// now that we have the key lets get the row

$query = "SELECT * FROM jobs WHERE pk_job = '$key'"; 

echo $query; //note this is apparently behaving correctly and gives me a
correct result when executed from the command line

echo "<br>";

$result = mysql_query($query);

echo $result;

echo "<br>";

//make array

$row = mysql_fetch_array ($result);

echo $row;

 

I'm pretty sure that this is a "DUH!" moment, but I'm not sure quite
what it is that I've done.  I copied the code from another thing that I
wrote a while back that's working fine and only changed SQL statements
to reflect their new purpose in life.  

 

TIA,

 

Jimi

 

 

If computers get too powerful, we can organize them into a committee --
that will do them in. -- Bradley's Bromide

 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux