谁能帮我看看我的php代码有什么问题吗
任何人都可以帮助我什么是错误的在我的代码php,价格细节显示3次我需要这3个数据从我的数据库显示在一行在这个定价页面。下面是我的网页现在的样子: 从mysql数据库读取数据后,它不会垂直显示。我在寻找这些数据的价格水平 这是我的桌子:谁能帮我看看我的php代码有什么问题吗,php,mysql,Php,Mysql,任何人都可以帮助我什么是错误的在我的代码php,价格细节显示3次我需要这3个数据从我的数据库显示在一行在这个定价页面。下面是我的网页现在的样子: 从mysql数据库读取数据后,它不会垂直显示。我在寻找这些数据的价格水平 这是我的桌子: id name price status 1 Basic 19.00 1 2 Gold 34.99 1 3 Platinum 67.00 1 今天就开始创业吧 我们为您的产品提供不同的服务
id name price status
1 Basic 19.00 1
2 Gold 34.99 1
3 Platinum 67.00 1
今天就开始创业吧
我们为您的产品提供不同的服务。保证30天。
$->
$
/钼
空中电子邮件预览
垃圾邮件测试和拦截
100 GB空间
200个用户帐户
免费支持两年
免费升级一年
$
/钼
空中电子邮件预览
垃圾邮件测试和拦截
100 GB空间
200个用户帐户
免费支持两年
免费升级一年
我认为您需要在循环中调用一个特定的div。看看下面的代码就知道了。另外,根据您的要求和条件更改代码 今天就开始创业吧 我们为您的产品提供不同的服务。保证30天。 $-> /钼 空中电子邮件预览 垃圾邮件测试和拦截 100 GB空间 200个用户帐户 免费支持两年 免费升级一年 $ /钼 空中电子邮件预览 垃圾邮件测试和拦截 100 GB空间 200个用户帐户 免费支持两年 免费升级一年
你将整个身体循环三次,你需要做的是将价格卡元素循环三次。到目前为止,循环中有三个价格卡元素,删除两个,然后尝试在price card元素之前和之后放置循环,我假定该元素是box body div。您将整个HTML元素循环三次,而不是只需要循环col-sm-4三次,而不需要行三次,这就是为什么它会垂直显示三次。 只需将下面的代码替换为您的代码
<?php
// Include configuration file
include_once 'config.php';
// Include database connection file
include_once 'dbConnect.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimal-ui" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- for ios 7 style, multi-resolution icon of 152x152 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-barstyle" content="black-translucent">
<link rel="apple-touch-icon" href="../assets/images/logo.png">
<meta name="apple-mobile-web-app-title" content="Flatkit">
<!-- for Chrome on Android, multi-resolution icon of 196x196 -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" sizes="196x196" href="../assets/images/logo.png">
<!-- style -->
<link rel="stylesheet" href="../assets/animate.css/animate.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/glyphicons/glyphicons.css" type="text/css" />
<link rel="stylesheet" href="../assets/font-awesome/css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/material-design-icons/material-design-icons.css" type="text/css" />
<link rel="stylesheet" href="../assets/bootstrap/dist/css/bootstrap.min.css" type="text/css" />
<!-- build:css ../assets/styles/app.min.css -->
<link rel="stylesheet" href="../assets/styles/app.css" type="text/css" />
<!-- endbuild -->
<link rel="stylesheet" href="../assets/styles/font.css" type="text/css" />
</head>
<body>
<div class="app" id="app">
<div class="padding">
<div class="p-y-lg clearfix">
<div class="text-center">
<h2 class="_700 m-b">Start up your Business today</h2>
<h5 class="m-b-md">We create different services for your product. 30 days guaranteed.</h5>
<a href class="btn rounded btn-outline b-info text-info p-x-md m-y">Start Now</a>
</div>
</div>
<div class="p-x-lg">
<div class="row">
<div class="col-lg-10 offset-lg-1">
<div class="row no-gutter">
<?php
// Fetch products from the database
$results = $db->query("SELECT * FROM products WHERE status = 1");
while($row = $results->fetch_assoc()){
?>
<div class="col-sm-4 col-sm-push-4">
<div class="box m-t-n">
<div class="box-body text-center r-t primary">
<h6 class="text-u-c p-v-sm m-0 m-t"><?php echo $row['name']; ?></h6>
<h3 class="m-0 m-l m-v">
<!--<sup>$</sup>-->
<span class="text-2x"><?php echo '$'.$row['price'].' '.PAYPAL_CURRENCY; ?></span>
<!-- PayPal payment form for displaying the buy button -->
<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="<?php echo PAYPAL_CURRENCY; ?>">
<!-- Specify URLs -->
<input type="hidden" name="return" value="<?php echo PAYPAL_RETURN_URL; ?>">
<input type="hidden" name="cancel_return" value="<?php echo PAYPAL_CANCEL_URL; ?>">
<span class="text-xs">/ mo</span>
</h3>
</div>
<ul class="list b-t b-b m-0 no-radius">
<li class="list-item">
<div class="list-body">
<i class="fa fa-check text-success m-r-xs"></i> Email preview on air
</div>
</li>
<li class="list-item">
<div class="list-body">
<i class="fa fa-check text-success m-r-xs"></i> Spam testing and blocking
</div>
</li>
<li class="list-item">
<div class="list-body">
<i class="fa fa-check text-success m-r-xs"></i> 100 GB Space
</li>
<li class="list-item">
<div class="list-body">
<i class="fa fa-check text-success m-r-xs"></i> 200 user accounts
</div>
</li>
<li class="list-item">
<div class="list-body">
<i class="fa fa-check text-success m-r-xs"></i> Free support for two years
</div>
</li>
<li class="list-item">
<div class="list-body">
<i class="fa fa-remove text-danger m-r-xs"></i> Free upgrade for one year
</div>
</li>
</ul>
<?php if($row['id'] == 1){ ?>
<div class="text-center p-a-md">
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif">
</div>
<?php }else{ ?>
<div class="text-center p-a-md">
<a href class="btn btn-block btn-lg white">Start Trial</a>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
您正在将整个HTML元素循环3次。请使用标题来描述问题,而不是说您有问题。