php current location ID

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
User avatar
nadi
New php-forum User
New php-forum User
Posts: 9
Joined: Sun Mar 04, 2012 11:19 pm

Wed Oct 03, 2012 8:04 pm

:help: :help: :help: :help:
Picture1.png
Picture1.png (65 KiB) Viewed 1160 times
how to get the current location for student. base on id.
as u can see from my table which is Arnold current location is no 3 and krish is no 4.
let say i delete the Arnold then krish will replace the current location of Arnold is no 3.

kindly please advise.
:oops: :oops: :oops:

sorry for ma bad eng.

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Thu Oct 04, 2012 1:26 pm

You know what you want, just ask the database for it. There are several ways to query the database and i'll let you pick your favorite, but your sql query will be something like:

Code: Select all

SELECT id from table where name='Whatshis Face'
Where whatshis face is the name of the person whose id you want returned.

User avatar
nadi
New php-forum User
New php-forum User
Posts: 9
Joined: Sun Mar 04, 2012 11:19 pm

Thu Oct 04, 2012 5:44 pm

ai thank...but i still blur and don't get it, i try using as below but it juz show id number...what i need give id become continues number.
in my table u can see some id number got 14, 31,32....
and i want to display it will be exactly like 1,2,3,4......for 14 it will be no 6, 31 will be no 7...


i try search by how to get my current location query..but i think i make it wrong..
:oops: :oops: :oops: :oops: :oops:

please correct me..^_^..

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Fri Oct 05, 2012 7:45 am

I'm sorry if i'm not understanding, but I think what you're looking for is ORDER BY. so your query (assuming you're doing a select all, would be like:

Code: Select all

SELECT * FROM table WHERE condition=true ORDER BY id ASC

Post Reply