Solved

SQL

Posted on 2002-07-24
5
242 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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.  …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

777 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