如何从我的数据库中获取两行并将它们并排显示?

时间:2017-03-23 12:51:14

标签: php mysqli

我想从同一个数据库中获取两行,并将它们并排显示在其中。我之前使用以下代码来获得一个人并且它的工作非常好,事实上该网站是实时的。

这是我的代码

function getbankdetails()
{

$token = gToken();
require 'connect.php';
$gbank = mysqli_query($conn,"select * from provided_user where status = '1' AND plan = '{$_SESSION['plan']}' ORDER By date_of_ph ASC LIMIT 1");
while($bankdetail = mysqli_fetch_array($gbank))
{
    $accountname = $bankdetail[3];
    $bankname = $bankdetail[4];
    $id = $bankdetail[0];
    $pho_num = $bankdetail[5];
    //$acccounttype = $bankdetail[4];
    $accuntnum = $bankdetail[2];
    $email1 = $bankdetail['email'];
    $plan = $bankdetail['plan'];
    $tokeen = $bankdetail['token'];
    $date =   date("Y-m-d h:i:s",strtotime("+1 hours"));
    $uid = time();
 $inserttopay = mysqli_query($conn,"insert into paymentinfo (email, phone, accountname, accountnum, bankname, token,  plan, date, uid)values('$email1', '$pho_num', '$accountname', '$accuntnum', '$bankname', '$token', '$plan',  '$date','$uid')");
 //
 mysqli_query($conn,"insert into verify_pay (email, token, status, date, plan, reciver_email, uid) values('{$_SESSION['member']}', '$token', '1', '$date', '$plan', '$email1', $uid)");
 mysqli_query($conn,"update provided_user set status = '0' where id = '$id'");
 echo mysqli_error($conn);
//$email = $_SESSION['member'];
/*$upline_check=mysqli_query($conn,"select email, plan from verify_pay where email='$email' AND plan = '{$_SESSION['plan']}'");
if(mysqli_fetch_array($upline_check))
{
    include 'match.php';
    exit();
}*/
///////////////////////////////////////////////

// echo mysqli_error($conn);
 if($inserttopay)
echo "<script type='text/javascript'> window.onload = function () { top.location.href = 'index.php'; }; </script>";
exit();
 mysqli_free_result($gbank);
 echo mysqli_error($conn);

}

}

并且match.php看起来像这样

<?php
ob_start();
error_reporting(0);
$token = mysqli_query($conn,"select token, uid from verify_pay where email = '{$_SESSION['member']}'");
if ($tokens = mysqli_fetch_array($token))
{
$token = $tokens['token'];
$_SESSION['token']= $token;
$uids = $tokens['uid'];
$_SESSION['uid']= $uids ;
//echo $_SESSION['uid'];
//echo mysqli_error($conn);
}
//and plan='{$_SESSION['plan']}'
$payinfo = mysqli_query($conn,"select * from paymentinfo where token = '$token'"); 
while ($payinfod = mysqli_fetch_array($payinfo))
{
    $name = $payinfod['accountname'];
    $_SESSION['accountname'] = $name;
    $anum = $payinfod['accountnum'];
    //$bank = $payinfod['accountname'];
    $bank= $payinfod['bankname'];
    $phon = $payinfod['phone'];
    $uid = $payinfod['uid'];
}
ob_end_flush();
?><h3>
<?php 
ob_start();
//comparedate();
ReadTime();
//comparedate();
ob_end_flush();?>
</h3>
<div class="alert alert-info" onclick="$(this).hide()"> <b> <i class="fa fa-smile-o"></i> Hello <?php echo $name?>, </b> Your Activation is waiting for sponsors response. <span style="color:red; font-weight:800">
Do not compel your sponsor to confirm you, wait till they receive the payment. Transactions may be reversed in banking institutions.</span></div>
  <div class="panel b-a">
                        <div class="row m-n">

                          <div class="col-md-12 b-b">

                              <span class="clear">

                                    <li class="list-group-item" style="border:1px ridge #444;">
                      <div class="media">

                        <div class="media-body">
                        <img src="../img/a0.jpg" style="width:70px;float:right">
                          <span class="h4 block m-t-xs text-success"><?php echo $name?></span>
                         *<small class=""><b>Phone : <?php echo $phon?> </b></small> &nbsp;
                        <!-- *<small class=""><b>Location : </b>Lagos</small> -->
                         <hr>
                         <h5 class=""><b><u>Account Details</u></b></h5>
                        <div style="padding: 0px ;display:inline">           
                         *<small class=""><b>Bank Name :</b> <span style="color:red;font-weight:bold"><?php echo $bank?> </span></small>; <br>
                         *<small class=""><b>Account Name : </b><span style="color:red;font-weight:bold"><?php echo ucwords($name)?></span></small> <br>
                         *<small class=""><b>Account Number :</b> <span style="color:red;font-weight:bold"><?php echo $anum?></span></small> <br />

                         *<small class=""><b>Unique Identification :</b> <span style="color:red;font-weight:bold"><?php echo $_SESSION['uid']?></span></small> 
                   </div>
                         </div>

                      </div>
                    </li>  <br> 
                           <center><p style="font-size:16px"> Upload Proof of Payment if and only if you have made donation to upline , Click the button below to continue &gt;&gt;&gt;</p>
                           <div class="">

                      <button type="submit" class="btn btn-template-main signupBotton"onclick="window.location.href='upload_proof.php'" ><i class="fa fa-upload"></i> Upload Proof of payment</button>
                                </div>
           </div></div>

0 个答案:

没有答案