<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<?php
session_start();
$conn = mysqli_connect("localhost", "root", "","test");
$product_code = $_GET['product_code'];
$sql = "SELECT * FROM test_config WHERE product_code = '$product_code'";
$product_list = mysqli_query ( $conn, $sql);
if($product_list = 1)
echo"good";
else
echo"bad";
?>
</head>
<body>
<span id="tttt"></span>
<form id="msform" method="post">
<!-- progressbar -->
<ul id="progressbar">
<li class="active">
<?php While ($one_product = mysqli_fetch_assoc($product_list)) {?>
<li><?php echo $one_product['test_name']; ?></li>
<?php } ?>
<!-- <a href="index.html" >Start-Over</a> -->
<span onclick="window.close()" style="float:right">Start-Over</span>
</ul>
<?php While ( $one_product = mysqli_fetch_assoc($product_list) ) {
$num_test = $one_product['num_test'];
$test_name = $one_product['test_name'];
$images_pos = $one_product['images_pos'];
$images_neg = $one_product['images_neg'];
$images_inv = $one_product['images_inv'];
?>
<!-- fieldsets -->
<fieldset id="<?php $test_name; ?>" data-set="0">
<h2 class="fs-title"><?php echo "$test_name"; ?></h2>
<img src="images/<?php $images_pos; ?>" class="case" data-case="1"/><br/>
<input name="<?php $test_name; ?>" type="radio" value="N" class="hide">
<img src="images/<?php $images_neg; ?>" class="case" data-case="2"/><br/>
<input name="<?php $test_name; ?>" type="radio" value="P" class="hide">
<img src="images/<?php $images_inv; ?>" class="case" data-case="3"/><br/>
<input name="<?php $test_name; ?>" type="radio" value="I" class="hide">
<img src="images/skip_button.fw.png" class="case" data-case="4"/><br/>
<input name="<?php $test_name; ?>" type="radio" value="S" class="hide">
<br/>
<?php if ($num_test > 1) { ?>
<input type="button" name="next" class="next action-button" value="Next" />
<br/>
<?php if($num_test == 1) { ?>
<input type="button" name="previous" class="previous action-button" value="Previous" />
<input type="button" name="submit" id="submit" class="action-button" value="SAVE" />
</fieldset>
<?php }
$num_test --; ?>
<?php } }?>
</form>
</body>
</html>
错误:警告:mysqli_fetch_assoc()要求参数1为mysqli_result,第41行和第52行给出的整数(包含的行)
请帮帮我谢谢!!!!! sql确实从数据库中获取数据。但是,while循环仍有一些错误。
答案 0 :(得分:0)
通常在mysqli_query未正常运行时发生这种情况,
试试这个
var TodoView = Backbone.View.extend({
tagName: 'li',
// ...
el: $('#todo')
// ..
});
答案 1 :(得分:0)
我认为您的查询存在错误。你可以用这个代替你的代码吗?它应该为您提供一条错误消息,告诉您查询中的内容。
如果我猜测,我会说$product_code
在数据库中存储为整数,但您在查询中将其用作字符串。
$product_list = mysqli_query( $conn, $sql) or die(mysqli_error($conn));