Jump to content

carter delRay

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About carter delRay

  • Rank
    Newbie
  1. I have already created mysql table with data, this is my javascript code <SCRIPT language="JavaScript">function send_status(){var status;var Digital=new Date()var hours=Digital.getHours()if (hours>=6&&hours<8) //on timestatus = "onTime";else if (hours>=8) //late comersstatus = "late";window.alert(status);}$.ajax({type: "POST",url: "ajaxjs.php",data: status,cache: false,success: function(html) {alert(html);}});}return false;}</SCRIPT> im attempting to generate a value for user status from th above if command in js then send this string into my db using ajax which is pointing to my php page <?php// Fetching Values From URL$connection = mysql_connect("localhost", "CJroot", ""); $db = mysql_select_db("mysql_practice", $connection); if (isset($_POST['typeahead'])) {$query = mysql_query("UPDATE user_signin SET status='$status' WHERE user_name = '$typeahead')"); //Insert Queryecho "Form Submitted succesfully";}mysql_close($connection); ?> im not getting it right please any suggestions?
×