PHP error

Gestart doorJordyvc5 reacties44 weergaven

6 berichten · pagina 1 van 1

Jordyvc

Lid · Topicstarter

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey

Ik heb deze error:

Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or { or $ in /home/jordyvc/domains/jordyvc.s3.one2xs.com/public_html/hosting/test/_class/simpleCMS.php on line 93


en dit is mijn script:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/class"]class[/URL] simpleCMS [COLOR= #007700]{

  var[/COLOR] [COLOR= #0000BB]$host[/COLOR][COLOR= #007700];
  var[/COLOR] [COLOR= #0000BB]$username[/COLOR][COLOR= #007700];
  var[/COLOR] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700];
  var[/COLOR] [COLOR= #0000BB]$table[/COLOR][COLOR= #007700];[/COLOR]

  [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] display_public[COLOR= #007700]() {[/COLOR]
    [COLOR= #0000BB]$q[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM testDB ORDER BY created DESC LIMIT 3"[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$r[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$q[/COLOR][COLOR= #007700]);[/COLOR]

    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$r[/COLOR] [COLOR= #007700]!==[/COLOR] false [COLOR= #007700]&&[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$r[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]) {[/COLOR]
      [URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$r[/COLOR][COLOR= #007700]) ) {[/COLOR]
        [COLOR= #0000BB]$title[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]title[/COLOR][COLOR= #007700]]);[/COLOR]
        [COLOR= #0000BB]$bodytext[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bodytext[/COLOR][COLOR= #007700]]);[/COLOR]

        [COLOR= #0000BB]$entry_display[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]<<<ENTRY_DISPLAY

    <div class="post">
        <h2>
            $title
        </h2>
        <p>
          $bodytext
        </p>
    </div>

ENTRY_DISPLAY[/COLOR][COLOR= #007700];
      }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
      [COLOR= #0000BB]$entry_display[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]<<<ENTRY_DISPLAY

    <h2> This Page Is Under Construction </h2>
    <p>
      No entries have been made on this page. 
      Please check back soon, or click the
      link below to add an entry!
    </p>

ENTRY_DISPLAY[/COLOR][COLOR= #007700];
    }[/COLOR]
    [COLOR= #0000BB]$entry_display[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]<<<ADMIN_OPTION

    <p class="admin_link">
      <a href="{$_SERVER[PHP_SELF]}?admin=1">Add a New Entry</a>
    </p>

ADMIN_OPTION[/COLOR][COLOR= #007700];[/COLOR]

    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$entry_display[/COLOR][COLOR= #007700];
  }[/COLOR]

  [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] display_admin[COLOR= #007700]() {[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]<<<ADMIN_FORM

    <form action="{$_SERVER[PHP_SELF]}" method="post">
    
      <label for="title">Title:</label><br />
      <input name="title" id="title" type="text" maxlength="150" />
      <div class="clear"></div>
     
      <label for="bodytext">Body Text:</label><br />
      <textarea name="bodytext" id="bodytext"></textarea>
      <div class="clear"></div>
      
      <input type="submit" value="Create This Entry!" />
    </form>
    
    <br />
    
    <a href="display.php">Back to Home</a>

ADMIN_FORM[/COLOR][COLOR= #007700];
  }[/COLOR]

  [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] write[COLOR= #007700]([/COLOR][COLOR= #0000BB]$p[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]title[/COLOR][COLOR= #007700]] )[/COLOR]
      [COLOR= #0000BB]$title[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]title[/COLOR][COLOR= #007700]]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bodytext[/COLOR][COLOR= #007700]])[/COLOR]
      [COLOR= #0000BB]$bodytext[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bodytext[/COLOR][COLOR= #007700]]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$title[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$bodytext[/COLOR] [COLOR= #007700]) {[/COLOR]
      [COLOR= #0000BB]$created[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]();[/COLOR]
      [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"INSERT INTO testDB VALUES($title,$bodytext,$created)"[/COLOR][COLOR= #007700];[/COLOR]
      [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
      [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
    }
  }[/COLOR]

  [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] connect[COLOR= #007700]() {[/COLOR]
    [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]localhost[COLOR= #007700],[/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]jordyvc_db[COLOR= #007700],[/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]wachtwoord[COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Could not connect. "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
    [URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]table[COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Could not select database. "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$this[/COLOR][COLOR= #007700]->[/COLOR]buildDB[COLOR= #007700]();
  }[/COLOR]

  [URL="http://www.php.net/private"]private[/URL] [COLOR= #007700]function[/COLOR] buildDB[COLOR= #007700]() {[/COLOR]
    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]<<<MySQL_QUERY
CREATE TABLE IF NOT EXISTS testDB (
title        VARCHAR(150),
bodytext    TEXT,
created        VARCHAR(100)
)
MySQL_QUERY[/COLOR][COLOR= #007700];[/COLOR]

    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);
  }

}[/COLOR]

?>


Kan iemand mij helpen?

Alvast bedankt!
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
html en php door elkaar? Als je weer met html begin sluit php dan eerst af smile
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
"$this->jordyvc_db" bestaat niet op die 93e lijn?
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Marjolein schreef:
html en php door elkaar? Als je weer met html begin sluit php dan eerst af smile
Dit werkt wel gewoon, het is alleen een vreemde manier van PHP programmeren die ik niet zou aanraden
0
Jordyvc

Lid · Topicstarter

Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand eigenlijk de oplossing? xd
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je hebt in de functie connect dingen aangepast, Als je gewoon localhost wilt hebben, moet je localhost doen, en niet $this->host vervangen in $this->localhost

mysql_connect(localhost, jordyvc_db, wachtwoord) or die("Could not connect. " . mysql_error());
    mysql_select_db(database) or die("Could not select database. " . mysql_error());


Als je het in het script wilt aanpassen moet je dat zo dan doen.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren