Wednesday, 28 December 2016
MySQL Insert record with condition
INSERT INTO paid_order_id(order_id,custom_value) SELECT order_id,'custom value' from orders
WHERE order_status = 'Paid';
in this example, you create a table name "paid_order_id" and insert all order_id from table orders but only with paid status.
Run PHP and MySQL in your Android Phone
To run PHP in your android phone you need to have an Apache Service running
you can download
https://play.google.com/store/apps/details?id=com.andi.serverweb&hl=en
or Search for Bit WebServer in Google Playstore
it supports
LIGHTTPD as Web Server ,
- PHP as PHP Server ,
- MYSQL as MySQL Server ,
- MSMTP as SMTP Client
after installing the application, just start LIGHTTPD and mysql and put your website in www folder in root directory of your android phone.
you can also access phpmyadmin and import your mysql database.
this will run your php website in your android phone :)
if you are using codegniter and using mod_write there's lighthttpd configuration in the app. just enter this code
url.rewrite = (
".*\.(js|ico|gif|jpg|png|swf|css|html)$" => "$0",
"^/(.*)$" => "index.php/$1"
)
to enable ur rewrite.
htaccess redirect www to non-www
Just paste the below code in your .htaccess file to redirect www to non-www URL
make sure that mod_rewrite module is enable in your server.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
htaccess redirect to non-www
Just paste the below code in your .htaccess file to redirect non-www to www URL
make sure that mod_rewrite module is enable in your server.
RewriteEngine OnRewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.
Show All PHP Errors
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
die();
just paste this PHP code to show all PHP error
Re-Cached your Website in Google Result
If you made changes in your website, you will notice that in google search result, It doesn't change automatically, well that's because google shows the last crawl cached.
to force google to Re-Cache you website. you can use this google tool
https://www.google.com/
just to to link and enter your website URL.
Enable Hidden Administrator Account on Windows 7
Press Windows key then type "cmd"
right click then run as administrator
copy this code
net user administrator /active:yes
then right click in your command prompt window, and click paste. then press Enter.
when command completed successfully just switch user, and you can now login to administrator account.
if you want to turn it off, just do the same and enter this command
net user administrator /active:no
:)
Creating VirtualHost in XAMPP and Creating your Local Domain
In this blog post, I'll be showing you how you can create VirtualHost in XAMPP and creating a local domain.
I'm assuming that you already have an installed XAMPP in your machine.
Let's first create a local domain.
open your notepad (make sure you Run it as adminsitrator, see below image)
editing your hostfile will require your administrator privilege, so make sure to turn off your antivirus, especially it's real time protection, because some antivirus blocks updating the hostfile.
Click file > open
locate this folder
C:\Windows\System32\drivers\etc
(on the lower right side of the window make sure to click "All Files "."" to view all files inside the folder)
and open "hosts" and add this line
127.0.0.1 localhost.yourdomain.com
then save.
when saving is successful, you will be redirected to your localhost each time you type "localhost.yourdomain.com" in your browser address, once the VirtualHost is setup correctly it will automatically open your default page, set in your VirtualHost configuration
now let's setup virtualhost.
in your XAMPP folder locate this folder
apache\conf\extra
inside the "extra" folder open the file "httpd-vhosts.conf"
and paste this configuration
ServerAdmin admin@localhost.com
DocumentRoot "C:/xampp/htdocs/yourwebsitefolder/"
ServerName localhost.yourdomain.com
ServerAlias localhost.yourdomain.com
Allow from all
just change "yourwebsitefolder" to the name of your website folder
now, just restart apache to save your changes, then your done! :)
Subscribe to:
Posts (Atom)


