hay guyz im stuck in an infinite loop ill try to explain what im actually tryin to do
im letting a user of the application take a backup of a mysql db he selects a path n types in a file name for the backup to be dumped as two files 1. tk_bkp.php(take_backup) 2. gen_qry_bkp.php(generate_backup_query) take backup file: gets the dir path and file name includes 2 files 1st to generate the insert into query 2nd to write a file on user's disk generate backup query file : 1. fetchs all table names from a table tbl_ztbl (i dont want it to fetch all table namez as ive got 17 lookup tables in the db) 2. after it has fetched the table names it calls the ReedDta() funct passing it the table names fetched 3. ReedDta() funct : i. fetches all the data inserted in the tables where nu_bkp=0 (the watch-dgo field for new || backup data; 0==new) ii. fetches all the field names from the table names fetched in #1 iii. make an insert into query problem: a. the ReedDta() funct gets stuck in the query #i where it has to fetch the data inserted into the db tables :| the query goes nuttz ...... or perhapps i ve screwed somethin else in the code :| b. the data fetched from the tables include a primary key auto-incrementor the backup is to be restored on the server where the application will be hosted and i most definately dont want the backup-auto-incremented values to get inserted in to the server db as im generating reports on distinct primarykeys what the hell do i do now ? :| :S i guess i ve done it for myslf to get sacked after this proj is through :) the code goes here =========================================================== tk_bkp.php ===================================== $bkp_fl = $_GET['bkp_fl']; echo("1st $bkp_fl<br>"); $dirPth=""; $rpos = strrpos($bkp_fl, '\\'); $dirPth = substr($bkp_fl, 0, $rpos+1); $FileStr = substr($bkp_fl, $rpos+1, strlen($bkp_fl)); str_replace("\\", "/", $bkp_fl); if(is_dir($dirPth)){ echo("<br> da dammed dir xixtz ! continue savin da file ! ! ! ! <br>"); //$fp=fopen("$FileStr", "wb"); include"gen_qry_bkp.php"; include"gen_bkp_fl.php"; } else{ echo("<br> da dammed dir duzn xixtz ! mk dir here ! ! ! ! <br>"); if (mkdir($dirPth)){ echo("<br> da dammed dir created ! save da file now ! ! ! ! <br>"); //$fp=fopen("$FileStr", "wb"); include"gen_qry_bkp.php"; include"gen_bkp_fl.php"; } else { echo("<br> da dammed dir cudn b created ! :S now vat :S :| :[ ! ! ! ! <br>"); } } ====================================================================== //$pg = 'gen_qry_bkp.php'; ====================================================================== $ftch_tbl_nmx_qry = "select tbl_nme from tbl_ztbl"; $ftch_tbl_nmx_qry_rzlt_hndlr = mysql_query($ftch_tbl_nmx_qry) or die("qry $ftch_tbl_nmx_qry failed ! da tbl must xixt in da db 2 b played vid ! ! ! !"); for($count=0; $count <= mysql_num_rows($ftch_tbl_nmx_qry_rzlt_hndlr); ++$count){ $ftch_tbl_nme = mysql_fetch_row($ftch_tbl_nmx_qry_rzlt_hndlr); $tbl_nme = $ftch_tbl_nme[0]; $tbl_nme_cmt = "/* <br> Table data for planDb_Bkp.$tbl_nme <br> */ <br> "; echo("$tbl_nme<br>"); ReedDta($tbl_nme); echo($tbl_nme_cmt); } function ReedDta($tbl_nme){ // xz2 $ftch_dta_qry = "select * from $tbl_nme"; $ftch_dta_qry_rzlt_hndlr = mysql_query($ftch_dta_qry) or die("qry $ftch_dta_qry failed ! da tbl must xixtin da db 2 b played vid ! ! ! !"); echo($ftch_dta_qry); for($cnt=0; $cnt = mysql_num_rows($ftch_dta_qry_rzlt_hndlr); ++$cnt){ $ftch_dta = mysql_fetch_row($ftch_dta_qry_rzlt_hndlr); $inzrtn_dta[] = $ftch_dta[$cnt]; echo("<br> inzrtn dta gozz : $inzrtn_dta <br> "); } $inzrt_qry_1st_hlf = "insert into $tbl_nme ("; // xz1 $result_q = "select * from $tbl_nme limit 0,1"; $result = mysql_query($result_q) or die("qry $ftch_fld_nmz_qry failed ! da tbl must xixt in da db 2 b played vid ! ! ! !"); $num_fldz = mysql_num_fields($result); for($i = 0; $i < $num_fldz; $i++) { $fldxx[] = mysql_fetch_field($result); } echo($inzrt_qry_1st_hlf); for($i = 0; $i < $num_fldz; $i++) { printf("%s,\n", $fldxx[$i]->name); } $inzrt_qry_2nd_hlf = ") values ($valz)"; echo($inzrt_qry_2nd_hlf); } ====================================================================== thnx a million guyz toby __________________________________________________ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php