fp=fopen($file_id,'w'); fwrite ($this->fp,$html); fclose($this->fp); } /***************************************** ** method to append content to an html ** content template file. *****************************************/ function append_file ($file_id,$html) { $this->fp=fopen($file_id,'a'); fwrite ($this->fp,$html); fclose($this->fp); } /***************************************** ** method to open a MySQL database *****************************************/ function dbase($dbhost,$dbuser,$dbpass,$select) { $this->open=mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error); $this->seldb=mysql_select_db($select); return $this->open; return $this->seldb; } /***************************************** ** method to process a query ** from a MySQL database *****************************************/ function query($sql){ $this->info_array=mysql_fetch_array(mysql_query($sql)); return $this->info_array; } /***************************************** ** method to process a query loop ** from a MySQL database *****************************************/ function query_simp($sql){ $this->open=mysql_query($sql) or die (mysql_error()); return $this->open; } /***************************************** ** method to re-iterate content from the ** database retrieve file array variable *****************************************/ function data_file ($file_id,$table,$field,$text) { $max="select MAX($field) from $table"; $see=mysql_fetch_row(mysql_query($max)); $num=mysql_num_rows(mysql_query($max)); for ($i>0;$i<=$see[0];$i++){ $sql="select * from $table where $field='$i'"; $get=mysql_fetch_array(mysql_query($sql)); if ($get[$field]==""){ $html=""; }else { $html=$text."
\n"; } $this->fp=fopen($file_id,'a'); fwrite ($this->fp,$html); fclose($this->fp); } } /***************************************** ** This method takes the MySQL table rows ** and lays them out in desending order by ** date and in pages # rows a page. *****************************************/ function data_table ($file_id,$page,$table,$id,$field,$text) { $sql="select MAX($id) from $table"; $nsql="select * from $table"; $see=mysql_fetch_row(mysql_query($sql)); $num=mysql_num_rows(mysql_query($sql)); print (""); for ($i=($see[0]-$page);$i>0;$i--){ $isql="select * from $table where $id='$i'"; $get=mysql_fetch_array(mysql_query($isql)); if (($get[$id]=="")||($get[$field]=="")){ $html=""; }else { $html="\n"; } $this->fp=fopen($file_id,'a'); fwrite ($this->fp,$html); fclose($this->fp); } } /********************************************* ** This is a method to retreive items from ** ** a MySQL DB to place in a page # items per** ** page in descending order. ** ** Specifically for HIM Prayer page. ** *********************************************/ function count_rows_min($rows,$records) { $this->count=($records-$rows); return $this->count; } function count_rows_plus($rows,$records) { $this->count=($records+$rows); return $this->count; } function query_num_rows($sql) { $num=mysql_fetch_row(mysql_query($sql)); $result=$num[0]; $this->count=$result; return $this->count; } function query_list($rows,$records) { print ('
".$text.$get[$id]."\">".$get[$field]."
'); for ($i=$records;$i>($records-$rows);$i--) { $sql="select * from prayer_prayer where id='$i' and posted='1'"; $sha=$this->query($sql); print (""); print (""); print (""); } $result="select * from prayer_prayer where posted='1'"; $test=$this->query_num_rows($result); print ("
" . $sha["id"] . "" . $sha["prayer_date"] . "
" . $sha["subject"] . "

   " . $sha["body"] . "

"); $previous=$this->count_rows_plus($rows,$records); $next=$this->count_rows_min($rows,$records); if ($previous > $test) { print (" >>NEXT>> "); }else { print (" <"); print (" >>NEXT>> "); } print ("
"); return null; } } ?> SFVFC LAPD Clergy Councils Friday, April 29, 2016
LAPD Clergy Council