[:en]SQL: Change databases[:]

[:en]Change to any database after login:


connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

// Change character set to utf8
mysqli_set_charset($conn,"utf8");

// Change Time Zone
date_default_timezone_set("Asia/Hong_Kong");

// Select database
$dbname = $_GET['dbname'];
mysqli_select_db($conn,"$dbname");


$FirstName = date("Y-m-d");
$LastName = date("h:i:sa");
$dayofweek = $_GET['Street'];
$City = $_GET['City'];
$State = $_GET['State'];




$sql = "INSERT INTO absence (B,C,D,E,F)
        SELECT '$FirstName','$LastName',D,F,G from student
       WHERE  
       (E LIKE '%$dayofweek%' AND K='active')
       OR (F LIKE '%$dayofweek%'AND K='active')";
      
 
if ($conn->query($sql) === TRUE) {
    echo "New record created successfully".$dayofweek;
} else {
    echo "Error: " . $sql . "
" . $conn->error; } ?>

[:]

Print Friendly, PDF & Email
Scroll to Top