Sunday 15 May 2011

php - How to put an alert in jquery to know if an event that you want to add is already in the database or has a conflicting schedule with other events? -


I have a table of reserved events in DB with date, event_name, site, time-start and time-finishing. Now, when I want to book a new event, I first want to see that a certain place has already been captured on a date and timeframe.

This is what I have so far and it is not

   gt;) {echo 'true'; } Else {echo 'false'; }? & Gt; And check-site Php & lt ;? Php session_start (); ('Config1.php'); $ Sql ​​= "select placement of schedule WHERE site =". $ _ POST ['place'] "& amp; date =". $ _ POST ['Date'] ""; $ Select = mysql_query ($ sql); $ Line = mysql_num_rows (select $); If ($ line> gt;) {echo 'true'; } Else {echo 'false'; }? & Gt;    

First of all, you actually enter mysql _ * function :

This extension is deprecated as PHP 5.5.0, and will be removed in the future. Instead, MySQLi or PDO_MySQL extensions should be used.

Second, by inserting value directly into the query $ _ POST , like you are opening yourself in all types of injection attacks you need to make sure That you are avoiding any data to avoid properly.

The third (and possibly why it is not working at all), you're not quoting (possibly string) values, and when you are building your query, syntax errors are - After the variables, the integration operator (. ) is missing Before you save the file, Should be flagged

No comments:

Post a Comment