1. Download our Official Android App: Forums for Android!

Apps PHP parsing and MySQL Query Error

Discussion in 'Android Development' started by Yathushan, Nov 2, 2011.

  1. Yathushan

    Yathushan Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    205
    Joined:
    Jan 3, 2010

    Jan 3, 2010
    205
    7
    36
    London
    I seem to be having trouble with my php code. I have constructed the query using phpMyAdmin where it works without any problems. However, once I insert the sql query into this php code it does not seem to work at all.

    PHP:
    1.  
    2. <?php
    3.  
    4. mysql_connect("127.0.0.1", "root", "password");
    5. mysql_select_db("transport");
    6.  
    7. $q = mysql_query("SELECT * FROM `tube` WHERE `code` = 'B'");
    8. while ($row = mysql_fetch_assoc($q))
    9.   $output[] = $row;
    10.  
    11. print(json_encode($output));
    12.  
    13. ?>
    14.  
    I keep getting the following error message when I try and execute the php script using my web browser. I would just like it known that the mySQL database and the php script are both located on an external server.

    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.

    Any help regarding the coding would be helpful.
     

    Advertisement

Share This Page

Loading...