Jump to content

Recommended Posts

Hello , in PHP , I'd like with only a few lines to get all data from a table without the obligation to specify the number of fields and their names.

 

I got like 200 fields multiply by 12 tables ...

So if the structure is liek that:

FName LName Age

 

 

while($e = mysql_fetch_array($query)){

//code I am looking for

}

 

Displays

 

Fname => dupond

Lname => arthur

Age => 18 ..

thanks.

 

you could echo it into a javascript array, and have javascript push the raw data into a table, that will considerably cut down on the loading time.. since its javascript which is a client side language, so you'll be sending the MINIMAL amount of data, and the browser will handle it..

print_r is nice it displays a display with all the data.

Array ( [0] => 548084 [MLSNumber] => 548084 [1] => 184900 [PriceListing] => 184900 [2] => BROADKILL HUNDRED [Area] => BROADKILL HUNDRED [3] => A [statusActual] => A [4] => BETWEEN RT. 1 & 113 [section] => BETWEEN RT. 1 & 113 [5] => DUORY CIRCLE [AddressStreetName] => DUORY CIRCLE [6] => MILTON [AddressCity] => MILTON [7] => [AddressUnitNumber] => [8] =>

Something like this should do it

 

<?php
$tables = array("table1", "table2","etc");
$data = array();
foreach($tables as $table)
{
echo "$table<br>/n";
$result = mysql_query("SELECT * FROM $table");
echo "<pre>";
while ($row = mysql_fetch_assoc($result))
{
	var_dump($row);
	//$data[$table][] = $row; //Capture data
}
echo "</pre>";
echo "<br>/n";
}

//var_dump($data); //show all data

?>

 

EDIT: added a capture array (commented out)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.