Solved

SQL

Posted on 2002-07-24
5
221 Views
Last Modified: 2006-11-17
my problem is
eg:
 name     testno
saliya  3
prasad  4
matara  5

i want to find using SQL Count saliaya has 3,prasad has 4 ...etc
please let me know how to do that using array
eg:
if array(0) it's should be saliya
echo array(0);//saliya 3
0
Comment
Question by:prasadharischandra
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
RQuadling earned 38 total points
ID: 7173929
"SELECT testno FROM table WHERE name=$Who"

Is the basic idea for a single name.


0
 
LVL 5

Assisted Solution

by:dkjariwala
dkjariwala earned 37 total points
ID: 7174288
Assuming

name,testno as fields of your table you can do it like,


//mysql connection stuff goes here.


$testno_arr = array();
$result = mysql_query("select testno,name from TABLENAME") or die('Can not execute query.');

while($array = mysql_fetch_row($result))
{
    print "Test no is " . $array[0];
    print "Name is : . $array[1];
    $testno_arr[] = $array[0];
}


Here $testno_arr will store the values of testno with indices starting from 0.

JD
 

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 7195624
Success? Anything else needed?
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now