PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
include 'config.php';
include 'opendb.php';
date_default_timezone_set("America/Edmonton");
require_once('PDF_Label.php');
$pdf = new PDF_Label('5160', 'mm', 1, 2);
$pdf->Open();
$pdf->AddPage();
$action=$_GET['action'];
switch ($action) {
case "Cal":
$searchStr = "xCalendar";
break;
case "iGift":
$searchStr = "xIndivGift";
break;
case "GShirt":
$searchStr = "gShirt";
break;
case "GBalls":
$searchStr = "gBalls";
break;
case "SShirt":
$searchStr = "sShirt";
break;
case "BLI":
$searchStr = "xBuilderLunchInvite";
break;
case "DJD":
$searchStr = "DJDInvite";
break;
case "SAM":
$searchStr = "SAM";
break;
default :
$searchStr = "";
}
$query = mysql_escape_string("SELECT ContactID FROM anualevents WHERE " . $searchStr . "=1");
$result = mysql_query ($query)or die ('I cannot connect to the database because: ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$total = mysql_num_rows($result);
foreach($row as $i => $v){
$query1 = mysql_escape_string("SELECT * FROM _contact WHERE ContactID = " . $v['ContactID'] );
$result1 = mysql_query ($query1)or die ('I cannot connect to the database because: ' . mysql_error());
$row1 = mysql_fetch_array($result, MYSQL_ASSOC);
$fullName = $row1['Prefix'] . ". " . $row1['FirstName'] . " " . $row1['LastName'];
$address = $row1['City'] . " " . $row1['Province']. " " . $row1['Postal'];
echo("<br>Fullname: " . $fullName . "<br>Address: ". $row1['StreetAddress'] . "<br>" . $address);
//Print labels
//$pdf->Add_PDF_Label(sprintf("%s\n%s\n%s", $fullName, $row1['StreetAddress'], $address));
//$pdf->Output();
}
include 'closedb.php';
?>
What's happening is that I'm only getting one record to 'print' and I know there 2. Thanks to everyone who looks, i've been kicking this around all morning.
Cheers,
Wade
Last edited by Wade on Fri Feb 23, 2007 4:45 pm, edited 1 time in total.
HA! That was the other part I was working on, yes that helps display the results properly, but it's still only showing 1 record instead of 2... any thoughts?