PHP – MySQL : Create Database

php-mysql

  [root@mysqlDB]# mysqladmin -u root -p create eduguru Enter password:****** This will create a MySQL database eduguru. This is a simple example to create database called eduguru. Example: <?php $dbhost = ‘localhost:3036’; //If mysql server is on same server $dbuser = ‘root’; //mysql user who has the permission to create database $dbpass = ‘rootpassword’; //mysql user’s password … Read more

PHP MySQL Database Connection

php-mysql

PHP 5 and later can work with a MySQL database using: MySQLi extension (the “i” stands for improved) PDO (PHP Data Objects) Earlier versions of PHP used the MySQL extension. However, this extension was deprecated in 2012. Open a Connection to MySQL   Example: <?php $servername = “localhost”; $username = “username”; $password = “password”; // … Read more

Backup and Restore Mysql database table

MySQL Cluster

Dump and restore from .sql Dump mysqldump db_name table_name > table_name.sql Restore mysql -u <user_name> -p db_name mysql> source <full_path>/table_name.sql or in one line mysql -u username -p db_name < /path/to/table_name.sql Dump and restore from a compressed (.sql.gz) format Dump mysqldump db_name table_name | gzip > table_name.sql.gz Restore gunzip < table_name.sql.gz | mysql -u username … Read more

No route to host (113)

In host machine iptables is running and is blocking the port 5901. Kill all the vncserver desktop in the host machine and run the following command in the terminal. Type the password for the user when prompted. sudo iptables -I INPUT 1 -p tcp –dport 5901 -j ACCEPT The above command will add the port 5901 … Read more

saving data into custom cdr field – add new filed in cdr

I created custom field “rec_name” id table “cdr”, database “asteriskcdrdb”. In this field I want to store recording name. I know i should do it by adding this line in one of .conf files, but where? exten => s,1,set(CDR(rec_name)=${CALLFILENAME}) I can do it by sql statement, too, but i don’t know where is the file … Read more

Create your own search engine with PHP and MySQL

Database Matter The first step is to open up phpMyAdmin or a database software and incorporate the below query into the SQL section. 1 2 3 4 5 6 CREATE TABLE `searchengine` ( `id` INT NOT NULL AUTO_INCREMENT , `pageurl` VARCHAR( 255 ) NOT NULL , `pagecontent` TEXT NOT NULL , PRIMARY KEY ( `id` … Read more

Insert Data From a Form Into a Database

iNet Expert Technology

Now we will create an HTML form that can be used to add new records to the “Persons” table. Here is the HTML form: <html> <body> <form action=”insert.php” method=”post”> Firstname: <input type=”text” name=”firstname”> Lastname: <input type=”text” name=”lastname”> Age: <input type=”text” name=”age”> <input type=”submit”> </form> </body> </html> When a user clicks the submit button in the … Read more