Solved

SQL

Posted on 2002-07-24
5
248 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:
Richard Quadling 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:Richard Quadling
ID: 7195624
Success? Anything else needed?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to use Initialization Vector for openssl_encrypt() 5 58
mysql query for sum() 3 28
Undefined variable problem 5 22
Php logic to add to date card 9 19
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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 dynamically set the form action using jQuery.

856 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