在同一行显示Mysql行

时间:2015-08-01 17:10:52

标签: php mysql

我正在整合Paypal Gateway,我有一些数据库行,我希望它们出现在相同行中的同一行示例2行中,然后再行到另一行......

      <?php
     session_start();
    include 'db_config.php';
       require_once '../constants/initSite.php';
            if(isset($_SESSION['username']) && isset($_SESSION['password'])){
 require_once '../constants/class.DatabaseConstants.php';
    require_once '../class/class.DBase.php';



$db = new DatabaseConstants();
$dBase = new DBase($db->getHost(), $db->getUser(), $db->getPass());
$dBase->setDatabaseName($db->getDb());

if(!$dBase->connectDatabase()){
    die('SQL ERROR at db class vd fn');
}
     //Set useful variables for paypal form
           $paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; //Test PayPal API URL
       $paypal_id = 'info@codexworld.com'; //Business Email

       ?>
         <!DOCTYPE html>
         <html lang="en">
          <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>DoPTC Paypal Shop</title>
                </head>
      <body>
<?php
    //fetch products from the database
    $results = mysqli_query($dBase->getDbobj(), ("SELECT * FROM products  WHERE user='".$_SESSION['username']."' AND status='1'") );
    while($row = mysqli_fetch_assoc($results))
    {
?>

<br/>Name: <?php echo $row['name']; ?>
<br/>Price: <?php echo $row['price']; ?>
<form action="<?php echo $paypal_url; ?>" method="post">

    <!-- Identify your business so that you can collect the payments. -->
    <input type="hidden" name="business" value="<?php echo $paypal_id; ?>">

    <!-- Specify a Buy Now button. -->
    <input type="hidden" name="cmd" value="_xclick">

    <!-- Specify details about the item that buyers will purchase. -->
    <input type="hidden" name="item_name" value="<?php echo $row['name']; ?>">
    <input type="hidden" name="item_number" value="<?php echo $row['id']; ?>">
    <input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
    <input type="hidden" name="currency_code" value="USD">

    <!-- Specify URLs -->
    <input type='hidden' name='cancel_return' value='../main/cancel.php'>
    <input type='hidden' name='return' value='../main/success.php'>


    <!-- Display the payment button. -->
    <input type="image" name="submit" border="0"
    src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
    <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >

</form>
    <?php }
         }else{

      }
             ?>
       </body>
         </html>

它的外观http://i.stack.imgur.com/Vfas8.jpg 我希望它看起来像http://i.stack.imgur.com/uMj9a.jpg

0 个答案:

没有答案