vendredi 29 avril 2016

if statement in a php code

I have a code that will display data in a table form. there is a field called value that will store some values. I need to have an if statement that will force a window to popup whenever the value exceeds 30. I have an if statement that is not working. can anyone help ??

this is the code I used

<?php

$link = mysql_connect("localhost", "root", "");
$select= mysql_select_db("");
mysql_select_db("form");


$query = mysql_query("SELECT * FROM demo ORDER BY parameter ASC");
$record = mysql_fetch_array($query);
echo "<table border=1
<tr>
<th>Record ID</th>
<th>Parameter</th>
<th>Value</th>
<th>Time</th>

</tr>";
$con = mysql_connect("localhost", "root", "");
//$query = "select * from demo";

$query1 = mysql_query("Select * from demo where parameter = \"conductivity\"");
    while($row = mysql_fetch_array($query1)){

        echo " <tr><td>" . $row["recordID"] . "</td><td>" . $row["parameter"] . "</td><td>" . $row["value"] . "</td><td>" . $row["time"]  . "</td><tr>";

    }

if ("value">"30"){
echo "<script>alert('Alert');</script>";
}



echo "</table>";



mysql_close($link);



?>

Aucun commentaire:

Enregistrer un commentaire