php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10412 field name in mysql_lsit_fields
Submitted: 2001-04-19 18:59 UTC Modified: 2001-04-19 19:11 UTC
From: dkokenge at netscape dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS:
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: dkokenge at netscape dot net
New email:
PHP Version: OS:

 

 [2001-04-19 18:59 UTC] dkokenge at netscape dot net
When using "mysql_list_fields" for a file you can extract
the field names of the schema.
For example: $fname. Then turn it into the variable for the
schema name as $$fname.
$$fname = 'something';  // **** works
$$fname[0] = 'something'; // **** don't work
---------------------------------------------------
Example
---------------------------------------------------
$schema = mysql_list_fields("wine","wpo_dtl");	
$nf 	= mysql_num_fields($schema);	// get num of fields
$xx 	= mysql_fetch_array($schema);	
while ($i < $nf) {
$fname = mysql_fieldname($schema,$i);

//***** this works *****
$$fname = 'something';
// ******* this don't
$x = 0;
$$fname[$x] = 'something';
}

What am I doing wrong???


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-19 19:11 UTC] torben@php.net
Please read the following page in the manual, especially
the last paragraph:

http://www.php.net/manual/en/language.variables.variable.php

The problem is that $$fname[] is ambiguous and you need to
tell PHP what it means. The page above explains in more 
detail.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 04:01:36 2025 UTC