This is for an imaging system.
=======================
Pro # is the Order Number
idx-loc is the Image ID Number
img-loc is the File name on the Hard Drive.
=======================
File VTL-BL-IDX` can result with multiple rows.
For each Row I need to find the corresponding VTL-BL-IMG to
get the file name of the image.
The way it is programmed now .... it continuously loops when VTL-BL-IDX has more than one row !
Please Help
<?PHP
$PRO=$_POST["pro"];
echo "PRO # $PRO <BR><BR>";
/* Connecting, selecting database */
$link = mysql_connect("192.168.0.100", "imaging", "vtl12") or die("Could not connect");
mysql_select_db("imaging") or die("Could not select database");
/* Performing SQL query */
$result1 = mysql_query("SELECT `idx-loc` FROM `VTL-BL-IDX` WHERE 1 AND `idx-pro` = $PRO")
or die ("NO BL Available");
if ($myrow = mysql_fetch_array($result1)) {
do {
$ref1 = mysql_result($result1,0);
$result2 = mysql_query("SELECT `img-loc` FROM `VTL-BL-IMG` WHERE 1 AND `img-pro` = '$ref1' ")
or die ("No BL Available 2");
$ref2 = mysql_result($result2,0);
$ref3 = "http://192.168.0.100/~imaging/";
$ref4 = substr($ref2, 20);
$ref5 = $ref3 . $ref4;
echo "<p><a href=\"$ref5\">View BL Image </a></p>\n";
}
while ($myrow = mysql_fetch_array($result1));
}
else { echo "Sorry, no BL records were found!";
}
Find the Error
Moderator: General Moderators
consider using a join-statement to retrieve both fields with one query
and welcome to this forum
p.s.: my answers are short today. I'm in a bad mood after a half day of data-recovery (gods bless easyRecovery)
and welcome to this forum
p.s.: my answers are short today. I'm in a bad mood after a half day of data-recovery (gods bless easyRecovery)