php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22469 alias for mysql_result($res, 0)
Submitted: 2003-02-27 23:26 UTC Modified: 2003-08-23 11:51 UTC
From: Amiel dot Martin at wwu dot edu Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Amiel dot Martin at wwu dot edu
New email:
PHP Version: OS:

 

 [2003-02-27 23:26 UTC] Amiel dot Martin at wwu dot edu
I use:

$res = mysql_query("SELECT one_column FROM table")
  or die("blah");
$var = mysql_result($res,0);

VERY often.
I am requesting a pop-like function for a mysql result;

so that:

mysql> SELECT col_one, col_two FROM table;
---------------------
| col_one | col_two |
|---------|---------|
| res one | res two |
| res thr | res fou |
|-------------------|

<?
$res = mysql_query("SELECT col_one, col_two FROM table")
  or die("blah");
while( $feild = mysql_pop($res) )
  echo "$feild\n";
?>

would print:
res one
res two
res thr
res fou


thanks much,

Amiel

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-23 11:51 UTC] andrey@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You may use array_pop to achieve this :

<?
$res = mysql_query("SELECT col_one, col_two FROM table")
  or die("blah");
while( $feild = array_pop(mysql_fetch_row($res)) )
  echo "$feild\n";
?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 16:01:31 2024 UTC