Jump to content


  • Posts

  • Joined

  • Last visited


About Lamez

  • Birthday 07/25/1990

Contact Methods

  • AIM
  • MSN
  • Website URL
  • Yahoo

Profile Information

  • Gender
  • Location

Lamez's Achievements

Advanced Member

Advanced Member (4/5)



  1. Okay before I continue any further, what do you think of this current design. It is not complete, but before I put a lot of time and effort into it I want to make sure it is worth finishing. http://phchurch.net/index.html If it looks like a good idea so far, the content and right box will need color\graphics, do something with the navigation and change the header and footer to different color\gradient\graphic.
  2. Thanks for the advice. What about the layout? Do you see fitting content of church related material in the website?
  3. I am horrible at creating websites, but I was asked to create one so here it is: http://phchurch.net/index.html Please tell me what you think, how can I make it look more "church-e". I want to present the best, so what do you guys think?
  4. Thanks for the suggestions. I am going to look at these. Google Chrome has built in Dev loper Tools and shows how to also increase speed. So that helps too.
  5. I am trying to optimize my website for speed as much as possible. However it is heavily database driven. Are there any ways to speed up each page request? Also I am closing each MySql connection after every page load. Here is my database class, is that a good idea? <?php //For changes, see: http://www.php.net/manual/en/mysqli.connect.php class Database{ var $mysqli, $result, $q, $affectedRows; function __construct($host, $user, $pass, $db){ $this->connect($host, $user, $pass, $db); } function connect($host, $user, $pass, $db){ $this->mysqli = new MySQLi($host, $user, $pass, $db); if(mysqli_connect_error()){ //Add Line to error handling system here... echo "Internal Site Error - Cannot Continue!"; exit; } } function clean(){ $str = $this->q; $str = @trim($str); if(get_magic_quotes_gpc()){ $str = stripslashes($str); } $this->q = mysqli_real_escape_string($this->mysqli, $str); } function execute($query, $mode = MYSQLI_STORE_RESULT){ $this->q = $query; $this->clean(); $result = $this->mysqli->query($query, $mode); if(is_object($result) && $result instanceof MySQLi_Result){//if result is a object and is part of the mysqli class? $this->result = $result; $this->affectedRows = $this->result->num_rows; }else $this->affectedRows = $this->mysqli->affected_rows; return $this; } function fetchRow(){ return $this->result->fetch_assoc(); } function fetchAll(){ /*$row = $this->result->fetch_all($mode); See manual for the mode under mysqli_result::fetch_all //return !empty($row) ? $row : array();//if not empty return row, else return an array? */ $row = array(); while($f = $this->fetchRow()){ $row[] = $f; } return !empty($row) ? $row : array(); } function numRows(){ return $this->affectedRows; } function delete($table, $where){ return $this->execute("DELETE FROM ".$table." WHERE ".$where); } function deleteAll($table){ return $this->execute("TRUNCATE ".$table); } function update($table, $set, $where){ return $this->execute("UPDATE ".$table." SET ".$set." WHERE ".$where); } function select($table, $select = "*", $where = NULL, $cap = ""){ if(is_null($where) || empty($where)) return $this->execute("SELECT ".$select." FROM ".$table." ".$cap); else return $this->execute("SELECT ".$select." FROM ".$table." WHERE ".$where." ".$cap); } function lastId(){ return $this->mysqli->insert_id; } function resetInc($table, $inc){ $this->execute("ALTER TABLE ".$table." AUTO_INCREMENT = ".$inc); } function error(){ return @mysqli_error($this->mysqli). " <strong><font color=\"red\">QUERY</font>: ".$this->q."</strong>"; } function close(){ @mysqli_close($this->mysqli); } function __destruct(){ $this->close(); } } $db = new Database(DB_HOST, DB_USER, DB_PASS, DB_DB); ?>
  6. lol I have never heard anyone call it a 'getter' before. I know what you mean, an accessor. Thanks!
  7. @OOP: Okay, I was having trouble a while ago, but I had the variables set as private, then I was getting an error saying that it was not a property of FootballPool. I just tried what you suggested and it worked. So if in the base class, the property that I am trying to access has to be protected and above? If private, it only belongs to the base, or that class?
  8. I am working on my Pool class (base) and my FootballPool class (derived). I have this as my constructor Pool.php protected $pid, $uid, $pkid, $name; function __construct($pid, $uid){ $this->pid = $pid; $this->uid = $uid; $this->pkid = $this->pkid(); if(isset($_SESSION['picksInfo']['name'])) $this->name = $_SESSION['picksInfo']['name']; else $this->name = NULL; } Now a function in my FootballPool class needs to call $pid, $uid, and $pkid. How can I do that? I have tried this: Pool::$pid, but then I get this error I am confused, because in the parents constructor, it is set. So basically, how can I call a variable set in the base class from a child or derived class?
  9. How come I cannot do this? define('IMG_EXT', array("jpg", "jpeg", "png", "gif", "bmp", "tif"), true);
  10. I am in a technical writing class and we are required to do some research over a chosen topic, I chose Internet addiction. I was wondering if you guys would help me with on getting some statistics, would you guys please do this survey? There is only five questions and the first one is the only required one. http://www.surveymonkey.com/s/6SBJRWP Hey, thanks for even looking!
  11. Pull the drive out, plug it into your desktop as a slave, scan the drive and remove files. Are you sure it is a virus and not a bad configuration?
  12. After quick thought, I figured it out. I have tested it and it seems to work, here is how I solved my problem: function fetchRow(){ return $this->result->fetch_assoc(); } function fetchAll($mode = 'MYSQLI_ASSOC'){ /*$row = $this->result->fetch_all($mode); */ //return !empty($row) ? $row : array();//if not empty return row, else return an array? $row = array(); while($f = $this->fetchRow()) $row[] = $f; return !empty($row) ? $row : array(); } Any suggestions? Note: I also don't code with double spaces. I am using Linux and I think it might have something to do with the text-encoding, but I am not sure.
  13. Nope says not found. I guess I will be writing my own. Gosh it has been a while since I had to do this, I might be back for help. Lol, lets see how far I can get.
  14. That is cool, so say if my application is using PostgreSQL I could use the PDO functions, then I all of a sudden switch back to mysql I could use the same functions? That would be real handy when using my Database class.
  • 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.