Thompson, Jimi wrote:


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.

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


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

$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;

$row is an array that contains data on the first row from the query result. so

echo $row['columnname'];  to show a column.

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.



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

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to