Content about Java ERP Solution for Reviews Best ERP Software for sale and Free Software with Java OpenSource for Free Download

PHP mysql tutorial example to manage mysql database with PHP

Mysql is the most popular free DBMS with high performance we can use PHP to manage MySQL with query , insert , delete , update
This tutorial is basis for using PHP to execute SQL command pass to MySQL DBMS

PHP MySQL tutorial

 //Connect database  
 $username="root";  
 $password="root";  
 $database="testdb";  
 mysql_connect("localhost",$username,$password);  
 @mysql_select_db($database) or die( "Unable to select database");  
 //SQL Query command  
 $query="select * from my_table where p_type='Y' order by last_view desc limit 0,10";  
 $result=mysql_query($query);  
 $x_num=mysql_numrows($result);  
 $x_i=0;  
 while ($x_i < $x_num) {  
   $code=mysql_result($result,$x_i,"code_id");  
   $title=mysql_result($result,$x_i,"title");  
   echo "<BR>".$code." : ".$title;  
 }  
 //SQL Insert / Update Command by using only mysql_query();  
 $query = "insert into test_comment (flash_id,content,post_by,create_date,last_update,ip) ";  
 $query.="values('$flash_id','$content2','$post_by','$_date','$_date','$ip')";  
 mysql_query($query);  
 $query = "update test_table set stat=$new_stat,last_view='$last_view' where code_id=$code_id";  
 mysql_query($query);  

Tip : you can using command mysql_query(); to execute SQL command to mysql it's very easy yes