i want to create id card for every user
so i'm try to looping their id number and query from database to acquire their data
my problem appear if i'm looping id number that started with zero,
i'm know that happen because php treat the id number as a number instead as a string
here my code;
for($id=$id1;$id<=$id2;$id++){
$query="select name,address from user where id_number=$id";
if(!$result=mysql_query($query,$dbh))
{
echo mysql_error();
exit;
}
while($row=mysql_fetch_array($result)){
$name=$row[name];
$address=$row[address];
echo $id;
echo $name;
echo $address;
}
}
if i'm looping from 0331 to 0661
i got id number from 331 to 661
but if i'm looping from 1222-1444
there is no problem
anyone can help to solve my problem?