php - Calling query: Notice: Array to string conversion in -


i newbie trying make own web app. got problem. i've tried call query table code find rank

$rank="select student_code, led2dt4engavgfinal, find_in_set(     led2dt4engavgfinal,     (select group_concat(distinct led2dt4engavgfinal order led2dt4engavgfinal desc)     led2deng) ) rank led2deng;";  $myqry2 = mysql_query($rank, $koneksidb)  or die ("query salah : ".mysql_error()); $mydata2 = mysql_fetch_array($myqry2); 

and use code call data

<?php echo $mydata2; ?> 

but came out

notice: array string conversion in....

how can fix this?

iterate result array this:

foreach($mydata2 $row){    //now access columns   echo $row["student_code"];   echo $row["led2dt4engavgfinal"];  } 

update: try this

<?php  $rank="select student_code, led2dt4engavgfinal, find_in_set( led2dt4engavgfinal , (select group_concat( distinct led2dt4engavgfinal order led2dt4engavgfinal desc ) led2deng) ) rank led2deng;";  $myqry2 = mysql_query($rank, $koneksidb) or die ("query salah : ".mysql_error());  $mydata2 = mysql_fetch_array($myqry2);   foreach($mydata2 $row) {     echo $row['student_code'];     echo $row['led2dt4engavgfinal'];     echo $row['rank']; } 

?>


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -