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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 11:01:37 2025 UTC