<?php if(isset($_post['tt1']) && isset($_post['tt2']) && isset($_post['tt3']) && isset($_post['tt4'])){ $con = mysqli_connect("localhost","root","","weblib"); if(mysqli_connect_errno()){ echo "could not connect."; } $query = "select * login member_name = '{$_post['tt1']}'"; $queryarray = mysqli_fetch_array(mysqli_query($con,$query)); if($_post['tt2']==$_post['tt3']){ if(empty($queryarray['member_name'])){ mysqli_query($con,"update login set member_name = '{$_post['tt1']}', password = '{$_post['tt2']}' member_name = '{$_post['tt4']}'"); echo " <script language='javascript'> window.alert('profile information updated. click ok continue'); </script> "; } else{ echo " <script type='javascript'> window.alert('username exists. please choose different username'); </script> "; } } else echo " <script type=javascript> window.alert('passwords not match'); </script> "; }
else part 'passwords not match' part not being executed. same thing happening page well. there no mysql error, because else working pretty perfectly. not else part says "username exists" works well. outer else not being executed.
actually, problem type part of script tag. should this:
<script type='text/javascript' language='javascript'>
however, can use simple tag browsers supporting right now.
so, change else part this:
else { echo " <script> alert('passwords not match'); </script> "; }
according psr, recommend use braces block codes.
Comments
Post a Comment