0

I have a script that supposed to display the barcode for each item in the selection (66 rows in this case). However, it displays the barcode from the last item 66 times.

How do I display each item selected? I know all the result of the mysql selection is complete.

Here's the script (postnet.php

<?php
require('class/BCGFont.php');
require('class/BCGColor.php');
require('class/BCGDrawing.php');
require('class/BCGpostnet.barcode.php');

require_once "connect_to_mysql.php";
$result = mysql_query("SELECT * FROM maillist WHERE LEFT(zip,5) = '68502'") or die(mysql_error());

while ($row = mysql_fetch_array($result)) {
$zip11 = $row['postnet ip'];
include "postnet2.php";
echo '<img src="postnet.png" alt="some_text" > <br/>';
}
?>

This script produces the same problem except it displays the fourth item selected four times:

<?php
require('class/BCGFont.php');
require('class/BCGColor.php');
require('class/BCGDrawing.php');
require('class/BCGpostnet.barcode.php');

require_once "connect_to_mysql.php";
$result = mysql_query("SELECT * FROM maillist WHERE LEFT(zip,5) = '68502'") or die(mysql_error());

$row = mysql_fetch_array($result);
$zip11 = $row['postnet ip'];
include "postnet2.php";
echo '<img src="postnet.png" alt="some_text" > <br/>';

$row = mysql_fetch_array($result);
$zip11 = $row['postnet ip'];
include "postnet2.php";
echo '<img src="postnet.png" alt="some_text" > <br/>';

$row = mysql_fetch_array($result);
$zip11 = $row['postnet ip'];
include "postnet2.php";
echo '<img src="postnet.png" alt="some_text" > <br/>';

$row = mysql_fetch_array($result);
$zip11 = $row['postnet ip'];
include "postnet2.php";
echo '<img src="postnet.png" alt="some_text" > <br/>';

?>
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by vibhaJ
0

1) why you are hard coding '68502' in your query. You must pass some get/post variable for getting the dynamic content.
2) $zip11 = $row; // YOu are fethcing things in zip11 but then you are not making use of it, why?

Also explain your problem little bit more and attach all used php files and mysql table structure.

Edited by urtrivedi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.