Dear All,
I have a query regarding the array. The problem is that I want fetch some value from a table and store the value in an array and again want to run one more query on the basis of the earlier value which I have stored in the array.
For more details kindly find the below details.
table name: abc, it contain colum c1, c2, c3, c4,
now I want run a query to fetch distinct value of column c3 and now want to put all the distinct value in an array.
then, again want to run another query from the same table abc with condion of value allocate in the array.
then I want run another query separtly from the same table and get count of $value[$i]; Again, want to put count and $value[$i] into another array.
I am not able to do the same. Kindly help in executing the code.
Regards,
Robindra
New Delhi - India
I have a query regarding the array. The problem is that I want fetch some value from a table and store the value in an array and again want to run one more query on the basis of the earlier value which I have stored in the array.
For more details kindly find the below details.
table name: abc, it contain colum c1, c2, c3, c4,
now I want run a query to fetch distinct value of column c3 and now want to put all the distinct value in an array.
then, again want to run another query from the same table abc with condion of value allocate in the array.
Code:
$fetch = mysql_query("SELECT distinct(c3) FROM abc") or die(mysql_error()); $count = mysql_num_rows($fetch) or die(mysql_error()); echo $count; $i = 0; while($distinct_c3= mysql_fetch_array($fetch)){ for($i=0; $i<$count; $i++){ $value[$i] = $distinct_c3['c3']; } //echo $value[$i]; $i++; }
I am not able to do the same. Kindly help in executing the code.
Regards,
Robindra
New Delhi - India
Comment