Most RDB programs come with an integrated backup solution.  You might want
to look into those.

As far as why your code is not working, you are not looping through the
result set, you are only pulling one result.  A database does not store data
in order, it puts it where ever there's a hole, so the 25th record could
very well hold the first spot in the file.  You have more problems than not
looping, echo "$result_sql_daily[$count_daily]"; is just going to print
"array()" if I am not mistaken.  To fix the problem that you asked about
though, take out the part where you fetch the first result and replace the
for statement with
while ($result_sql_daily = mysql_fetch_array($run_sql_daily)){

-----Original Message-----
From: Guru Geek [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 2:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Backing Up Tables Using PHP


Hello,

Trying to author my own PHP database table back up utility.  A very
simple one at that...

Here's my sql statement to select everything in the table:

$sql_daily = "SELECT * FROM dailytable";
$run_sql_daily = mysql_query($sql_daily);
$result_sql_daily = mysql_fetch_array($run_sql_daily);

Here's the code for showing me whats in the result array:

for ($count_daily=0; $count_daily < count($result_sql_daily);
$count_daily++)
 {
 echo "<p>";
 echo "$result_sql_daily[$count_daily]";
 }
exit;


Does anyone out there know why it only prints one line of the table?
It's a line in the middle of the table, it's not the first line, it's
not the last line, it's in the middle of about 25 lines.

Is this not the proper way to back up tables in a database?  I'd like a
back up copy of my tables on CD-ROM and I thought once this prints out
correctly I'd just have it print to a text file and then place the text
file on a cd....

Thanks,
Roger



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to