Same date not put in database using ajax and call php page If match then display the alret message "This Date already exists in databse" -


its ajax code:

$("#adata").click(function()  {var tmp;     tmp = "12354";     $.ajax({          type: "post", 

url: "some_page.php", data: "insertdate:insertdate,exercise_id:exercise_id,userid:userid,exctype:exctype", datatype:"html", async: false, success: function(data) {

            $('#datepickers').html(data);          }     });   }); 

});

this php file:some_page.php:

$conn=mysql_connect("localhost","root",""); mysql_select_db("fit2startdemo"); $query=mysql_query("select * jos_fitness_info insertdate = '$insertdate'");
if (mysqli_num_rows > 0) { echo "0"; //date exists }
else { echo "1"; //date not exists }

$('#adata').click(function() {     var tmp;     tmp = "12345";     $.ajax({          type:"post",         url: "some_page.php",         data:     {insertdate:insertdate,exercise_id:exercise_id,userid:userid,exctype:exctype}     }).done(function( msg ) {         alert(msg);         $('#datepickers').html( msg );     }); }); 

try

edit: in php code if date matches echo 'this date exists in databse' , don't insert, else insert it

edit:

the problem firstly trying send post data to, , retrieve response php page didn't exist. first port of call when callback function in ajax request isn't working whether or not it's communicating file (as if it's not .done() function never used it's not successful.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -