if you know SQL language, you can run any command by using PHP's mysql_query() function.
Database = Where you save your data (ex: if a user fill your registration form, entered data should be saved somewhere, that's database) Usually in PHP we use MySQL Database.
To delete data from your MySQL database you need to use the mysql_query() function. Please see the example below: <?php mysql_query("DELETE FROM table_name WHERE field_name = 44"); ?>
To update data from your MySQL database you need to use the mysql_query() function. Please see the example below: <?php mysql_query("UPDATE table_name SET field_name_2 = '77' WHERE field_name = 44"); ?>
PHP is a programming language, but MySQL is a database management system. They are two entirely different objects, and as a result, they are utilised for two quite different purposes. To learn more about data science please visit- Learnbay.co
Use PDO (PHP DATA OBJECTS) to write your queries. They include support most major database
To close your MySQL database connection you need to use the mysql_close() function. Please see the example below: <?php mysql_close(); ?> If your connection data is stored in a variable you would close the connection like this instead: <?php mysql_close($db_conn); ?> That's useful for if you're using more than one database connection in a PHP script.
Ultimately PHP is a programming language and MySQL is a database language. Using PHP with MySQL is a nice combination with built-in support and the simplicity of it all. However, there aren't a lot of disadvantages of using PHP with a database, it just allows for better data organization and whatnot. There are definitely advantages and disadvantages to using a database other than MySQL (such as MongoDB or PostgreSQL).
There are four major parts to a database. Which are tables, forms, reports and queries.Tables- Where all the information and data is stored within a database.Forms- Forms are used to enter, edit or deleted data in a database one record at a time.Reports- A report makes a paper copy of the data contained within a database.Queries and Sorts- Queries are a special database tool that allows you to search a database for a specific records based on certain information.*Web-based databases are often written in PHP and/or SQL, script languages frequently used by web developers.
Mysql is an Database where Data from HTML forms will be inserted to it by some scripts like ASP 3 (classic), ASP.NET, PHP, ColdFusion and... What you need is a form (By HTML), an Database and table in Mysql and PHP to insert data from your form to the table. mysql insert command is: INSERT INTO table_name_here (column1, column2, ..) VALUES (value_of_column_1, value_of_column_2, ...)
To retrieve data from a database in PHP, you can use SQL queries. First, establish a connection to the database using MySQLi or PDO. Then, use SELECT queries to fetch data from the database tables based on your requirements. Execute the query and fetch the results using appropriate functions like mysqli_fetch_assoc() or PDO fetch().
The following are the fundamental procedures for creating a MySQL database with PHP: As demonstrated in this article, connect to the MySQL server from your PHP script. If the connection is successful, construct a database using SQL and save it in a string variable. Carry out the query. To learn more about data science please visit- Learnbay.co
Please refer link. The presentation gives complete understanding of how to deal with database (Mysql) with php.