Split query result into two part

Split query result into two part

am 09.01.2010 09:30:22 von bharani kumar

--001636e9087a816f76047cb71d1f
Content-Type: text/plain; charset=ISO-8859-1

Hi ,

Working in PHP,MYSQL project,

i have student table , i want to list the student name from the table,

the table contains around 10000 records,i want to display all this 10000
records into TWO Div,

I dont want to execute query twice,

image markup link here,

Image Markup


Assume if genral render means ,

After query executed , i will display use the wile loop then i returned all
the records from table,

But my requirement something different ,

In the Left hand side DIV , i want to print 5000 Records,

In the Right hand Side DIV , i want to print 5000 Records,

What is the Idea for this ,

Thanks

--001636e9087a816f76047cb71d1f--

Re: Split query result into two part

am 09.01.2010 16:27:11 von Don Read

On Sat, 9 Jan 2010 14:00:22 +0530 bharani kumar said:

> In the Left hand side DIV , i want to print 5000 Records,
>
> In the Right hand Side DIV , i want to print 5000 Records,
>
> What is the Idea for this ,
>
> Thanks

$div1str = $div2str = '';
$qry = 'SELECT name FROM students [ORDERED BY ...]';
$res = mysql_query($qry);
for ($cnt=0; $cnt < 5000; $cnt++) {
$row = mysql_fetch_array($res);
$div1str .= '
' .$row['name'];
}

while ($row = mysql_fetch_array($res))
$div2str .= '
' .$row['name'];

echo '

';
echo '';
echo '
', $div1str, '', $div2str, '
';

Regards,
--
Don Read don_read@att.net
It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Split query result into two part

am 09.01.2010 18:56:14 von Shawn Green

bharani kumar wrote:
> Hi ,
>
> Working in PHP,MYSQL project,
>
> i have student table , i want to list the student name from the table,
>
> the table contains around 10000 records,i want to display all this 10000
> records into TWO Div,
>
> I dont want to execute query twice,
>
> image markup link here,
>
> Image Markup
>
>
> Assume if genral render means ,
>
> After query executed , i will display use the wile loop then i returned all
> the records from table,
>
> But my requirement something different ,
>
> In the Left hand side DIV , i want to print 5000 Records,
>
> In the Right hand Side DIV , i want to print 5000 Records,
>
> What is the Idea for this ,
>
> Thanks
>

You would do it just as if you had 4 names to render in two divs. The
only thing that's different is the quantity of data you need to turn
into HTML:

name1
name2
name3
name4


How to get those divs to sit side-by-side within a parent div is an
exercise left to the student.

--
Shawn Green, MySQL Senior Support Engineer
Sun Microsystems, Inc.
Office: Blountville, TN



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org