MySQL-PHP语法

MySQL-PHP语法 (MySQL - PHP Syntax)

MySQL works very well in combination of various programming languages like PERL, C, C++, JAVA and PHP. Out of these languages, PHP is the most popular one because of its web application development capabilities.

MySQL与各种编程语言(例如PERL,C,C ++,JAVA和PHP)结合使用时效果很好。 在这些语言中,PHP因其Web应用程序开发功能而成为最受欢迎的语言。

This tutorial focuses heavily on using MySQL in a PHP environment. If you are interested in MySQL with PERL, then you can consider reading the PERL Tutorial.

本教程着重于在PHP环境中使用MySQL。 如果您对使用PERLMySQL感兴趣,则可以考虑阅读PERL教程。

PHP provides various functions to access the MySQL database and to manipulate the data records inside the MySQL database. You would require to call the PHP functions in the same way you call any other PHP function.

PHP提供了各种功能来访问MySQL数据库并处理MySQL数据库内部的数据记录。 您将需要以与调用其他任何PHP函数相同的方式来调用PHP函数。

The PHP functions for use with MySQL have the following general format −

与MySQL一起使用PHP函数具有以下常规格式-


mysql_function(value,value,...);

The second part of the function name is specific to the function, usually a word that describes what the function does. The following are two of the functions, which we will use in our tutorial −

函数名称的第二部分特定于函数,通常是一个描述函数功能的单词。 以下是我们将在教程中使用的两个功能-


mysqli_connect($connect);
mysqli_query($connect,"SQL statement");

The following example shows a generic syntax of PHP to call any MySQL function.

以下示例显示了PHP的通用语法,可以调用任何MySQL函数。


<html>
   <head>
      <title>PHP with MySQL</title>
   </head>
   
   <body>
      <?php
         $retval = mysql_function(value, [value,...]);
         if( !$retval ) {
            die ( "Error: a related error message" );
         }
         // Otherwise MySQL  or PHP Statements
      ?>
   </body>
</html>

Starting from the next chapter, we will see all the important MySQL functionality along with PHP.

从下一章开始,我们将看到所有重要MySQL功能以及PHP。

翻译自: https://www.tutorialspoint.com/mysql/mysql-php-syntax.htm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值