473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Php code query

$top_category;
$top_subcategory;
$array_Itemid = array();
$query_main_menu= mysql_query("select * from mos_menu where menutype='category_menu' and parent=0 order by
ordering");
while($rs_main_menu = mysql_fetch_array($query_main_menu))
{

$array_Itemid[$rs_main_menu['id']] = array();
$array_Itemid[$rs_main_menu['id']][] = $rs_main_menu['id'];

N sum more code.
}

Can anyone tell me wht exactly this code do specially these lines

$array_Itemid[$rs_main_menu['id']] = array();
$array_Itemid[$rs_main_menu['id']][] = $rs_main_menu['id'];


thnx in advance
Nov 30 '06 #1
1 1243
[PHP]$top_category;
$top_subcategory;
$array_Itemid = array();
$query_main_menu= mysql_query("select * from mos_menu where menutype='category_menu' and parent=0 order by
ordering");
while($rs_main_menu = mysql_fetch_array($query_main_menu))
{

$array_Itemid[$rs_main_menu['id']] = array();
$array_Itemid[$rs_main_menu['id']][] = $rs_main_menu['id'];

N sum more code.
}[/PHP]

Can anyone tell me wht exactly this code do specially these lines

[PHP]$array_Itemid[$rs_main_menu['id']] = array();
$array_Itemid[$rs_main_menu['id']][] = $rs_main_menu['id'];[/PHP]


thnx in advance
Hi ..
Basically, its trying to create an associate multi-dimensional array .....
for example ..
[PHP]
// Inside the loop ..Lets suppose that the First value is ..

$rs_main_menu['id'] = "A1";

$array_Itemid[$rs_main_menu['id']] = array();

// In the above statement this value is used to define the key of the array...like..
$array_Itemid['A1'] = array();

$array_Itemid[$rs_main_menu['id']][] = $rs_main_menu['id'];
// Then in the next statement it assigns the value to the array ...like

$array_Itemid['A1'][0] = "A1";

// So for each row it will ...create the array elements[/PHP]

Hope I explained it clearly .....if any doubt ...feel free to ask
good luck ! :)
Nov 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: DBNovice | last post by:
I have a database that keeps records on the issue and failure of an item. Currently, the database is poorly desisned; therefore I'm performing queries to break the data into normalized tables and...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
9
by: Steve Jorgensen | last post by:
First, an example - today, I wanted to print out the parameter values in a querydef object at a break point in the code for subsequent manual debugging of the query. In the past, I would have had...
3
by: White Bilky | last post by:
A97. Simplified description: I have a query which returns one field containing numbers. I have a table where one field contains the same numbers as the query (amongst others). The query and...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
17
by: Liam.M | last post by:
Hey guys, Forgive me if my question my be alittle silly, but I would very much appreciate and assistance that could be given! My situation is as follows: I have created a Button, and set...
4
by: Rick | last post by:
Access2003 in XP I'm using the code below to append any new records from (tbl_From_Mainframe) into (tbl_Appended_Data). It takes more than a minute to search 7000 records for a dozen new records....
3
by: Hazza | last post by:
Hi, I am using PHP and mysql to create a website. I am fairly new to PHP, and thus am grateful to anyone who helps! Firstly I am running a homepage, that displays additional content if a user...
2
by: chromis | last post by:
Hi there, I've been reading an OOP book recently and it gives some nice Adaptor / Template patttern code to wrap around the php Mysql functions. I thought that I'd try and create a Simple Address...
0
by: savage678 | last post by:
Hi Everyone, I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection. I have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.