Page 1 of 1

Creating a dummy table for data collection

Posted: Thu May 19, 2005 3:14 am
by barney0o0
Sorry, total newbie....ive been going through a book and trying to alter for my own needs, but i just cant get it to work....could anyone help

I understand that i need to create a dummy table prior to retrieving actual data in result page. What i have so far the the following, but i need help as i think i made a total mess of it:

<?php
mysql_select_db($database_tapfinalconnection, $tapfinalconnection);
$query_LibraryLookup = "INSERT INTO librarylookup SELECT library_1.BookID, library_1.BookTitle, library_1.Author, library_1.BookISDM, library_1.AuthorInitail, library_1.Comment, library_1.SessionCube FROM library, library library_1, library";
mysql_query($query_Librarylookup,$tapfinalconnection);
?>

<?php
$WhereParam_Library = "Where BookID <>0";
if (isset($WhereParam)) {
$WhereParam_Library = (get_magic_quotes_gpc()) ? $WhereParam : addslashes($WhereParam);
}
mysql_select_db($database_tapfinalconnection, $tapfinalconnection);
$query_Library = sprintf("SELECT * FROM LibraryLookup %s", $WhereParam_Library);
$Library = mysql_query($query_Library, $tapfinalconnection) or die(mysql_error());
$row_Library = mysql_fetch_assoc($Library);
$totalRows_Library = mysql_num_rows($Library);
?>
<?php
$query_LibraryLookup = "DELETE FROM librarylookup";
mysql_query($query_LibraryLookup,$tapfinalconnection);
?>

Many thanks in advance

Posted: Thu May 19, 2005 3:32 am
by phpScott
i don't know the answer but you might want to edit your post and include the php tags and read the rules for posting.

Posted: Thu May 19, 2005 3:51 am
by barney0o0
i told you i was a newbie...i couldnt even post on the forum correctly!!...here goes

Code: Select all

<?php 
mysql_select_db($database_tapfinalconnection, $tapfinalconnection); 
$query_LibraryLookup = "INSERT INTO librarylookup SELECT library_1.BookID, library_1.BookTitle, library_1.Author, library_1.BookISDM, library_1.AuthorInitail, library_1.Comment, library_1.SessionCube FROM library, library library_1, library"; 
mysql_query($query_Librarylookup,$tapfinalconnection); 
?>
Followed by:

Code: Select all

<?php 
$WhereParam_Library = "Where BookID <>0"; 
if (isset($WhereParam)) { 
$WhereParam_Library = (get_magic_quotes_gpc()) ? $WhereParam : addslashes($WhereParam); 
} 
mysql_select_db($database_tapfinalconnection, $tapfinalconnection); 
$query_Library = sprintf("SELECT * FROM LibraryLookup %s", $WhereParam_Library); 
$Library = mysql_query($query_Library, $tapfinalconnection) or die(mysql_error()); 
$row_Library = mysql_fetch_assoc($Library); 
$totalRows_Library = mysql_num_rows($Library); 
?>
...and then the last bit

Code: Select all

<?php 
$query_LibraryLookup = "DELETE FROM librarylookup"; 
mysql_query($query_LibraryLookup,$tapfinalconnection); 
?>