[PHP] Restoring a mysql database without shell access.
I'm currently having trouble finding a way to dump an existing mysql database file into a new mysql database. The problem is I don't have shell access to the new server and there is no import database function in the host manager. Is there a way to dump it from a PHP script or any good apps for restoring databases besides PHPmyadmin.? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto Incrementing a Variable name?
I think I have something that will do the trick thanks to everyones help. $name_1_aaa = "Jimmy"; $name_2_aaa = "Janis"; $name_3_aaa = "Joe"; for ($i = 1; $i <= 3; $i++) { $arr_name[$i] = 'name_'.$i.'_aaa'; } echo ${$arr_name[1]}.''; echo ${$arr_name[2]}.''; echo ${$arr_name[3]}.''; Displays: Jimmy Janis Joe Now I can do something like this for all my updates for ($i = 1; $i <= 3; $i++) { $query_update = "UPDATE table SET name='${$arr_name[$i]}' WHERE name_id='$i'"; $result_update = mysql_query($query_update) or die("Query failed"); } Thanks for all the help! Jeff - Original Message - From: "Jason k Larson" <[EMAIL PROTECTED]> To: "Jeff Pauls" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, February 25, 2003 3:37 PM Subject: Re: [PHP] Auto Incrementing a Variable name? > $name1 = 'Hello, World!'; > $i = 1; > $var = 'name'.$i; > print ${$var}; > > HTH, > Jason k Larson > > > Jeff Pauls wrote: > > Hi, > > I've been playing with this for a while now. Say I had the following variables: > > > > $name1 = "joe"; > > $name2 = "janis"; > > $name3 = "joanne"; > > > > Is there a way in php to increment the variable name not the value? Something like this > > > > for ($i = 1; $i <= 3; $i++) { > > $arr_name[$i] = $name.$i; // I want $name1,$name2,$name3 etc > > } > > > > > > This way say if I had 500 database queries that need to be updated I could just loop through each and just change the record id. > > > > for ($i = 1; $i <= 500; $i++) { > > > > $query_update = "UPDATE table SET name=' $arr_name[$i]', WHERE person_id='$i"; > > $result_update = mysql_query($query_update) or die("Query failed"); > > } > > > > instead of doing something like this: > > > > $query_update1 = "UPDATE table SET name=' $name1', WHERE person_id='1"; > > $result_update1 = mysql_query($query_update1) or die("Query failed"); > > > > $query_update2 = "UPDATE table SET name=' $name2', WHERE person_id='2"; > > $result_update2 = mysql_query($query_update2) or die("Query failed"); > > > > $query_update3 = "UPDATE table SET name=' $name3', WHERE person_id='3"; > > $result_update3 = mysql_query($query_update3) or die("Query failed"); > > > > etc. > > > > Anybody? There has to be a way of doing this... > > > > Thanks, > > > > Jeff > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto Incrementing a Variable name?
I get an error with this. PHP doesn't like "$name$i". for ($i = 1; $i <= 3; $i++) { $arr_name[$i] = $name$i; // I want $name1,$name2,$name3 etc } I've looked at Variable variables but I don't think that is what I need. What about if I wanted something like $name_1_ff $name_2_ff $name_3_ff neither of these work. $name_$i_ff $name_.$i._ff Having something after causing more of a problem. First of all PHP can't find the value of "$name_" and "_ff" just breaks it more. Jeff - Original Message ----- From: "Rick Emery" <[EMAIL PROTECTED]> To: "Jeff Pauls" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, February 25, 2003 3:26 PM Subject: Re: [PHP] Auto Incrementing a Variable name? > You're on the right track: > for ($i = 1; $i <= 3; $i++) { > $arr_name[$i] = $name$i; // I want $name1,$name2,$name3 etc > } > > - Original Message - > From: "Jeff Pauls" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, February 25, 2003 3:18 PM > Subject: [PHP] Auto Incrementing a Variable name? > > > Hi, > I've been playing with this for a while now. Say I had the following variables: > > $name1 = "joe"; > $name2 = "janis"; > $name3 = "joanne"; > > Is there a way in php to increment the variable name not the value? Something like this > > for ($i = 1; $i <= 3; $i++) { > $arr_name[$i] = $name.$i; // I want $name1,$name2,$name3 etc > } > > > This way say if I had 500 database queries that need to be updated I could just loop through each > and just change the record id. > > for ($i = 1; $i <= 500; $i++) { > > $query_update = "UPDATE table SET name=' $arr_name[$i]', WHERE person_id='$i"; > $result_update = mysql_query($query_update) or die("Query failed"); > } > > instead of doing something like this: > > $query_update1 = "UPDATE table SET name=' $name1', WHERE person_id='1"; > $result_update1 = mysql_query($query_update1) or die("Query failed"); > > $query_update2 = "UPDATE table SET name=' $name2', WHERE person_id='2"; > $result_update2 = mysql_query($query_update2) or die("Query failed"); > > $query_update3 = "UPDATE table SET name=' $name3', WHERE person_id='3"; > $result_update3 = mysql_query($query_update3) or die("Query failed"); > > etc. > > Anybody? There has to be a way of doing this... > > Thanks, > > Jeff > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Auto Incrementing a Variable name?
Hi, I've been playing with this for a while now. Say I had the following variables: $name1 = "joe"; $name2 = "janis"; $name3 = "joanne"; Is there a way in php to increment the variable name not the value? Something like this for ($i = 1; $i <= 3; $i++) { $arr_name[$i] = $name.$i; // I want $name1,$name2,$name3 etc } This way say if I had 500 database queries that need to be updated I could just loop through each and just change the record id. for ($i = 1; $i <= 500; $i++) { $query_update = "UPDATE table SET name=' $arr_name[$i]', WHERE person_id='$i"; $result_update = mysql_query($query_update) or die("Query failed"); } instead of doing something like this: $query_update1 = "UPDATE table SET name=' $name1', WHERE person_id='1"; $result_update1 = mysql_query($query_update1) or die("Query failed"); $query_update2 = "UPDATE table SET name=' $name2', WHERE person_id='2"; $result_update2 = mysql_query($query_update2) or die("Query failed"); $query_update3 = "UPDATE table SET name=' $name3', WHERE person_id='3"; $result_update3 = mysql_query($query_update3) or die("Query failed"); etc. Anybody? There has to be a way of doing this... Thanks, Jeff
Re: [PHP] Directory size
You can try something like this. $dir = "dir"; function dirsize($checkdir) { $dh = opendir($checkdir); $size = 0; while (($file = readdir($dh)) !== false) if ($file != "." and $file != "..") { $path = $checkdir."/".$file; if (is_dir($path)) $size += dirsize($path); elseif (is_file($path)) $size += filesize($path); } closedir($dh); $formated_size = $size /1000; return $formated_size; } $getFolderSize = dirsize("/files/personal"); Jeff - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> To: "Antti" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, February 03, 2003 4:37 AM Subject: Re: [PHP] Directory size > there is no php function for this, you can use unix command du or do it > in a loop > > Antti wrote: > > > How do I get the directory size? Suppose there is a function for this. > > > > antti > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Html forms
I wouldn't break it up into 3 lines of code. try: print ""; or echo ''; Jeff - Original Message - From: "Todd Barr" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 03, 2003 8:59 AM Subject: [PHP] Html forms I am having difficulty putting results into an form Once the query runs, I have this for my output print ""; This results in an HTML error being apache finds an error AFTER the tag Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() function not working in PHP 4.2.3
Hi, I have a simple mail script and when I run the script I get the following error: Warning: mail() is not supported in this PHP build in /var/www/htdocs/file.php on line 159 I've checked the php.ini file to see if a setting was turned off, but came up with nothing except for: ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = If the server that I'm working on is using QMAIL for it's email do I have to change a setting somewhere? Or does mail() not work in version 4.2.3? Any help would be great. Thanks, Jeff