Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL

Posted on 2002-07-24
5
Medium Priority
?
278 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
3 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 152 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 148 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 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