The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

CMS + comments

  • # September 16, 2009 at 5:25 pm

    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’]);

    $update_display .= < <$time


    $update_display = < <Update

    Time: $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);
    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 = < <

    # September 17, 2009 at 1:19 pm

    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

    # September 17, 2009 at 7:35 pm

    The code snippet you’ve posted doesn’t look like it ever calls the Connect() method or the BuildDB() method. Try turning error reporting on:

    ini_set(“display_errors”, “2”);

    See if you get any errors about the script not being able to connect to the database.

    # September 17, 2009 at 9:06 pm

    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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed