我在这里循环播放了这个:
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
$skuid = $row['skuid'];
$sku = $row['sku'];
$pagelink = $row['pagelink'];
$fitsbrand = $row['fitsbrand'];
$fitsmodel = $row['fitsmodel'];
$m_brand_cat = $row['m_brand_cat'];
$m_frame_cat = $row['m_frame_cat'];
$traynumber = strtok(parse_url($sku, PHP_URL_PATH), '-'); // for traynumber
$endofurl = strrchr(parse_url($pagelink, PHP_URL_PATH), '/'); // for Search Engine Optimization URL Key - step 1 get URL
$endofurl2 = strtok(parse_url($endofurl, PHP_URL_PATH), '.'); // for Search Engine Optimization URL Key - step 2 trim after . or .php
$endofurl3 = trim($endofurl2, "/"); // for Search Engine Optimization URL Key - step 3 trim fist /
这是我的疑问:
$query = "SELECT
skuid,
replacementlenses.sku,
replacementlenses.title,
replacementlenses.description,
replacementlenses.longdescription,
replacementlenses.pagelink,
replacementlenses.pagelinkrx,
replacementlenses.imagelink,
replacementlenses.imagelinksmall,
replacementlenses.imagelink2,
replacementlenses.imagelink3,
replacementlenses.fitsbrand,
replacementlenses.fitsmodel,
replacementlenses.color,
replacementlenses.colorcode,
replacementlenses.polarized,
replacementlenses.producttype,
replacementlenses.fuselenses,
replacementlenses.lenswidth,
replacementlenses.lensheight,
replacementlenses.frame_material,
lenslist.brand,
lenslist.model,
lenslist.m_brand_cat,
lenslist.m_frame_cat
from lenslist, replacementlenses where replacementlenses.fitsbrand = lenslist.brand AND lenslist.brand LIKE '$brand%' AND replacementlenses.colorcode = 'C'";
以及查询应该返回的截图,每行都是一个数组:
然后继续在电子表格中将它们回显到<td>
。使用var_dump($row)
时,我会得到正确的skuid
,title
,color
以及不正确的内容,但接下来的一行,除了{{1}之外,所有内容都相同},这是唯一似乎通过循环重复的东西。
这是我的第一个m_frame_cat
值:
var_dump($row)
下一行应该回显数据库中下一行的信息,array (size=25)
'skuid' => string '34621' (length=5)
'sku' => string '101002-C-00000000000' (length=20)
'title' => string 'TITLE HERE' (length=56)
'description' => string 'DESCRIPTION HERE' (length=56)
'longdescription' => string '' (length=0)
'pagelink' => string 'REMOVED FOR PRIVACY' (length=54)
'pagelinkrx' => string 'REMOVED FOR PRIVACY' (length=54)
'imagelink' => string 'REMOVED FOR PRIVACY' (length=55)
'imagelinksmall' => string 'REMOVED FOR PRIVACY' (length=58)
'imagelink2' => string 'REMOVED FOR PRIVACY' (length=55)
'imagelink3' => string 'REMOVED FOR PRIVACY' (length=68)
'fitsbrand' => string 'Black Flys' (length=10)
'fitsmodel' => string 'Sonic Flys 2' (length=12)
'color' => string 'Crystal Clear' (length=13)
'colorcode' => string 'C' (length=1)
'polarized' => string 'Non-polarized lenses' (length=20)
'producttype' => string 'Replacement Lenses' (length=18)
'fuselenses' => string 'N' (length=1)
'lenswidth' => string '63' (length=2)
'lensheight' => string '40' (length=2)
'frame_material' => string 'P' (length=1)
'brand' => string 'Black Flys' (length=10)
'model' => string 'Sonic Flys 2' (length=12)
'm_brand_cat' => string '433' (length=3)
'm_frame_cat' => string '436' (length=3)
为Lucky Fly
,但下一行是完全相同的信息,fitsmodel
现在反映了Lucky Fly而不是所有其他信息。
这里需要m_frame_cat
循环吗?我该怎么办呢?