Jump to content

Recommended Posts

ok i need the little code to could the users in order i have the

the data already being displayed from the database but I want it in order on how the user joins like look how it goes

1

14

7

8...

 

I want it to go

1

2

7

8

9

10....

and keep in that order I displayed the database like

 

$query="SELECT * FROM bl_admin ";

 

 

 

1 	-username-
14 	-username- username@hotmail.com
7 	- username- username@hotmail.co.uk
8 	-username- username@yahoo.com
9 	-username- username@gmail.com
10 	-username- username@yahoo.com
11 	-username- username412@aol.com
12 	-username- username@hotmail.com
13 	-username- username@yahoo.com

 

also I want to count the users in the database like

 

You have XX registered users.

Link to comment
https://forums.phpfreaks.com/topic/49884-count-in-order/
Share on other sites

Let's assume your table looks like:

id int autoincrement,

username varchar,

email varchar

 

You could do something like

$query="SELECT * FROM bl_admin ORDER BY id ASC"; to pull the results in order of IDs

 

Then to count the users you could do something like

$q = mysql_query("SELECT COUNT(id) FROM bl_admin");

$q = mysql_fetch_row($q); //http://php.net/mysql_fetch_row

echo "You have {$r[0]} registered users.";

Link to comment
https://forums.phpfreaks.com/topic/49884-count-in-order/#findComment-244708
Share on other sites

ok well i guest I should try at lease just getting it handed to me isn't going to teach me anything

 

would i change

$query="SELECT * FROM bl_admin";

to

$query="SELECT * FROM table(adminid) bl_admin ORDER BY id ASC";

 

is that it and im kinda confused on the [where conditions] and [limit starting row, number of rows]...could someone explain please

Link to comment
https://forums.phpfreaks.com/topic/49884-count-in-order/#findComment-244789
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.