Php Mysql Record Add and List

thumbnail
Good day in this article with Php Mysql database connection to the table and add records to the table and we will list these records. To do this process must be installed on your computer Php and Mysql.

Why do we need a database when we come to the question if we are going to make an interactive site is very important to have a database. Html / Css sites are static sites.

Now let’s move on to the coding side, which is the most beautiful part of the job.?

First we need to create database and table with mysql. I use Mysql Workbench program for this. But you can also create database and tables from the command line. I created a table in the test database as information.

 

Adding Records

Now, how we are adding records to our database look at it. Bootstrap is a really nice blessing, making the appearance of normal html tags really more beautiful. It also adds richness to the appearance with some unique features.

The action element within the form tag specifies which page we will send the request to. If you send with the Get method, the information you send will appear in the address bar. Click on the link to write about this topic.

http://fatihdemirag.net/php-get-post-istekleri/

Now let’s go to the code that we will write on the server side, ie php_kaydet.php.

In the first line, we assign our mysql connection into the $ con variable. We will use this variable later when running the query. Here are the important points. One of the requests is the name of the input tag in our html page. name must be $ _POST [‘ad’].

Then we run our query in our $ res variable. After running, if the query returned true, our data was added. The last one is closing the database connection.

Listing Records

I used the table when listing the records, but the desired tags can be used. I used it because the table is more organized. I did the list on the same page.

 

 

 

 

Yukarı Git
×
Whatsapp
Merhaba size nasıl yardımcı olabilirim ?
Powered by
%d blogcu bunu beğendi: