jpergega Posted March 16, 2014 Share Posted March 16, 2014 Hi I am trying to create an alert box to connect to one of mysql table and the field is called "Finish", data type is Date. When a task is expired I would like to have a popup message to alert the user to say the task is expired. Here is the code which I am not able to get it to work is given me an error message, that is the code in red bold. I would be really grateful if someone can tell me what I'm doing wrong here please? Thanks ( ! ) Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:wampwwwScholarGoalTrackerstudentAccount.php on line 96 <?php $curdate = date('m/d/y'); $query4 = 'select finish from task WHERE account_id =$account_id"'; $result4= mysqli_query($con, $query4); while($row = mysqli_fetch_array($result4)){ if($row['finish'] == $curdate) { echo '<script language="javascript">alert("Your task had been expired.")</script>'; } } ?> Link to comment Share on other sites More sharing options...
Don E Posted March 16, 2014 Share Posted March 16, 2014 Are you connecting to a database anywhere in the code? Also, make sure your query is correct. Link to comment Share on other sites More sharing options...
Ingolme Posted March 16, 2014 Share Posted March 16, 2014 The query is wrong. $account_id is literally being interpretted as "$account_id" because you've wrapped the string in single quotes. Aside from that, the double quote at the end of the string is a syntax error for MySQL. I don't see where the value of $account_id is being set, but you might be at risk of SQL injection. Link to comment Share on other sites More sharing options...
Don E Posted March 16, 2014 Share Posted March 16, 2014 The query is wrong. Right. I was hinting that he should look at that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now