Jump to content

[SOLVED] Foreach and MySql


zackcez

Recommended Posts

Well here's my current code:

	$getFeatures = $db->query("SELECT * FROM features WHERE product='1'");
	$feature       = mysql_fetch_array($getFeatures);
	$features     = array($feature['text']);
	foreach ($features as $featuree) {
	    echo"<li>$featuree</li>";
	}

Any one have any suggestions :s?

Link to comment
https://forums.phpfreaks.com/topic/117238-solved-foreach-and-mysql/
Share on other sites

$features = mysql_fetch_assoc($result);

 

should give you someting like:

 

array(

0 => array(

  'rowfield' => 'rowvalue'

)

);

 

another option is the Iterator class as found in the PHP Standard PHP Library (SPL):

http://www.php.net/~helly/php/ext/spl/

 

or:

http://be.php.net/spl

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.