How to modify sql in php

藏色散人
Release: 2023-03-13 15:40:01
Original
2190 people have browsed it

How to modify sql in php: 1. Connect to the database and query the data; 2. Add data through the page addnews.html; 3. Through "mysql_query("UPDATE news SET title='$title'...) ” statement can be modified to update the data.

How to modify sql in php

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

How to modify sql in php?

PHP Mysql implements database addition, deletion, modification and query

PHP and Mysql can perform simple addition, deletion, modification and query on the database. This article introduces the news Backend management of the list.

Project address

https://github.com/caochangkui/php-mysql-test

Mysql database creation

Create A news list database:

How to modify sql in php

1. Query the database

1.1. Create the file dbconfig.php and save the constants


        
Copy after login

1.2. Create the entry file index.html (connect to database, query data)

  新闻后台管理系统

新闻后台管理系统

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } // 5. 释放结果集 mysql_free_result($result); mysql_close($link); ?>
ID 标题 关键字 作者 发布时间 内容 操作
{$row['id']}{$row['title']}{$row['keywords']}{$row['autor']}{$row['addtime']}{$row['content']} 删除 修改
Copy after login

The page is as shown:
How to modify sql in php

2. Add news

2.1 Click the Add button , add data through the page addnews.html

    添加新闻 
Copy after login

2.2 Create the server-side file action-addnews.php


        
Copy after login

3. Delete news

Click the delete button, Delete through the server-side file action-del.php


        
Copy after login

4. Modify news

4.1 Click the modify button and jump to the file editnews.php for modification

    修改新闻 
Copy after login

4.2 Modify through the server-side file action-editnews.php

Modify through the server-side file action-editnews.php [Recommended learning: "PHP Video Tutorial"]


        
Copy after login

The above is the detailed content of How to modify sql in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!