Tek bir mysqli_result içinde birden fazla sorgu

0 Cevap php

I'm wondering how I would go about running two separate queries within one mysqli_result. What I have here is obviously broken. Any help is very much appreciated.

<?php 
$dbc=mysqli_connect("localhost", "XXXXX", "xxxx", "XXXXXXXX")
            or die('Error connecting to MySQL server.');

$Query = 'CREATE TABLE table_name (
    user_id INT AUTO_INCREMENT,
    username VARCHAR(32), 
    password VARCHAR(40),
    join_date DATETIME,
    first_name VARCHAR (32),
    last_name VARCHAR (32),
    gender VARCHAR (1),
    birthdate DATE,
    city VARCHAR(32),
    state VARCHAR(2),   
    picture VARCHAR(32),
    PRIMARY KEY(user_id)

    )";

INSERT INTO table_name VALUES (1, 'sidneyk', SHA('sidney'), '2008-06-03 14:51:46', 'Sidney', 'Kelsow', 'F', '1984-07-19', 'Tempe', 'AZ', 'sidneypic.jpg')";
INSERT INTO table_name VALUES (2, 'nevilj', SHA('nevil'), '2008-06-03 14:52:09', 'Nevil', 'Johansson', 'M', '1973-05-13', 'Reno', 'NV', 'nevilpic.jpg')";
INSERT INTO table_name VALUES (3, 'alexc', SHA('alex'), '2008-06-03 14:53:05', 'Alex', 'Cooper', 'M', '1974-09-13', 'Boise', 'ID', 'alexpic.jpg')";

if(mysqli_query($dbc, $Query)) {
    print("The query was successfully executed!<br />");
} else {
    print("The query could not be executed!" . mysql_error());
}

mysqli_close($dbc);

>

0 Cevap