Free Android CakePHP GMaps Articles by Bali Web Design

April 16, 2008

INSERT INTO SELECT command on Mysql Database

Filed under: mysql,query optimization — Tags: , — admin @ 10:00 am

Sometimes we need to copied a small pieces of one table to another table. Usually we run SELECT FROM source table first, and then iteratively add into target table, the query is something like this

mysql_query(‘SELECT id, name, address FROM member’);

and then using php, we add all results into target table

mysql_query(‘INSERT INTO target_table(id, name,date_f) VALUES (‘. $id .’, ‘. $name .’, NOW())’);

but using this way we need at least 3 lines code and it is not efficient, there is another way to do that more efficient. Mysql has INSERT INTO SELECT FROM query command, the query will look like below

mysql_query(‘INSERT INTO target_table (id, name, date_f)
FROM source_table;’);

if you want to overwrite old value, you can use REPLACE instead INSERT.

April 13, 2008

How to find current URL using php?

Filed under: php,php-tips-basic — Tags: — admin @ 9:56 am

Sometimes we need to find current URL for processing on script. URL is construct by three component :

  1. Domain name :
  2. Script name : index.php
  3. Query string : parameter on url, example component=member&task=edit

Using $_SERVER variable we can get this all information and construct it to get full URL. We need to retrieve value ‘HTTP_HOST’, ‘SCRIPT_NAME’ and ‘QUERY_STRING’ on $_SERVER array. Here is the code :

$url = “http://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘SCRIPT_NAME’] . “?” . $_SERVER[‘QUERY_STRING’];

this script produce complete current url, if you don’t need host to be included you can just use values from $_SERVER[‘REQUEST_URI’];

April 10, 2008

Site philosophy, another introduction title than Hello world!

Filed under: web-history — admin @ 7:50 am

As my other new website, i always create an introduction text about the site purposes beside of using this standard text after wordpress installation.

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

I would like to describe my skill background. I were graduated from Christian Duta Wacana University at Jogjakarta. I took Information technology faculty. Basically i learn about how to program and at the end of study, i learn more about Internet and Multimedia. So i start to join to internet club on my campus named UKDWNet Club and got basic experience about how to build and manage a website. I’m very excited at that time, so i am focusing on web programming.

After graduated i join to outsourcing company from Germany that handle big project for desktop application and web application. And during this time i get more experience about programming using Delphi, .NET and PHP. Now i am a senior PHP programmer in this company. I forgot to mention the company, it is named Probypro Digitals Solution. And i still join to this company until now.

Beside my full time work at Probypro, i also do some freelance project with other IT company in Bali, such as Bengkel Media Group, Barefoot, and other company that even doesn’t have named, ;)

So this site is my first publication of my skill, hope that i can help you to grow your business using IT Solution. Oh ya i would like to say great thanks to Janumedia for encouraging me to publish my skill and post some article related with software development.

In the next days i would like to post some article about programming and internet stuff. Feel free to contact me for support.

Wishes all best for you.

Mario Cahyadi
Owner of Bali Stupa