arrays - PHP - JSON does not made output -
I wrote a code that outputs all the terminals, I have the day. For this the calendar has already expired but program output, I do not want to work with dragon.
My code:
& lt ;? Php mysql_connect (deleted); Mysql_select_db ("DB1367141") $ day = date ("D"); $ Month = date ("m"); $ Year = date ("Y"); $ Result = mysql_query ("Select days where select entries from day = '$ day' and month = '$ month' and year = '$ year' order hours DESC, minutes); $ Array = {}; While ($ obj = mysql_fetch_object ($ result)) {if ($ obj-> hour! = "-") $ hour = splitf ("% 02d", $ obj-> hour); And $ hour = $ obj- & gt; Bell; If ($ obj-> minutes! = "-") $ minute = splitf ("% 02d", $ obj-> min) and $ min = $ obj- & gt; Minute; Array_push ($ array, {"hours": $ hour, "minutes": $ min, "text": $ obj- & gt; tex}); } Var_dump ($ array); Echo json_encode ($ array); ? & Gt;
But if I run it, it does not output to the array from "echo" ("hi"); "
I tried, in the end and in the middle but the output is similar: nothing
I found out in another forum that I have to write:
< Pre> $ array = array ();
But the output is similar: nothing.
I have both correct syntax and error The report tried as I have changed the $ array = array (), nothing changed.I added two rows in my .htaccess to get a better error report, and This generated a 500 internal server error.
I can suggest that you have a timestamp in the simplicity name Try to change your debt storage, in this way you only have to see that the entry is between the first and the last seconds of "today."
You can save yourself a lot of trouble and if you In fact, that JSON layout can only parse the timestamp:
while ($ obj = mysql_f Etch_object ($ result)) {$ array [] = array ('hour' = & gt; date ('h', $ obj- & gt; Timestamp, 'min' = & gt; Date ('i', $ obj-> timestamp, 'text' = & gt; $ obj- & gt; tex);} echo json_encode ($ array); Date ('N', strontem ($ strTemestamp));
Comments
Post a Comment