MySQL Forums
Forum List  »  Newbie

php > MySql
Posted by: Lee Beatty
Date: April 14, 2005 04:09AM

Hi

I have managed to get php to extract required data from a mysql table and write to a temporary table in a second database.

The temp table is named by the php code ie.

If Company id = 1 and Month = Apr then the temp table name would be “TAB_1_Apr”

If Company id = 3 and Month = May then the temp table name would be “TAB_3_May”

And so on….

The table name is then set as a php session variable ($temptable_name) and passed to another page for report purposes.

Q.
How do I write the SQL Query for the report page? I was hoping that I could use something like:

mysql_select_db($database_complete_cover, $complete_cover);
$query_temp_table = "SELECT * FROM `$temptable_name `";
$temp_table = mysql_query($query_temp_table, $complete_cover) or die(mysql_error());
$row_temp_table = mysql_fetch_assoc($temp_table);
$totalRows_temp_table = mysql_num_rows($temp_table);

but to no avail.

Any help would be most appreciated

Thanks

Lee Beatty

Options: ReplyQuote


Subject
Written By
Posted
php > MySql
April 14, 2005 04:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.