473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to display contents from mysql database in Order?

This is a part of a Social community that i am going to build in php.
This is same as the My friend list frame in Orkut,facebook etc.
how can i display the content in mysql database order by 3 colums and 3 rows.
Please help me...
Thanks in advance.
here is my code of my friends frame
userreg is the table name
id<>$id means-select all id of users except the logged persons id.

Expand|Select|Wrap|Line Numbers
  1. My Friends</h3>
  2.         <table width="29%"  height="277" border="1">
  3.         <?php $result= mysql_query("SELECT * FROM userreg where id<>'$id'")
  4.                 or die(mysql_error());  
  5.                   $count3=mysql_num_rows($result);
  6.                 while($count3>0)
  7.                 {
  8.                 $count3--;
  9.                 $row4= mysql_fetch_array($result);
  10.                 $y=$row4['username']; 
  11.                 $id=$row4['id']; 
  12.                 $toid=$id;
  13.                 ?>
  14.                <tr>
  15.                  <td height="89">&nbsp;</td>
  16.                  <td>&nbsp;</td>
  17.                  <td>&nbsp;</td>
  18.                </tr>
  19.                <tr>
  20.                  <td height="89">&nbsp;</td>
  21.                  <td>&nbsp;</td>
  22.                  <td>&nbsp;</td>
  23.                </tr>
  24.                <tr>
  25.             <td width="35%" height="89">
  26.             <?php 
  27.             echo "<a href='scrapbook.php?toid=$toid'>$y</a>";
  28.             ?>            </td>
  29.             <td width="33%">&nbsp;</td>
  30.             <td width="32%">&nbsp;</td>
  31.           </tr>
  32.           <?php }?>
  33. </table>
Apr 29 '10 #1
2 3475
chathura86
227 100+
you can use mysql ORDER BY to sort the result set

search for MySQL ORDER BY in google to get some idea about it

Regards
Apr 30 '10 #2
Thanks alot for the information..
Apr 30 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kostas | last post by:
Hi i have the following problem and i am breaking my mind on it: I have a mysql database with (id,title,topic,body) in the database i have stored some documents. How can i display a link with only...
4
by: danubian | last post by:
Hi, I'm a newbie in php/mysql programming,really am. I'm working on a web-site that allows registration and posterior logging in. Already registered user logs in with valid username and...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
8
by: yellow1912 | last post by:
Ok, lets say I have 1000 items in my database (mysql) and want to display X items per page. I learned to do it by querying with the LIMIT constrain (something like this...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
24
by: Phil Latio | last post by:
Let's say I have a simple web application running with just two MySQL tables. The tables structure is as follows: Table: category category_id (PK) category_name parent_category (FK)...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
5
Markus
by: Markus | last post by:
I'll leave out the annoying 'i'm a newbie' speech and get to the point: i'm a newbie at perl ;) First thing i ever wrote in perl and it doesnt work. I'm using xampp as my localhost - with perl...
1
by: chanshaw | last post by:
Alright so I got php running and installed i have mysql running and installed the thing im having a hard time with is having the php to call information from the mysql database. Im on Windows Vista...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.