Jump to content

Archived

This topic is now archived and is closed to further replies.

Imtehbegginer

Selecting column values.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.