English 中文(简体)
每一阵列的抗药性反应
原标题:PHP can t echo for each array

我试图相互呼声,但并未显示任何价值观。 唯一能够反映的价值观是相互的。

谁能告诉我什么是错的?

试图反映的是价格、物品、描述等,但我却一无所获。

如您需要看看一下它在这里的阵列的产出:

while ($row = $result->fetch()) { 
    $superitem[$row[ itemid ]][] = $row;
}
foreach($superitem AS $subitem) {
    list($prodid,$item,$size,$description,$price) = $subitem[0];

    if ($count % NUMCOLS == 0) echo "<tr>";  # new row
    echo  <td> ; 
    var_dump($subitem);
    //Your normal code up until the select box...
    echo  <form method="post" action="" class="jcart">
            <fieldset>
                <input type="hidden" name="jcartToken" value=" .$_SESSION[ jcartToken ]. " />
                <input type="hidden" name="my-item-id" value=" .$subitem[ prodid ]. " />
                <input type="hidden" name="my-item-price" value=" .$subitem[ price ]. " />
                <input type="hidden" name="my-item-url" value="http://yahoo.com" /> ;

    if(count($subitem) > 1) {

        echo  <li><select name="my-item-name" id="foo"> ;
        foreach($subitem AS $subsubitem) {
            echo "<option value= ".$subsubitem[ size ]." >".$subsubitem[ size ]."</option>";
        }
        echo "</select></li>";
    }
    else {
        echo  <input type="hidden" name="my-item-name" value=" .$subitem[ item ]. " /> ; 
    }
    echo <li>Price: $<span class="price"> .$subitem[ price ]. </span></li>
                <li>
                    <label>Qty: <input type="text" name="my-item-qty" value="1" size="3" /></label>
                </li>
            </ul>

            <input type="submit" name="my-add-button" value="add to cart" class="button" />
        </fieldset>
    </form> ;

    echo  </td> ;
    $count++;
    $counter++;

    if ($count % NUMCOLS == 0) echo "</tr>
";  # end row
}
最佳回答

目前,它像分项目一样,在第一个指数是滚动的情况下,包含一系列的长度1。 ......

$superitem[$row[ itemid ]][] = $row;

......

$superitem[$row[ itemid ]] = $row;

......

list($prodid,$item,$size,$description,$price) = $subitem[0];

......

list($prodid,$item,$size,$description,$price) = $subitem;
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签