+ 1

Just get first mysql request why?

Hello I have 3 mysql request but just for the first i get a reponse does anyone knoe why $db_link=mysqli_connect("localhost", "root","", "osteodb") or die("sth went wrong"); $db_res= mysqli_query($db_link, "SELECT * FROM `videos` ORDER BY CAST(`Modul` AS INT)"); $array=array(); while($row=mysqli_fetch_array($db_res)){ array_push($array,$row); } $db_res= mysqli_query($db_link, "SELECT * FROM `module` ORDER BY CAST(`modul` AS INT)"); $moduleArray=array(); while($row=mysqli_fetch_array($db_res)){ array_push($moduleArray,$row); } $db_res2= mysqli_query($db_link, "SELECT * FROM `lehrveranstaltungen` ORDER BY CAST(`id` AS INT)"); $lehrverArray=array(); while($row=mysqli_fetch_array($db_res2)){ array_push($lehrverArray,$row); }

15th Jan 2019, 4:07 PM
jack
jack - avatar
8 Answers
+ 3
solution was just get rid of the json_encode infront of the $row ;-) while($row=mysqli_fetch_array($db_res)){ if ($row!=false) { array_push($modulArray, $row); }
17th Jan 2019, 10:40 PM
jack
jack - avatar
+ 2
not sure if 'Modul' or 'modul' are in your table. please understand that i dont know how the headers of table are defined, so please check again only to make sure if there's a spelling error
15th Jan 2019, 4:55 PM
notqueued
notqueued - avatar
+ 2
from what i see at the 3rd one you put some extra letters in the table name. try to close the connection to the database at the end of the code.
16th Jan 2019, 7:05 PM
notqueued
notqueued - avatar
+ 2
Found the mistake its cause of the Ă€ ĂŒ ö in every row with some of these Ă¶Ă€ĂŒ I get a false insted of the array in the json. But dont know realy how to solve that
17th Jan 2019, 8:40 PM
jack
jack - avatar
0
Seems like my last answer didnt get posted. so there is a table named: videos Colums are: id, Modul, Semester, path.. A table named: module With colums: id, modul, mName And a table named: veranstaltungen With colums: id, modul, veranstaltung
16th Jan 2019, 6:45 PM
jack
jack - avatar
0
No ment lehrveranstaltungen sorry. Im really dont know anymore what to do
17th Jan 2019, 6:20 AM
jack
jack - avatar
0
cause i get no error; it seems to work just retursn nothin. if i change the table name wrong ill get an error
17th Jan 2019, 6:24 AM
jack
jack - avatar
0
the querry with videos was always working fine. But the other two just get nothin back though the tables are filled
17th Jan 2019, 6:45 AM
jack
jack - avatar