Jump to content

[SOLVED] Code Wont Continue After While Loop


glenelkins

Recommended Posts

Hi

 

Im using the following code to describe a database table. It works perfectly fine when echo() is used to display field titles, but no code after the loop is running:

 

$result = mysql_query ( "DESCRIBE `test`" );

while ( $r = mysql_fetch_array ( $result ) ) {

    extract ( $r );

    echo "$Field<br>";

}

echo "bla bla"; <---- this code doesn't run!

 

Ideas?

I ran your code on a couple of my own tables and it runs flawlessly ???

 

Something weird about the actual string you are echoing, maybe?

 

Have you tried "View source", it may be there but not appearing.

Well its just rather strange, here is the actual code... the loop does run but when I echo out the $table var nothing happens:

 

<?php

// Companies list page variables

// We need to get the fields for this page
// from the database table company_details
$cl_result = $this->database->db_query ( "DESCRIBE `company_details`" );

// Loop through fields
$table = $this->functions->tables->generate_table_top ();
$table .= $this->functions->tables->start_table_row();

while ( $cl = $this->database->db_fetch_array ( $cl_result ) ) {

extract ( $cl );

$table .= $this->functions->tables->generate_table_data ( $Field, "font-weight: bold;" );

}

$table .= $this->functions->tables->close_table_row();
$table .= $this->functions->tables->generate_table_bottom();

// Send the vars
$vars = array(
		'Title' => 'Pops - Companies List',
		'Content' => $table
		);

?>

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.