I have the following code:
$sql_sd = select sd_code from stamp_den;
$rest2 = odbc_exec($conn,$sql_sd);
while(odbc_fetch_into($rest2,$row_s))
{
$row_sd=$row_s[0];
}
//here i get sd_code as follows: 45, 46, 47, 48 etc
for ($i=0; $i<$td_date ;$i++)
{
$qu=select stamp_type from stamp_type where sd_code=$row_sd;
}
This whole code is inside another while loop.
Now in the for loop while executing the '$qu' query it takes values of sd_code as 45,45,45,45,46,46,46,46 etc depending upon the number of iterations.
How can I modify the code to take distinct values of sd_code while executing the $qu query. (45,46,47, etc)
If there is problem with the syntax please ignore, all variables and loops are declared. My code is executing properly, but not giving the desired o/p.
SELECT DISTINCT sd_code from stamp_dento receive distinct values from database