Php 尝试右键时出现资源id错误(字符串,int)
我有一个带有2个表的db:Php 尝试右键时出现资源id错误(字符串,int),php,mysql,Php,Mysql,我有一个带有2个表的db: db: scwdb Table 1: tblspecies field: txtSpeciesList (ex: "Maple") Table 2: tblsplintersbowlinventory field: txtProductBowlCode (ex: "MapleSpTi12-025") field: txtProductPrimarySpecies - which is blank, it is the target field to be fill
db: scwdb
Table 1: tblspecies
field: txtSpeciesList (ex: "Maple")
Table 2: tblsplintersbowlinventory
field: txtProductBowlCode (ex: "MapleSpTi12-025")
field: txtProductPrimarySpecies - which is blank, it is the target field to be filled
还有一些PHP MySQL代码:
mysql_select_db("scwdb", $con);
$query = "SELECT * FROM tblspecies";
$species = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($species)){
$wood = $row['txtSpeciesList'];
$seq = mysql_query('SELECT txtProductBowlCode, RIGHT(txtProductBowlCode,6) FROM tblsplintersbowlinventory');
echo "Species: ". $row['txtSpeciesList'];
echo "<br />";
echo "Wood: ". $wood;
echo "<br />";
echo "Seq: ". $seq;
echo "<br />";
它显示了物种,但由于某种原因
$seq = mysql_query('SELECT txtProductBowlCode, RIGHT(txtProductBowlCode,6) FROM tblsplintersbowlinventory');
代码给了我“资源id#5
”错误
我做错了什么 您需要在$seq上执行mysql_fetch_数组
$rowSeq = mysql_fetch_array($seq);
print_r($rowSeq);
这给了我:数组([0]=>Ash07-001[txtProductBowlCode]=>Ash07-001[1]=>07-001[RIGHT(txtProductBowlCode,6)]=>07-001)物种:灰木:灰序列:资源id#5好的,我看到它给出的结果是07-001,这是正确的,但为什么我仍然得到资源id#5错误?还有,我应该提到,每次循环时,资源ID会跳2……这一行:echo“Seq:”$序号;不知道你的意思-这是我的台词。我应该把它拿出来吗?为什么打印会显示值而不是回音?
$rowSeq = mysql_fetch_array($seq);
print_r($rowSeq);