Okay, so, this isnt exactly a comment issue, but what I'm trying to do is the same as doing somments..
I needed to make 2 sections on my site for my news/updates and comments, so I found the post PHP for Beginners: Building Your First Simple CMS and decided to give it a shot.
I got my comment section down no problem, but my updates wont seem to shoot. I've changed the names of the variables and matched them up (or so I thought,) but it's still not doing the updates..
I went into the database, and it's not even making the table in the database, so I even tried making the table by hand, and that still didn't work, if someone could help, I would be grateful..
btw, the link to my site is.. Makeshift Designs
<?php date_default_timezone_set('MST'); class upDate{ var $host; var $username; var $password; var $table;
public function display_update(){ $q = \"SELECT * FROM upDate ORDER BY created DESC LIMIT 10\"; $r = mysql_query($q); if($r !== false && mysql_num_rows($r) > 0){ while($a = mysql_fetch_assoc($r)){ $update = stripslashes($a['update']); $time = stripslashes($a['time']);
public function write($p){ if ($_POST['update']) $update = mysql_real_escape_string($_POST['update']); if ($_POST['time']) $time = mysql_real_escape_string($_POST['time']); if ($_POST){ $created = time(); $ip = $_SERVER['REMOTE_ADDR']; $sqll = \"INSERT INTO upDate VALUES('$update','$time','$created','$ip')\"; return mysql_query($sqll); }else{ return false; } }
public function Connect() { mysql_connect($this->host,$this->username,$this->password) or die(\"Could not connect. \" . mysql_error()); mysql_select_db($this->table) or die(\"Could not select database. \" . mysql_error());
return $this->BuildDB(); }
private function BuildDB() { $sqll = <<<MySQL_QUERY CREATE TABLE IF NOT EXISTS upDate ( update TEXT, time TEXT, created VARCHAR(100), ip TEXT ) MySQL_QUERY; return mysql_query($sqll); } }
well i don't know how to fix your issue. but I do have some advice. Do not quote serial killers on your website. Especially if you are trying to attract customers
actually, it has both.. I put in the error script, and it came up with an error of the connection resetting by peer, then after that, no errors. I tried it about 5 times.
I needed to make 2 sections on my site for my news/updates and comments, so I found the post
PHP for Beginners: Building Your First Simple CMS and decided to give it a shot.
I got my comment section down no problem, but my updates wont seem to shoot.
I've changed the names of the variables and matched them up (or so I thought,) but it's still not doing the updates..
I went into the database, and it's not even making the table in the database, so I even tried making the table by hand, and that still didn't work, if someone could help, I would be grateful..
btw, the link to my site is.. Makeshift Designs
See if you get any errors about the script not being able to connect to the database.