Doc #54921 [Com]: Omit the extra line.
| From: | a at b dot c dot de | Date: | Wed, 28 Sep 2011 10:06:39 +0000 |
| Subject: | Doc #54921 [Com]: Omit the extra line. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7271@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54921&edit=1
ID: 54921
Comment by: a at b dot c dot de
Reported by: bimal at sanjaal dot com
Summary: Omit the extra line.
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Windows
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
The semicolon in SQL is a statement *separator*, not a statement *terminator* (as it is in PHP).
Putting a semicolon at the end of a query effectively means you are making two queries - the second
one empty.
Previous Comments:
------------------------------------------------------------------------
[2011-05-26 15:00:58] johannes@php.net
A "should" is something else from a "must not." This might fail depending on
MySQL server and client lib versions and configuration. You should not rely on it.
------------------------------------------------------------------------
[2011-05-25 06:51:39] bimal at sanjaal dot com
Description:
------------
---
From manual page: http://www.php.net/function.mysql-query#Parameters
---
The following is not true:
The query string should not end with a semicolon.
Please correct the documentation. It works even with or without the ending semicolon.
We can run the query that end with semicolons.
PHP should not try to complete the queries itself with the semicolon.
Test script:
---------------
<?php
error_reporting(E_ALL|E_STRICT);
mysql_connect('localhost', 'root', 'toor');
mysql_select_db('test');
$rs = mysql_query('SELECT NOW()
time;'); # Query with semicolon at the end
$current = mysql_fetch_assoc($rs);
echo $current['time'];
?>
Expected result:
----------------
Query with semicolon works well.
Actual result:
--------------
none
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54921&edit=1