私がこれを解決できたら、私はのろわれます。私はあまりにも長い間それを見てきました。
変数テーブルと順序が設定されておらず、フィールドを配列にプッシュしていません。誰もここで何かを見つけることができますか?
ページ
<?php
$table = new table;
$table->table = "db_firstaid";
$table->order = "aid_date";
$table->field("aid_id","false",NULL);
$table->field("aid_patient","true","[F]");
$table->field("aid_aider","true","[F]");
$table->field("aid_date","false","[F]");
$table->field("aid_time","false","[F]");
$table->table();
?>
クラス
<?php
class table{
/* Connect */
private $salt = '#######'
private $user = '#######'
private $pass = '#######'
private $host = '#######'
private $data = '#######'
private $db = '';
private $link = NULL;
private function connect(){
$this->link = mysql_connect($this->host, $this->user, $this->pass);
if(!$this->link){
die("<script type=\"text/javascript\">notyfy({text:'Error, could not connect to server.',type:'error',timeout:7000,});</script>");
}
$this->db = mysql_select_db($this->data,$this->link);
if(!$this->db){
die("<script type=\"text/javascript\">notyfy({text:'Error, could not connect to database.',type:'error',timeout:7000,});</script>");
}
}
private function disconnect(){
mysql_close($this->link);
}
/* Push fields into array */
private $fields = array();
public function field($f,$aes,$t){
return $this->fields[] = array($f,$aes,$t);
}
/* Compile SQL string */
public $table = '';
public $order = '';
private $sql = '';
private function genSQL(){
foreach($this->fields as $f){
if($f[1] == 'true'){
$this->sql = $this->sql . "AES_DECRYPT(".$f[0].",'[SALT]') AS ".$f[0].", ";
}else{
$this->sql = $this->sql . $f[0].", ";
}
}
$this->sql = substr($this->sql,0,-1);
$this->sql = "SELECT ".$this->sql." FROM ".$this->table." ORDER BY ".$this->order;
}
/* Query Database */
private $result = '';
private $number = '';
private function query(){
$this->genSQL();
$this->result = mysql_query($this->sql,$this->link) or die(mysql_error());
$this->number = mysql_num_rows($this->result);
}
/* Echo Table */
public function table(){
$this->connect();
$this->query();
if($this->number > 0){
while($row = mysql_fetch_array($this->result)){
echo "<tr class=\"selectable\">";
//Ignore this bit, yet to build.
echo "</tr>";
}
}
$this->disconnect();
}
}