Posted on 2002-07-24
Last Modified: 2006-11-17
my problem is
 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
if array(0) it's should be saliya
echo array(0);//saliya 3
Question by:prasadharischandra
  • 2
LVL 40

Accepted Solution

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

Is the basic idea for a single name.


Assisted Solution

dkjariwala earned 37 total points
ID: 7174288

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.


LVL 40

Expert Comment

ID: 7195624
Success? Anything else needed?

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

910 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

24 Experts available now in Live!

Get 1:1 Help Now