Ik heb net die tut zitten lezen op phpbuilder en nu ben ik gaan proberen.
Ik heb nu dit als classes.php:
En dit als index.php:
Het probleem is nu dat die dit als echo van de sql geeft:
SELECT FROM cs_login ORDER BY LIMIT 0,
Ik heb nu dit als classes.php:
PHP:
1
| <?class print_memberlist { var $aantal; var $selects; var $order; function set_aantal($new_aantal) { $this->$aantal = $new_aantal; } function return_aantal() { return $this->$aantal; } function set_selects($new_selects) { $this->$selects = $new_selects; } function return_selects() { return $this->$selects; } function set_order($new_order) { $this->$order = $new_selects; } function return_order() { return $this->$order; } function print_list() { $sql = "SELECT $this->selects FROM cs_login ORDER BY $this->order LIMIT 0,$this->aantal"; echo $sql . "<br>" . $this->return_order(); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { while(list($key,$var) = each($row)) { echo $var . " - "; } echo "<br>\n"; } }}?> |
En dit als index.php:
PHP:
1
| <? $dbhost = "localhost";$dbname = "chatstar";$dbuser = "chatstar";$dbpasswd = "brothers";$db = mysql_connect("$dbhost", "$dbuser", "$dbpasswd");mysql_select_db("$dbname",$db);include("classes.php");?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title>Untitled</title></head><body><?$REG_AANTAL = 10;$REG_SELECTS = "star_id, star_usernaam, star_email";$REG_ORDER = "star_usernaam ASC";$ml = new print_memberlist();$ml -> set_order($REG_ORDER);$ml -> set_aantal($REG_AANTAL);$ml -> set_selects($REG_SELECTS);$ml -> print_list();?></body></html>?> |
Het probleem is nu dat die dit als echo van de sql geeft:
SELECT FROM cs_login ORDER BY LIMIT 0,
www.dannyhiemstra.nl