Jump to content

Martn

New Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Martn

  1. Hi,

    My server is running PHP version 7.3

    I'm getting the error

    "Backend fatal error: PHP Fatal error: Uncaught Error: Call to undefined function mysqli()"

    on this code to open my DB :

    <?php
    $servername = "localhost";
    $username = "tester";
    $password = "@Tester@";
    $db = "test";
    // Create connection
    $conn = mysqli_connect($servername, $username, $password,$db);
    // Check connection
    if (!$conn) {
       die("Connection failed: " . mysqli_connect_error());
    }else {
       echo "Connected successfully";
       }
    ?>

    Can someone give me hint on the mistake I'm making ?

    Thanks.

     

  2. I have 2 PHP scripts : opendb.php and closedb.php

    In opendb.php I have this code :

    <?php
    session_start();
    $conn = mysqli_connect(................................);


    // Check connection
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    } else {
      echo "DB open.";
      $_SESSION['dbhandler'] = $conn;
    }
    ?>

    In closedb.php I have this code :

    <?php
    session_start();
    $conn = $_SESSION['dbhandler']
    mysqli_close($conn);
    echo "DB closed";
    ?>
     

    When I run opendb.php I get the expexted message "DB Open."

    But when running the closedb.php ,   I get an error 500.

    I was hoping to be able to pass the Handle, needed to operate in my database, between PHP scripts, by pushing it

    into $_SESSION['dbhandler'] , and retreiving it in other scripts.

    Is this possible ?

    Regards,

     

    Martin

  3. I'm trying my first PHP code :

     

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Contact Form</title>
    </head>
    <body>

    <?php
    echo "Hello world!";
    ?>

    </body>
    </html>

     

    Result : nothing, just a blank screen ...

    Am I missing something ?

     

    Regards,

    Martin

×
×
  • 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.