Search Keyword:

This tutorial is on how to import large SQL files when your sql dump file cannot be handled by PHPMyAdmin due to its large file size. Importing large SQL file sizes in PHPMyAdmin will produce an error if maximum file upload size has been reached and sometimes may cause the browser to freeze. You have to import this through the command line.

Here are the simple steps on how to do it.

1. First, let us say that my Mysql.exe is in D:\xampp\mysql\mysql.exe (I’m using XAMPP by the way) . I’m gonna put my large SQL file in that directory also, meaning the path for the SQL file will be D:\xampp\mysql\your_sql_file.sql

2. Create your database in your PhpMyAdmin interface(database name only).

3. Run your command prompt(Start -> Run -> then type “cmd”).

4. Type this in the command line, assuming that your MySQL installation and the SQL file locations are on the paths I had given in Step 1.

D:\xampp\mysql\mysql.exe -u root -p db_name < D:\xampp\mysql\your_sql_file.sql

where “root” is the username of your database and “db_name” is your database name. After the successful command, you will be asked to enter password, enter your password if it has then press Enter or just press Enter if none.

5. Go back to your PHPMyAdmin to check of the SQL dump file has been executed properly.

This PHP snippet creates a HTML datepicker and automatically selects the current date in the select boxes.


<?php
$current_month = date("m");
$current_day = date("d");
$current_year = date("Y");
?>

<select name="month">
<option value="01" <?php if($current_month == "01"){ echo "selected"; } 
?>>January</option>
<option value="02" <?php if($current_month == "02"){ echo "selected"; } 
?>>February</option>
<option value="03" <?php if($current_month == "03"){ echo "selected"; } 
?>>March</option>
<option value="04" <?php if($current_month == "04"){ echo "selected"; } 
?>>April</option>
<option value="05" <?php if($current_month == "05"){ echo "selected"; } 
?>>May</option>
<option value="06" <?php if($current_month == "06"){ echo "selected"; } 
?>>June</option>
<option value="07" <?php if($current_month == "07"){ echo "selected"; } 
?>>July</option>
<option value="08" <?php if($current_month == "08"){ echo "selected"; } 
?>>August</option>
<option value="09" <?php if($current_month == "09"){ echo "selected"; } 
?>>September</option>
<option value="10" <?php if($current_month == "10"){ echo "selected"; } 
?>>October</option>
<option value="11" <?php if($current_month == "11"){ echo "selected"; } 
?>>November</option>
<option value="12" <?php if($current_month == "12"){ echo "selected"; } 
?>>December</option>
</select>

<select name="day">
<option value="1" <?php if($current_day == "01"){ echo "selected"; } 
?>>01</option>
<option value="2" <?php if($current_day == "02"){ echo "selected"; } 
?>>02</option>
<option value="3" <?php if($current_day == "03"){ echo "selected"; } 
?>>03</option>
<option value="4" <?php if($current_day == "04"){ echo "selected"; } 
?>>04</option>
<option value="5" <?php if($current_day == "05"){ echo "selected"; } 
?>>05</option>
<option value="6" <?php if($current_day == "06"){ echo "selected"; } 
?>>06</option>
<option value="7" <?php if($current_day == "07"){ echo "selected"; } 
?>>07</option>
<option value="8" <?php if($current_day == "08"){ echo "selected"; } 
?>>08</option>
<option value="9" <?php if($current_day == "09"){ echo "selected"; } 
?>>09</option>
<option value="10" <?php if($current_day == "10"){ echo "selected"; } 
?>>10</option>
<option value="11" <?php if($current_day == "11"){ echo "selected"; } 
?>>11</option>
<option value="12" <?php if($current_day == "12"){ echo "selected"; } 
?>>12</option>
<option value="13" <?php if($current_day == "13"){ echo "selected"; } 
?>>13</option>
<option value="14" <?php if($current_day == "14"){ echo "selected"; } 
?>>14</option>
<option value="15" <?php if($current_day == "15"){ echo "selected"; } 
?>>15</option>
<option value="16" <?php if($current_day == "16"){ echo "selected"; } 
?>>16</option>
<option value="17" <?php if($current_day == "17"){ echo "selected"; } 
?>>17</option>
<option value="18" <?php if($current_day == "18"){ echo "selected"; } 
?>>18</option>
<option value="19" <?php if($current_day == "19"){ echo "selected"; } 
?>>19</option>
<option value="20" <?php if($current_day == "20"){ echo "selected"; } 
?>>20</option>
<option value="21" <?php if($current_day == "21"){ echo "selected"; } 
?>>21</option>
<option value="22" <?php if($current_day == "22"){ echo "selected"; } 
?>>22</option>
<option value="23" <?php if($current_day == "23"){ echo "selected"; } 
?>>23</option>
<option value="24" <?php if($current_day == "24"){ echo "selected"; } 
?>>24</option>
<option value="25" <?php if($current_day == "25"){ echo "selected"; } 
?>>25</option>
<option value="26" <?php if($current_day == "26"){ echo "selected"; } 
?>>26</option>
<option value="27" <?php if($current_day == "27"){ echo "selected"; } 
?>>27</option>
<option value="28" <?php if($current_day == "28"){ echo "selected"; } 
?>>28</option>
<option value="29" <?php if($current_day == "29"){ echo "selected"; } 
?>>29</option>
<option value="30" <?php if($current_day == "30"){ echo "selected"; } 
?>>30</option>
<option value="31" <?php if($current_day == "31"){ echo "selected"; } 
?>>31</option>
</select>

<select name="year">
<option value="2008" <?php if($current_year == "2008"){ echo "selected"; } 
?>>2008</option>
<option value="2009" <?php if($current_year == "2009"){ echo "selected"; } 
?>>2009</option>
<option value="2010" <?php if($current_year == "2010"){ echo "selected"; } 
?>>2010</option>
<option value="2011" <?php if($current_year == "2011"){ echo "selected"; } 
?>>2011</option>
<option value="2012"  <?php if($current_year == "2012"){ echo "selected"; } 
?>>2012</option>
<option value="2013"  <?php if($current_year == "2013" ){ echo "selected"; } 
?>>2013</option>
<option value="2014"  <?php if($current_year == "2014"){ echo "selected"; } 
?>>2014</option>
<option value="2015"  <?php if($current_year == "2015"){ echo "selected"; } 
?>>2015</option>
</select>

To download this code, click this link then save the page. You may use and place it directly in a PHP page or as an include file for all the PHP pages that will need them.

php_info

This quicktip will teach you on how display PHP errors on your website without altering your php.ini file and by just writing 2 lines of PHP code and including it in your config file or just including it into your page as an include file. Sometimes(or I say “always”) web hosting companies turn “display_errors” configuration to off by default and we don’t have access or cannot modify the php.ini file in our webhosting files. This is useful when you want to find some error that is bugging your pages but cannot see all the errors because of this default configuration set by your web hosting company.

You can put this code in a separate page and call them or you can just copy and paste these 2 lines of code to the pages where you need them.


ini_set('display_errors', 1);
error_reporting(E_ALL);

As a security measure always turn this off when you don’t need to debug anymore as error messages can be a tool for potential hackers when seen.

Sponsored Links



Recent Comments

  • anup: thanx it helped me alot…
  • admin: try to look at window.location function of Javascript and place it under the success function of the AJAX...
  • ana: it works for me, but after success, how can i forward the url to a certain page? thanks
  • admin: Hello Don, do these steps again and again until the PSP reboots. Restore your PSP’s Default settings in SYstem...
  • don sb: my psp was already hacked then i changed the screen cos it broke,so at one point the battery lost total...