Jump to content

[SOLVED] Selecting values from a mysql table


Demonic

Recommended Posts

Alright I have a table called "general"

 

upl6026516604.jpg

 

There aren't any unique id's, is there a faster way of getting all the options and values from the generals table without having to define the name and using a foreach e.g..:

 

pseudo

$array = array();

$fields = array('domain','download_index',..etc.);

foreach($fields as $field) {

select blah from blah and append to the $array[$field] = $value

}

 

Is there a faster way of doing this?

You just want to display everything from the "option" field? It's as simple as this:

 

<?php

$query = mysql_query("SELECT option FROM table")or die(mysql_error());

while ($row = mysql_fetch_assoc($query)){
   echo $row['option'] .'<br />';
}

?>

Archived

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

×
×
  • 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.