English 中文(简体)
MariaDB - PHP Syntax
  • 时间:2024-12-27

MariaDB - PHP Syntax


Previous Page Next Page  

MariaDB partners well with a wide variety of programming languages and frameworks such as PHP, C#, JavaScript, Ruby on Rails, Django, and more. PHP remains the most popular of all available languages due to its simppcity and historical footprint. This guide will focus on PHP partnered with MariaDB.

PHP provides a selection of functions for working with the MySQL database. These functions perform tasks pke accessing it or performing operations, and they are fully compatible with MariaDB. Simply call these functions as you would call any other PHP function.

The PHP functions you will use for MariaDB conform to the following format −

mysql_function(value,value,...);

The second part of the function specifies its action. Two of the functions used in this guide are as follows −

mysqp_connect($connect);
mysqp_query($connect,"SQL statement");

The following example demonstrates the general syntax of a PHP call to a MariaDB function −

<html>
   <head>
      <title>PHP and MariaDB</title>
   </head>

   <body>
      <?php
         $retval = mysql_function(value, [value,...]);
      
         if( !$retval ) {
            die ( "Error: Error message here" );
         }
         // MariaDB or PHP Statements
      ?>
   </body>
</html>

In the next section, we will examine essential MariaDB tasks, using PHP functions.

Advertisements