php - Records retrieved twice -


i have following php/mysql code:

$wp_sql_query_text = "select table1.field1, table1.field2, table1.field3, table2.field1, table2.field2,table3.field1, table3.field2 table1  inner join table2 on table1.field2=table2.field1  inner join table3 on table1.field3=table3.field1  table1.field1 > some_value order table1field1";   echo $wp_sql_query_text;     $get_app_history = mysqli_query($conn,$wp_sql_query_text); $app_entry = mysqli_fetch_assoc($get_app_history);  //some additional code initialization of counters , variables  while ($app_entry = mysqli_fetch_assoc($get_app_history)){     //some processing } 

simply put

1) there 3 tables - table1, table2 , table3.

2) table1 has 3 fields - field1, field2 , field3.

3) table2 , table3 have 2 fields

each.

after 'echo'ing sql query, cut , pasted sql in phpmyadmin , records retrieved once.

however, on page, same record retrieved twice.

this because fetching result twice

$app_entry = mysqli_fetch_assoc($get_app_history);  // first fetch  .......some additional code initialization of kounters , variables.....  while ($app_entry = mysqli_fetch_assoc($get_app_history)) // second fetch loop 

i suggest remove first , keep loop might use in case of multiple results


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -