Jump to content


Photo

Selecting column values.


  • Please log in to reply
1 reply to this topic

#1 Imtehbegginer

Imtehbegginer
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts

Posted 13 October 2006 - 10:16 PM

Hi guys,

I am developing a script for a friend, and im creating a sort of admin script, and in the mysql database, the column 'accesslevel' has to be 300 for you to access it.

Can someone write a little code to show meh how to do it?

Thanks.

#2 fezzik

fezzik
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 13 October 2006 - 10:53 PM

Is the user(admin) to have an 'accesslevel' associated with him/her which allows them access to certain information in the database or are you looking to retrieve all database rows where a column called 'accesslevel' has a value of 300?

If it is the latter then you will need something like:

$result = mysql_query("select * from table_name where accesslevel = 300");
while($row = mysql_fetch_array($result)) {
// reference either the column name: $row['email'] or column number: $row[0]
echo $row['column_0'];
echo $row['column_1'];
echo $row['column_2'];
echo $row['column_3'];
}

If provide more information I can probably be of more assistance.

Cheers,

Fezzik




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users