Hi there, I am a newbie in PHP, hope someone who can help me with this.
I trying to check if the table is empty, then make a popup menu to confirm by user. If yes, to addnew menu. If no, back to home.
My codes like this as follows:
<?php
.....
$sql=sprintf("SELECT * FROM table");
pg_query($dbconnect, "begin");
$result=pg_query($dbconnect, $sql);
pg_query($dbconnect, "commit");
if (pg_num_rows($result) !=0) {
// variables = table records for displaying.
} else {
?>
<script language="JavaScript">
var agree="confirm("Please enter yes or no!");
if (agree)
windows.location="abc.html";
else
windows.location="home.html";
</script>
<?php
}
?>
......
There are something wrong, it is not working on run the javascript. someone please help!
Thanks