Hi i made a jquery mobile website, but when i upload it to Phoegap and test, i can't connect to the database. I'm using the Dreamweaver login form in php, and loading from a database.

Code to load from database:

// *** Validate request to login to this site.
if (!isset($_SESSION)) {

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];

if (isset($_POST['UserName'])) {
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "assets/inicio.php";
  $MM_redirectLoginFailed = "index.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_root, $root);

  $LoginRS__query=sprintf("SELECT UserName, Password FROM Users WHERE UserName=%s AND Password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 

  $LoginRS = mysql_query($LoginRS__query, $root) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";

    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;       

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );

And here's the database info in php:

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_root = "myhost.com";
$database_root = "dbname";
$username_root = "dbuser";
$password_root = "dbpass";
$root = mysql_pconnect($hostname_root, $username_root, $password_root) or trigger_error(mysql_error(),E_USER_ERROR); 

Please help!

1. You are querying database on localhost, installed on your own machine. Check some tutorials how to set it properly
2. You did not provide network permissions for the app
3. Check the logs for possible error messages

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.