Jump to content

Recommended Posts

I more familiar with PHP, but perhaps you guys can help me figure out what is going on with this code....

 

 

there is a section here.... that fetches the results from a mysql query...

 

---

 

--

Code

 

while ($sth->fetch) {

    $dbs{$row[0]} = {};

    $dbs{$row[0]}->{props} = [@row];

# print join(",", @row), "<BR>\n"; # 1,CELCAT,?,4,Sybase

}

 

 

now from my understanding here....

 

$dbs[$row[0]] = {}; - that makes it an empty array? an initializer of it..

 

 

$dbs{$row[0]}->{props} = [@row]; - now does this fill in the results into an element called props...

 

if you guys can explain in detail what exactly is going on here, it will help me a lot. :)

Link to comment
https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/
Share on other sites

How do these pointers work?

 

	$dbs{$db}->{tbls}->{$tbl[0]} = {};
	$dbs{$db}->{tbls}->{$tbl[0]}->{props}	= [@tbl];
	$dbs{$db}->{tbls}->{$tbl[0]}->{flds} 	= [];
	$dbs{$db}->{tbls}->{$tbl[0]}->{fnc_pre} = [];
	$dbs{$db}->{tbls}->{$tbl[0]}->{fnc_pst} = [];
	$dbs{$db}->{tbls}->{$tbl[0]}->{cols} 	= [];

$dbs[$row[0]] = {}; - that makes it an empty array?

 

It creates a reference to an (empty) anonymous hash.

 

$dbs{$row[0]}->{props} = [@row]; - now does this fill in the results into an element called props...

 

It creates an anonymous array reference in "props," which is filled with the contents of @row.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.