私は2つのテーブルを持つデータベースを持っています:
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
そしていくつかのPHPMySQLコード:
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 />";
基本的に私はtblspeciesを読み、txtSpeciesListごとに$species値を取得してtblsplintersbowlinventoryをループし、txtProductBowlCode値に$species値が含まれるたびにtxtProductPrimarySpeciesをその値で更新します。
これは、txtProductPrimarySpeciesを$species値に設定するのに問題なく機能しますが、txtProductBowlCodeの最後の6文字を追加して(例:MapleSpTi12-025は12-025を生成します)、それを$species値(Mpale)に追加します。次に、txtProductPrimarySpeciesを新しい結合値(Maple12-025)で更新します。
これも実行されますが、次の出力が得られます。
Species: Ash
Wood: Ash
Seq: Resource id #5
それは種を示していますが、何らかの理由で
$seq = mysql_query('SELECT txtProductBowlCode, RIGHT(txtProductBowlCode,6) FROM tblsplintersbowlinventory');
コードは私に" Resource id #5
"エラーを与えます。
私はここで何が間違っているのですか?