0% found this document useful (0 votes)
52 views

Insert Data Into Mysql Database

The document provides instructions for inserting, updating, and selecting data from a MySQL database using PHP. It includes the SQL syntax for inserting data into a table, connecting to a MySQL database in PHP, and updating data in a table. It also lists 7 spots in a code example that need to be customized for a user's specific database, including the database connection, table name, pagination settings, column name, and while loop to display results.

Uploaded by

juliecristenaa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Insert Data Into Mysql Database

The document provides instructions for inserting, updating, and selecting data from a MySQL database using PHP. It includes the SQL syntax for inserting data into a table, connecting to a MySQL database in PHP, and updating data in a table. It also lists 7 spots in a code example that need to be customized for a user's specific database, including the database connection, table name, pagination settings, column name, and while loop to display results.

Uploaded by

juliecristenaa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

insert data into mysql database.

Syntax "INSERT INTO table_name(column_name1, column_name2)VALUES('value1, 'value2')" ;

<?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB");

Update/Edit data from mysql database "UPDATE table_name SET column_name1=' value', column_name2=' value' WHERE column_name=' value' "; Grab the code and paste in your text editor. You have to customize 7 spots in this code (see images below). 1. Code to connect to your DB - place or include your code to connect to database. 2. $tbl_name - your table name. 3. $adjacents - how many adjacent pages should be shown on each side. 4. $targetpage - is the name of file ex. I saved this file as pagination.php, my $targetpage should be "pagination.php". 5. $limit - how many items to show per page. 6. "SELECT column_name - change to your own column. 7. Replace your own while..loop here - place your code to echo results here. After all, save and test your script.

You might also like