Articles mysql PHP Code

XML crud operations using php

Hi friends,In this post i would like to explain about curd operations ( add, edit and delete ) data using xml file. It is simple to maintain and rapid in the operations, it will be useful when simple operations required. Below code explain the how to insert , edit , view and delete operations using …

Continue Reading
mysql

How to prevent php website from sql injection

Hi friends, In this post, i would like to explain what is sql injection and how to prevent from this attacks to our website. SQL Injection: SQL injection is another vulnerability of PHP.  SQL injection refers to the act of anyone can inserting a MySQL statement to be run on our database without our knowledge. …

Continue Reading
mysql

How to import and export big database files

Hello friends, today i want to share some basic concepts but we need to know about import and export databases. If it is small database file, we can directly export or import from the phpmyadmin. Process to export: 1) Go to phpmyadmin -> click on database -> there we have button called “export”. 2) When …

Continue Reading
mysql PHP Code

How to get list of table names from database in mysql?

Hi friends, I got the requirement to display the list of table names from the database using php code. I got the solution for it, once check the below code. 1) Connect to database: mysql_connect(“dbserver”,”dbuser”,”dbpassword”); 2)Get the list of tables from table $result = mysql_list_tables(“dbname”); 3) Count the total number of tables $num_tables = mysql_num_rows($result); …

Continue Reading
mysql PHP Code

Mysql Date functions in php code

Hello friends, The following query will add some times to mysql date column. Get the today date : $date = date(‘Y-m-d H:i:s’); Convert it into strtotime and add which one we have to add, here i am going to add 30 minutes to existing time. $newtime = strtotime($date . ‘ + 30 minutes’); Covert the …

Continue Reading
mysql PHP Code

How to display the mysql table schema using php code?

Hello friends, The following script is for displaying the mysql connecting using php code and  table schema using php code. It will be useful when we want to know the total fields of table. 1) Connecting with mysql : $db_host     = “”;  // Database hostname $db_username=””; // Database username $db_password=””; // Database password $db_name = …

Continue Reading