473,406 Members | 2,713 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,406 software developers and data experts.

how do I search two-dimiensional results set array

Here's the pertinent code to get the SQL results. It is generated by
dreamweaver adn I'm trying to learn to code php so I don't depend on DW to
do it for me.

$query_rsSummary = "SELECT sid, Count(wid) FROM plotting GROUP BY sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or die(mysql_error());
$row_rsSummary = mysql_fetch_assoc($rsSummary);
How do I search the array to see if a certain "sid" has an entry in the
array?

Thanks!
Jul 17 '05 #1
5 1870
"NotGiven" wrote:
Here’s the pertinent code to get the SQL results. It is
generated by
dreamweaver adn I’m trying to learn to code php so I don’t
depend on DW to
do it for me.

$query_rsSummary = "SELECT sid, Count(wid) FROM plotting GROUP BY
sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or
die(mysql_error());
$row_rsSummary = mysql_fetch_assoc($rsSummary);
How do I search the array to see if a certain "sid" has an entry in the
array?

Thanks!


There is an example here for searching multi-dim arrays
http://us4.php.net/manual/en/function.array-search.php

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-search-d...ict144404.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=483158
Jul 17 '05 #2
In article <4l*******************@bignews5.bellsouth.net>, NotGiven wrote:
Here's the pertinent code to get the SQL results. It is generated by
dreamweaver adn I'm trying to learn to code php so I don't depend on DW to
do it for me.

$query_rsSummary = "SELECT sid, Count(wid) FROM plotting GROUP BY sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or die(mysql_error());
$row_rsSummary = mysql_fetch_assoc($rsSummary);
How do I search the array to see if a certain "sid" has an entry in the
array?


Why would you do the searching if you can let MySQL do the searching for
you?

Get yourself a book on databases (sql) and read all you can on the WHERE
clause ;)

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
Jul 17 '05 #3
This is not really a SQL problem. I need the fuill result set. I just
needed to figure out how to loop through the result set in the php code to
display results for each main ID. I'll post the solution a little later.
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:2p************@uni-berlin.de...
In article <4l*******************@bignews5.bellsouth.net>, NotGiven wrote:
Here's the pertinent code to get the SQL results. It is generated by
dreamweaver adn I'm trying to learn to code php so I don't depend on DW to do it for me.

$query_rsSummary = "SELECT sid, Count(wid) FROM plotting GROUP BY sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or die(mysql_error()); $row_rsSummary = mysql_fetch_assoc($rsSummary);
How do I search the array to see if a certain "sid" has an entry in the
array?


Why would you do the searching if you can let MySQL do the searching for
you?

Get yourself a book on databases (sql) and read all you can on the WHERE
clause ;)

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>

Jul 17 '05 #4
"NotGiven" <no****@nonegiven.net> wrote in message
news:4l*******************@bignews5.bellsouth.net. ..
Here's the pertinent code to get the SQL results. It is generated by
dreamweaver adn I'm trying to learn to code php so I don't depend on DW to
do it for me.

$query_rsSummary = "SELECT sid, Count(wid) FROM plotting GROUP BY sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or die(mysql_error());
$row_rsSummary = mysql_fetch_assoc($rsSummary);
How do I search the array to see if a certain "sid" has an entry in the
array?


You may find aliases invaluable, especially when working with group by
functions:-

$query_rsSummary = "SELECT sid, Count(wid) AS c_wid FROM plotting GROUP BY
sid";
$rsSummary = mysql_query($query_rsSummary, $tableG) or die(mysql_error());

http://www.php.net/manual/en/functio...etch-assoc.php

while($row = mysql_fetch_assoc($rsSummary))
{
if($row['sid'] == 'whatever')
{
printf("SID %s occurs %s times in this data",
$row['sid'],
$row['c_wid']);
}
}
Jul 17 '05 #5
If you just need to know if the data requested is present at all you
could try this: http://us4.php.net/manual/en/function.in-array.php

t samu

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-search-d...ict144404.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=483159
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

67
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod...
16
by: Stanley Sinclair | last post by:
Bear with me. I am being very calm; took a Valium. I have waited two weeks to write this, because every time I wrote it before the message was, at best, nasty. I need to use the services of...
2
by: TH | last post by:
I am (still :) working on a recipe database. Now I am trying to figure out how to set it up for an ingredient search. What I want it to be able to do is to search by one ingredient, sometimes by...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
3
by: jdworley | last post by:
Howdy! The search is a 1 GB+ file from a crash to be exact - had an e-mail correspondence (window) hopefully in it so I saved the file on reboot before windoze kicked in and want to open and...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
10
by: JohnR | last post by:
I have an arraylist of string values. I would like to search the arraylist to find the index of a particular string and I would like the search to be case insensitive. dim al as new arraylist...
2
by: Noticedtrends | last post by:
Are there search-engine utilities that allow searches of content only contained in titles (as opposed to regular searches that search through all content)? Would any of these search-engine...
1
by: Noticedtrends | last post by:
Hello, I'm seeking search-engine utilities that allow searches of content only contained in titles (as opposed to regular searches that search through all content)? The tools provided in...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.