Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing the localdatabase using android emulator
    text
    copied!<p>I am working with <a href="http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/" rel="nofollow">http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/</a> . I am facing several problems here tagging with JSON . I don't know what to do now. I want to add that my local host is ar port 81. and i have just only changed localhost:81/android_login_api/ and localhost:81/android_login_api/ in the login and registration url respectivly. here is my logcat error - </p> <pre><code>02-24 11:17:58.000: E/JSON(1364): &lt;br /&gt; 02-24 11:17:58.000: E/JSON(1364): &lt;b&gt;Parse error&lt;/b&gt;: syntax error, unexpected $end in &lt;b&gt;C:\xampp\htdocs\android_login_api\include\DB_Connect.php&lt;/b&gt; on line &lt;b&gt;46&lt;/b&gt;&lt;br /&gt; 02-24 11:17:58.011: E/JSON Parser(1364): Error parsing data org.json.JSONException: Value &lt;br of type java.lang.String cannot be converted to JSONObject 02-24 11:17:58.011: D/AndroidRuntime(1364): Shutting down VM 02-24 11:17:58.011: W/dalvikvm(1364): threadid=1: thread exiting with uncaught exception (group=0x40a70930) 02-24 11:17:58.030: E/AndroidRuntime(1364): FATAL EXCEPTION: main 02-24 11:17:58.030: E/AndroidRuntime(1364): java.lang.NullPointerException 02-24 11:17:58.030: E/AndroidRuntime(1364): at com.example.androidhive.RegisterActivity$1.onClick(RegisterActivity.java:64) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.view.View.performClick(View.java:4202) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.view.View$PerformClick.run(View.java:17340) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.os.Handler.handleCallback(Handler.java:725) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.os.Handler.dispatchMessage(Handler.java:92) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.os.Looper.loop(Looper.java:137) 02-24 11:17:58.030: E/AndroidRuntime(1364): at android.app.ActivityThread.main(ActivityThread.java:5039) 02-24 11:17:58.030: E/AndroidRuntime(1364): at java.lang.reflect.Method.invokeNative(Native Method) 02-24 11:17:58.030: E/AndroidRuntime(1364): at java.lang.reflect.Method.invoke(Method.java:511) 02-24 11:17:58.030: E/AndroidRuntime(1364): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 02-24 11:17:58.030: E/AndroidRuntime(1364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 02-24 11:17:58.030: E/AndroidRuntime(1364): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>this is my php code -- </p> <pre><code>&lt;?php class DB_Connect { // constructor function __construct() { $sql = "CREATE TABLE IF NOT EXISTS users( uid int(11) primary key auto_increment, unique_id varchar(23) not null unique, name varchar(50) not null, email varchar(100) not null unique, encrypted_password varchar(80) not null, salt varchar(10) not null, created_at datetime, updated_at datetime null ); mysql_query($sql); } // destructor function __destruct() { // $this-&gt;close(); } // Connecting to database public function connect() { require_once 'include/config.php'; // connecting to mysql $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); // selecting database mysql_select_db(DB_DATABASE); // return database handler return $con; } // Closing database connection public function close() { mysql_close(); } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload