Php不打印数据库信息

I just set up a mysql data base, although my php isn't printing out the information that I want printed.

Here's what my code looks like (I've already connected to mysql and created a database successfully, I just need it to print out what I had inserted into it):

// will insert into the table
mysqli_query ($con, "INSERT INTO alarms(Title, Description, DT)
VALUES(getSucked, Agha will smd, 2013-08-05 00:15:12)");

//will print out what we just insert into the table, ie agha smd's
$result = mysqli_query($con,"SELECT * FROM alarms");
while ($row = mysqli_fetch_array($result))
{
echo $row['alarmID'] . " <br> " . $row['Title'] . " <br> " . $row['Description'] . " <br> " . $row['DT'];
}

//closing connection
mysqli_close($con);
echo "<br><br>connection has been closed";

The warning/error I keep getting is:

"Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in B:\DropBox\Dropbox\EbadlyAgha\Ebademinders.php on line 83"

Line 83 is where the while loop begins.

mysqli_query returns FALSE on failure.

try

if ($result) {
    while ($row = mysqli_fetch_array($result))
    {
    echo $row['alarmID'] . " <br> " . $row['Title'] . " <br> " . $row['Description'] . " <br> " . $row['DT'];
    }
}

Change your Insert query to

mysqli_query ($con, "INSERT INTO alarms(Title, Description, DT)
VALUES('getSucked', 'Agha will smd', '2013-08-05 00:15:12')");

Your Insert query will fails when you gave the spaces.Try to put them in quotes..

Use

mysqli_query ($con, "INSERT INTO alarms(Title, Description, DT)
VALUES(getSucked, 'Agha will smd', '2013-08-05 00:15:12')");

and try to echoed query and run into phpmyadmin.because your value is with space so you have to use it in ''.

Your query failed to run. mysqli_query will return false if the query does not execute, hence the warning of mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given. You should always check the return value when interacting with the database, to make sure you are aware of what's going on. PHP will happily coerce many types into other types silently, so you have to be very proactive in your error checking.