(URGENT)how i can change tinyint after done the process?


hello,

i have problem during project create vote application. in mysql database,each row of voter have column tinyint type start 0. when voter login using username , id number check either voter vote or not check tinyint=0. if tinyint=1 mean voter vote. so, problem how can change tinyint=1 voter row after click vote button submit?

 

below login php code:

 

 <?php   if(isset($_post["submit"]))   {   $user=$_post['ic'];   $pass=$_post['id'];    $con=mysql_connect('localhost','','') or die(mysql_error());   mysql_select_db('kpmim_voters') or die("cannot select database");    $query=mysql_query("select nama,username,id,alreadyvote user username='".$user."' , id='".$pass."' , alreadyvote=0"  );   $numrows=mysql_num_rows($query);   if($numrows!=0)   {   while($row=mysql_fetch_assoc($query))   {   $dbusername=$row['username'];   $dbpassword=$row['id'];   $dbname=$row['nama'];   }    if($user == $dbusername && $pass == $dbpassword )   {   session_start();   $name=$dbname;   $_session['sess_nama']=$name;   $_session['sess_user']=$user;   $_session['sess_pass']=$pass;    $res= mysql_query("select nama,username,id,alreadyvote user nama='".$name."' , username='".$user."' , id='".$pass."'");     /*redirect browser*/   echo "<script type='text/javascript'>alert('note! able vote 15 candidates')</script>";   header("location:main.php");   }    }    else   {   echo "invalid ic number , id number!";    echo" or done vote";   }   }   ?> 

 

 

below php code vote:

 

 

 <?php $servername = "localhost"; $username = ""; $password = ""; $dbname = "aydentec_kpmim_voters";   // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) {      die("connection failed: " . $conn->connect_error); }       $sql = "select no, calon, id, jurusan, image candidates order rand()"; $result = $conn->query($sql);  if(isset($_post['vote'])) {     //get id value radio button form field , store in array. $update_vote = $_post['candidate_id'];   //loop through array , update database foreach ($update_vote $value) { $vote_sachin = "update candidates set undi=undi+1 no=".$value.""; $run_sachin = mysqli_query($conn, $vote_sachin);     }    header("location:http://web.com/kpmimvoteapplication"); } ?> 

i hope can me. urgent because last minutes change..please me this!

 

thank you.



More discussions in Dreamweaver support forum


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!