I am currently working on a barcode php script, in the example shown below the script will generate
a barcode based on a ramdom mysql query. The problem i have is I need to be able to display the same image multiple
times based on a variable. To elaborate, mysql will run a query and fetch a row which will contain a unque code to be used as
the barcode and a number to indicate how many barcodes need to be displayed on page. Is there a way i can use this number as
a variable to be able to display the same barcode multiple times in a column one underneath the other. Thanking you in advance
(Edit: see later post)
Last edited by Inigoesdr; 08-01-2009 at 07:07 PM..
Is there a way i can use this number as
a variable to be able to display the same barcode multiple times in a column one underneath the other.
By "this number" do you mean the one that is set to 1 in your query example (... limit 1) ? If so, and if you need to query and display say 10 bar codes, just add a loop for each record in your recordset like this:
$r=mysql_query("select codes from list order by rand() limit 10");
$query = mysql_fetch_row($r);
$text = strtoupper($query);
// .... all your code goes here ...
// just need to set $barcodeheight = 40 * mysql_num_rows($r) before loop
// also add variable $ypos and increment it by 40 each iteration
This script uses mysql to generate a barcode and duplicates the image 10 times one underneath the other to produce what looks like a continious barcode. My problem is i need to separate the 10 images down the page to allow for a text area. Any ideas?
I appreciate any input, many thanks