Web Hosting Talk







View Full Version : Mysql db backup


UrlGuy
07-28-2005, 10:35 PM
Hi,

I want to output username, password and email from database.
I can't output this on my screen or in a table as its pretty much, its about 75k users. I have also tried to fwrite the results into a txt but it also timed out here.

I have also whent into phpmyadmin and chose 'export' and choose download as file, zip, and try to download.. but this also times out.. takes so long time. I dont have access to php.ini on my server.

I just need to have output all of the usernames, passwords and emails in a file. And its pretty much. Can I for example do this with PHP? Any ideas on this?

Thanks in advance for all replies,
Urlguy

hanzerik
07-29-2005, 12:22 AM
<?
$db_name ="YourDB";
$table_name ="YourTB";
$connection = @mysql_connect("hostname","dbusername","dbpassword") or die(mysql_erro
r());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
echo "
<b>Cut and paste the text below</b><br>
------------------------------------------<br>
";
$SQL = @mysql_query("SELECT * FROM $table_name");
while($r=mysql_fetch_array($SQL))
{
$username=$r["username"];
$password=$r["password"];
$email=$r["email"];
echo "$username $password $email<br>";
}
?>


Think that should do what you want, just will have to change it to match your settings. I have a db with about 17K entries and it takes a few sec's to render the page pulling only 1 column from a single table. I'm still fairly new to PHP so maybe there is another way to do it.