selecting a column
Posted 10 May 2006 - 11:17 PM
But how do i select a whole column, so i would have the users name and their information.
And i would like for it to be displayed just simple like this:
Ph0enix England 14/03/1990 Male.
Could anyone help me to do this please?
Posted 10 May 2006 - 11:28 PM
Posted 10 May 2006 - 11:36 PM
But i find things easier to take in if you could tell me and give me an example cause im a noob.
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]PHP Newbie Help[/quote]
Could you explain it please?
Posted 11 May 2006 - 06:58 AM
a column goes this way
$sql = "SELECT * FROM table ORDER BY id DESC";
will select everything both ways in your table, in reverse numerical order, ordered by id.
if you want to select just one row, based on the user's id, then do this:
select * from table where userid = '1'
this will, for instance, select all the information where the user's id is 1. the idea is to put a variable in place of the 1, in order to dynamically retrieve data from the database. for instance:
$id = 1;
$sql = "select * from table where userid = '$id'";
the "*" is a wildcard that selects all the column data in the row you are selecting. you can select individual colums by naming them instead of the * like so (assuming you have a column named username):
$sql = "select username from table where userid = '$id'";
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users