Tje Posted July 10, 2014 Share Posted July 10, 2014 (edited) Hi, i'm trying to doing update all table values(name,tel no,country,state,city) without email. using already logged user email(where clase).please help me. php <?php $con=mysqli_connect("localhost","root","","biz"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $rd=$_POST['optionsRadiosInline']; $Yname=$_POST['name']; $tp=$_POST['telephone']; $scntry=$_POST['country']; $st=$_POST['state']; $cty=$_POST['city']; if($Yname==""){ header('Location :profile.php'); }else{ echo $st; echo $cty; $result=mysql_query($con,"SELECT mail FROM reg "); $num_rows = mysql_num_rows($result); $row = mysql_fetch_assoc($result); $mail = $row['mail']; if($result){ mysqli_query($con,"UPDATE reg SET radio='$rd',yname='$Yname',tp='$tp',cntry='$scntry',state='$st',city='$cty' WHERE mail='$mail'"); header( 'Location:index.php' ); }else{ echo "first query error"; } } mysqli_close($con); ?> html <form id="form2" method="post" action="up_user.php"> <div class="form-group"> <label class="radio-inline"> <input type="radio" name="optionsRadiosInline" id="optionsRadiosInline1" value="Private" checked=""> Private </label> <label class="radio-inline"> <input type="radio" name="optionsRadiosInline" id="optionsRadiosInline2" value="Business"> Business </label> </div> <label class="">Name</label> <input type="text" class="form-control" placeholder="Your Name" required autofocus name="name" id="name"><br/> <!-- <label class="">Email</label> <input type="email" class="form-control" placeholder="Email address" required name="email" id="email" ><br/>--> <label class="">Telephone Number</label> <input type="text" class="form-control" pattern="\d+" placeholder="Telephone" name="telephone" required name="telephone" id="telephone"><br/> <label>Select Country</label> <select id="country" name="country" onChange="load_options(this.value,'state');"> <option value="">Select country</option> </select>   <label>Select State</label> <select id="state" name="state" onChange="load_options(this.value,'city');"> <option value="">Select state</option> </select> <label>Select city</label> <select id="city" name="city"> <option value="">Select City</option> </select> <img src="loader.gif" id="loading" align="absmiddle" style="display:none;"/> <br/> <div class="row"> <div class="col-md-4 col-md-offset-4"> <button class="btn btn-lg btn-primary btn-block" type="submit">Update Information</button> </div> </div> </form> Edited July 10, 2014 by Tje Quote Link to comment https://forums.phpfreaks.com/topic/289669-how-to-run-two-queries-in-one-php-tag/ Share on other sites More sharing options...
cyberRobot Posted July 10, 2014 Share Posted July 10, 2014 i'm trying to doing update all table values(name,tel no,country,state,city) without email. using already logged user email(where clase). Does your table have a primary key? If so, you could store that key in a session variable after the user logs in. You can then use the session variable for the key in your query(ies). Quote Link to comment https://forums.phpfreaks.com/topic/289669-how-to-run-two-queries-in-one-php-tag/#findComment-1484502 Share on other sites More sharing options...
Solution Tje Posted July 11, 2014 Author Solution Share Posted July 11, 2014 Thanks.it's work.. i use $_SESSION['mail'] from loggin.. Quote Link to comment https://forums.phpfreaks.com/topic/289669-how-to-run-two-queries-in-one-php-tag/#findComment-1484635 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.