Jump to content

How to run two queries in one php tag


Tje
Go to solution Solved by Tje,

Recommended Posts

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>
              
		  &nbsp
		<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>

 

post-170830-0-87827800-1404991528_thumb.jpg

Edited by Tje
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.