【IT专家】使用PHP获取mySQL数据库中的最大数字

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

本文由我司收集整编,推荐下载,如有疑问,请与我司联系
使用PHP 获取mySQL 数据库中的最大数字
使用PHP 获取mySQL 数据库中的最大数字[英]Get the Largest Number in a mySQL Database in PHP I have a SQL Database that has a column like this:
我有一个SQL 数据库,其中包含如下列:
ID-----30593 What I want to do is search through that column, find the largest number (30593) and store it in a variable.
我想要做的是搜索该列,找到最大的数字(30593)并将其存储在变量中。

This database has other columns, the example above is for demonstration only.
此数据库有其他列,上面的示例仅供演示。

e.g.
$largestNumber = GET LARGEST NUMBER FROM ID
$ maximumNumber =从ID 中获取最大数量
How would I do that in PHP / MySQL
我将如何在PHP / MySQL 中执行此操作
在PHP 中,我们这样做:
$rowSQL = mysql_query( “SELECT MAX( ID ) AS max FROM `tableName`;” );$row
= mysql_fetch_array( $rowSQL );$largestNumber = $row[‘max’]; 2
I believe SELECT max(id) FROM table will work.
我相信SELECT max(id)FROM table 会起作用。

SELECT MAX(ID)FROM TABLE
Execute the statement and assign it to your variable.
执行该语句并将其分配给您的变量。

You can do a single query to figure this out:
您可以执行单个查询来解决此问题:
tutorialspoint/mysql/mysql-max-function.htm。

相关文档
最新文档