Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End help with Chatv2 script

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #194050
    Davies
    Participant

    Hi devs im actually having
    problem on how to make the chatv2 script work in wampserver/online sever please kindly explain the installation process.

    https://css-tricks.com/chat2/
    https://css-tricks.com/examples/Chat2.zip

    #194145
    Davies
    Participant

    This Is The Details I Typed In Dbcon.php (N.B- I’ve Created The Database And The User Before Inputing The Details.)

    <?php
    //Connection Page
    define(HOST, ‘localhost’);
    define(USERNAME, ‘dafe’);
    define(PASSWORD, ‘dafe26’);

    mysqli_connect( HOST, dafe, dafe26) or die(“Could not connect”);
    mysql_select_db (“chat2_db”)or die(‘Cannot connect to the database because: ‘ . mysql_error());

    //functions
    function checkVar($var)

    This Was The Result I Got From Wampserver

    ( ! ) Notice: Use of undefined constant HOST – assumed ‘HOST’ in C:\wamp\www\Chat2\dbcon.php on line 3
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5

    ( ! ) Notice: Use of undefined constant USERNAME – assumed ‘USERNAME’ in C:\wamp\www\Chat2\dbcon.php on line 4
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5

    ( ! ) Notice: Use of undefined constant PASSWORD – assumed ‘PASSWORD’ in C:\wamp\www\Chat2\dbcon.php on line 5
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5

    ( ! ) Notice: Use of undefined constant dafe – assumed ‘dafe’ in C:\wamp\www\Chat2\dbcon.php on line 7
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5

    ( ! ) Notice: Use of undefined constant dafe26 – assumed ‘dafe26’ in C:\wamp\www\Chat2\dbcon.php on line 7
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5

    ( ! ) Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\Chat2\dbcon.php on line 7
    Call Stack
    # Time Memory Function Location
    1 0.0000 138952 {main}( ) ..\jumpin.php:0
    2 0.0000 153968 require_once( ‘C:\wamp\www\Chat2\dbcon.php’ ) ..\jumpin.php:5
    3 0.0469 154608 mysql_connect ( ) ..\dbcon.php:7
    Cannot connect to the database because: Base ‘chat2_db’ inconnue

    #194175
    Anonymous
    Inactive

    While that’s true, and you really should correct it, I don’t think that’s why the code’s failing. You’re mixing mysqli and mysql functions. Don’t.

    #194196
    Senff
    Participant

    I’d say the error messages speak for themselves. Go through them one by one and see what they say.

    For example, on line 7 you have:

    mysqli_connect( HOST, dafe, dafe26) or die(“Could not connect”);
    

    One of the error messages is:

    ( ! ) Notice: Use of undefined constant dafe – assumed ‘dafe’ in C:wampwwwChat2dbcon.php on line 7
    

    With that, you can deduct that that line 7 should probably be:

    mysqli_connect( HOST, 'dafe', 'dafe26') or die(“Could not connect”);
    

    Having said that, that’s not what the original code is in the example on this site, AND as @BenWalker said, don’t mix up using mysql and mysqli, AND (not unimportant) the original code is already 5 years old. In some cases that can be an eternity.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.