0

Really hope you can help with this one

I have a problem whereby i cant get all my data (over 1million and different csv files) to map and import properly, so i thought it would be better to create new tables with all the information seperate (which i can do within a few seconds each time). The only problem is my code currently just checks one table, how would i get it to do the same as now but check for example 5 different tables for the information

My current code is as below

all connection details:

<?php
$result = mysql_query("SELECT * FROM TABLE Where Name LIKE 'Smith%' ORDER BY Field10 asc") 
or die(mysql_error());  

echo "<table class = results >";
echo "<tr> <th>Field1</th> <th>Field2</th> <th>Field3</th> <th>Field4</th> <th>Field5</th> <th>Field6</th> <th>Field7</th> <th>Field8</th> <th>Field9</th> <th>Field10</th> <th>Field11</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['Field1'];
    echo "<img src='".$row['ImageUrl']."'width='60' height='80'/>";
    echo "</td><td>";
    echo $row['Field2'];
    echo "</td><td>"; 
    echo $row['Field3'];
    echo "</td><td>";
    echo $row['Field4'];
    echo "</td><td>";
    echo $row['Field5'];
    echo "</td><td>";
    echo $row['Field6'];
    echo "</td><td>";
    echo is_null($row['Field7']) ? "N/A" : $row['Field7'];
    echo "</td><td>";
    echo $row['Field8'];
    echo "</td><td>";
    echo $row['Field9'];
    echo "</td><td>";
    echo $row['Field10'];
    echo "</td><td>";
    echo sprintf( '<a href="%s"><img src="%s"/></a>', $row['Field11'], '/buyNow.gif' );
    echo "</td></tr>";
} 

echo "</table>";
?>

Thanks if someone can help

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by phpstan
0

Wrap your query in a "foreach loop" (looping through the table names) and make the table name the variable from the "foreach loop".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.