Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的表单中只有一个字段设置为php和sql_Php_Mysql - Fatal编程技术网

我的表单中只有一个字段设置为php和sql

我的表单中只有一个字段设置为php和sql,php,mysql,Php,Mysql,嗨,当我试图设置字段的值时,我遇到了一个问题 对于一个变量的值,它的工作方式正是我希望它用于我的产品字段的方式,但在我的表单中,价格字段中没有显示任何内容 谢谢你的帮助我已经做了很长一段时间了 $query = "SELECT * FROM suplements WHERE product = '$product' OR name = '$prodname' OR price = '$price' OR image = '$image'"; $result = @

嗨,当我试图设置字段的值时,我遇到了一个问题 对于一个变量的值,它的工作方式正是我希望它用于我的产品字段的方式,但在我的表单中,价格字段中没有显示任何内容

谢谢你的帮助我已经做了很长一段时间了

$query = "SELECT * FROM suplements WHERE product = '$product' OR name = '$prodname' OR price = '$price' OR image = '$image'";
                $result = @mysql_query($query) or die ("could not execute SQL query");


    while($row = mysql_fetch_array($result))
     {          ?>
        <table>
             <tr>
                <th>Product :<?php echo $row["product"]?></th>


            </tr>
                <td><img src = "<?php echo $row["image"] ?>"height="400"                     width="400"><?php ?>
                <td>
                                    <form>
                                        <input type="text" name="qty" value="1" size="2"><br>

                                        Product <input type="text" name="product" value="<?php echo htmlentities($product); ?>" /></br>
                                        Price <input type="text" name="price" value="<?php echo htmlentities($price); ?>" />

                                        <input type="submit" name="submit" value="ADD" >

                                    </form>
                                    <?php echo $row["information"];?></td>



                <tr><td><?php echo $row["product"];?>
                <?php echo $row["name"];?>
                <?php echo $row["drand"];?>
                <?php echo $row["weight"];?>
            <td><?php echo $row["price"];?></td></tr>
        </tr>
      </table>
$query=“从supplements中选择*,其中product='$product'或name='$prodname'或price='$price'或image='$image';
$result=@mysql_query($query)或die(“无法执行SQL查询”);
while($row=mysql\u fetch\u数组($result))
{          ?>
产品:
“height=“400”width=“400”>


产品这就是你想要的吗

Product <input type="text" name="product" value="<?php echo htmlentities($row['product']); ?>" /></br>
Price <input type="text" name="price" value="<?php echo htmlentities($row['price']); ?>" />

Product为了调试起见,请在稍后执行此操作:“print_r($row);”-这将显示$row变量的确切内容


另外…最好在您的查询中添加限制1

正在为其他回音打印包括价格在内的值,而不是我表格中的回音