PHP编程错误(无法运行while循环)

<!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>

Errors: Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, integer given on line 41 and line 52 (Line that contain )

Please help me thanks!!!!! The sql does get the data from the database. However, the while loop is still having some errors.

if($product_list = 1) echo"good"; else echo"bad";

Shouldnt be there. As it will make $product_list into boolean and thus cannot run through the loop

This happens usually when the mysqli_query hasnt run properly,

Try this

if (!$query) {
        echo 'MySQL Error: ' . mysqli_error();
        exit;
    }

I think there is an error with your query. Could you please replace your code with this? It should provide you with an error message telling what is off in your query. If I were to take a guess, I would say that $product_code is stored as an integer in the database but you are using it as a string in your query.

$product_list = mysqli_query( $conn, $sql) or die(mysqli_error($conn));