iGuest 3 Report post Posted January 22, 2005 i made a mysql db class and now i want to make a function that parses the table into an array, i dont have that much php experience so can anyone help me? <?php if(!class_exists('cDB')) { class cDB { var $lDB; function cDB($name) { $this->lDB = mysql_connect(); mysql_select_db($name, $this->lDB); } function table($name) { //parse table array here } function __destruct() { mysql_close($this->lDB); } } }?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 1, 2005 i made a mysql db class and now i want to make a function that parses the table into an array, i dont have that much php experience so can anyone help me? <?php if(!class_exists('cDB')) { class cDB { var $lDB; function cDB($name) { $this->lDB = mysql_connect(); mysql_select_db($name, $this->lDB); } function table($name) { //parse table array here } function __destruct() { mysql_close($this->lDB); } } }?> Do you want to parse table, called $name, data? Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 1, 2005 i made a mysql db class and now i want to make a function that parses the table into an array, i dont have that much php experience so can anyone help me? <?php if(!class_exists('cDB')) { class cDB { var $lDB; function cDB($name) { $this->lDB = mysql_connect(); mysql_select_db($name, $this->lDB); } function table($name) { //parse table array here } function __destruct() { mysql_close($this->lDB); } } }?> Do you want to parse table, called $name, data? no i want to return the row where column is data in an array Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 1, 2005 no i want to return the row where column is data in an arrayok, maybe this will help$result = mysql_query('SELECT * FROM '.$name) or trigger_error(mysql_error(), E_USER_ERROR);$arr = array();while($row = mysql_fetch_assoc($result)){ $arr[] = $row;}strip($arr);Not completely sure, that this will work, as I cut it out of my sql class Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 1, 2005 i will test t later, thnx for the info Share this post Link to post Share on other sites