Re: Infinite Loop Issue

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

 



Kyle Terry wrote:
> I believe I'm doing everything right here. It just seems like it doesn't
> end. The browser just keeps trying to load the page forever...
> 
> function displayAll(){
>     global $db;

What the heck is in $db?  Which SQL class(es) are you using for your DB handler?

>     $sql = "SELECT release_id, description, date(release_date) date, issues,
> priority FROM release_data";
>     $all = $db->prepare($sql);
>     $all->execute();
>     $all->bind_result($release_id, $description, $date, $issues, $priority);

Not sure, but is your bind_results() method handling all the variable here as pass by reference?

If so, I hope you are not expecting them to be updated as you run the while loop below...

> 
>     while($all->fetch()){

Usually, a while statement like this looks a little more like this...

while( $row = $all->fetch() ) {

> 
>         $i = 0;
>         $iss_link = explode(', ', $issues);

Where are you defining the $issues variable?  Where is this coming from?

I see that it will exist on the second pass through, but you need to not cause a PHP E_NOTICE warning...

>         foreach($iss_link as $a){
>           $row2[$i] = "<a href=\"http://mantisus/view.php?id=$a\";
> target=\"_blank\">".$a.'</a>';
>           $i++;

Why have a counter here???  php will take care of dynamically added an index to an array if you call it with $row2[]

>         }
>         $issues = implode(', ', $row2);
> 
>         echo $release_id;
>         echo $description;
>         echo $date;
>         echo $issues;
>         echo $priority;
>         echo '<br />';

Where are the above variables defined/create?

>     }
> 
>     $all->close();
> }
> 


-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


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