I am passing variables into a page:
for example
$Voucher1 = 123123123
$Voucher2 = 234234234
$Voucher3 = 345345345
$Voucher4 = 456456456
$Voucher5 = 567567567
Instead of writing code 5 times to perform sql updates I would rather write it once, using
for ($i = 1; $i <= 5; $i++) {
$V = $."Voucher".$i; //$Voucher1, etc...
If ( !is_null($V) )
{
$sqlRedeemVouchers = mysql_query("Select * from Vouchers Where VoucherNum = '$V' and Redeemed = 0 ");
//code removed
}
Problem is, when I echo the sql statement, it literally says "Where VoucherNum = '$Voucher1'" instead of passing in the variable. It should read "Where VoucherNum = '123123123'. Any idea how I make the new variable realize it's a variable?
Sorry if this is a lame question, it's stumping me.
Thanks!