小编ken*_*olm的帖子

JavaScript:如何从多维数组中获取值?

我正试图从多维数组中获取值.这就是我到目前为止所拥有的.
当我选择数组中的第一个选项时,我需要99的值和图像,例如"Billy Joel".

var concertArray = [
    ["Billy Joel", "99", "equal.png"],
    ["Bryan Adams", "89", "higher.png"],
    ["Brian Adams", "25", "lower.png"]
];

function populate(){
    for(i = 0; i < concertArray.length; i++){
        var select = document.getElementById("test");
        select.options[select.options.length] = new Option(concertArray[i][0], concertArray[i][1]);
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript arrays multidimensional-array

7
推荐指数
2
解决办法
5万
查看次数

循环两次 - 将双精度写入MySQL表

简而言之,我的代码似乎循环了两倍(当应该写两行时写入四行).这应该是一个简单的解决方案,但我没有运气.

这是我的php循环...必须是一个非常简单但看不见的东西,没有人能够找到为什么这个宝宝不工作:

                //query statement before the for loop
                $stmt="INSERT INTO o70vm_invoices_invoices 
                (`id`, `created_by`, `user_id`, `added`, `to_name`, `to_address`, `invoice_num`, `real_invoice_num`, `from_name`, `from_address`, `from_num`, `invoice_date`, `publish`, `notes`, `template_id`, `taxes`, `start_publish`, `end_publish`, `currency_before`, `currency_after`, `status`, `to_email`, `to_company`, `from_phone`, `from_url`, `from_email`, `discount`, `invoice_duedate`, `admin_notes`, `to_city`, `to_state`, `to_country`, `to_vatid`, `to_zipcode`, `rec_year`, `rec_month`, `rec_day`, `rec_nextdate`, `is_recurrent`) VALUES ";

                // loop through number of invoices user selected to create
                for($x = 0; $x < $invoiceCount; $x++) 
                        {

                            // add the user identified days to each invoice
                            $date->modify("+7 …
Run Code Online (Sandbox Code Playgroud)

php mysql

5
推荐指数
1
解决办法
99
查看次数

标签 统计

arrays ×1

javascript ×1

multidimensional-array ×1

mysql ×1

php ×1