Performing Multiple Prepared Queries

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

 



All,

I am attempting to perform multiple prepared queries using mysqli.  I
want to pull information out of one table based on the information in
another.  I do not receive any errors and the rest of the page seems to
load correctly.  Below is my code:

foreach ($uniqueids as $entryid) {
 $getentrybyid->bind_param("i", $entryid);
 $getentrybyid->execute();
 $getentrybyid->bind_result($level, $published, $updated, $title, $body,
$resources, $signature, $comments);
 $getentrybyid->fetch();
 $getentrybyid->close();

 $getsignaturebyid->bind_param("i", $signature);
 $getsignaturebyid->execute();
 $getsignaturebyid->bind_result($fname, $lname);
 $getsignaturebyid->fetch();
 $getsignaturebyid->close();

 printEntry($title, $level, $published, $updated, "$fname $lname",
$body, $resources);

 if ($comments == 'y') {
  echo "<div class=\"viewcomment\"><a
href=\"$http_path?entryid=$entryid\">View Comments...</a></div>\n";
 }
}

What ends up happening is the first query (getentrybyid) works just fine
and displays when told.  The second query (getsignaturebyid) does not
get the information that it is supposed to, thus the variable is empty.

NOTE:  I have moved the close() functions outside of the foreach loop
and it partially works.  It starts displaying the information it is
supposed ($fname $lname) but it repeats the rest of the information.

Any thoughts?

-- 
Nathaniel Hall, GSEC GCFW GCIA GCIH GCFA
Spider Security

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux