0

Can you let me know what's wrong with this code?

I have to display user specific information from MySQL on php. Credit and Balance are the 2 data that I have to display according to the user. https://code.sololearn.com/wuiNc3PcY52D/?ref=app

23rd Apr 2018, 5:17 PM
Muthiah Abbhirami
Muthiah Abbhirami - avatar
1 Odpowiedź
+ 3
Add status check to mysql_fetch_array() Also: if (isset($arr['Credit'])) { // $arr['Credit'] is ok to use } else { // There's a problem } Do that isset() test on all array accessors. Make your code more robust like that. Add unit tests too, that will mean adding a stub for the database code, so you can decouple it. That way you can test different routes through your code, to check it's stability for unexpected situations.
23rd Apr 2018, 8:01 PM
Emma