hello I just started to developed with Ionic and I want to know how to connet Ionic mobile application with MySQL database please?
thank u
If youâre using Ionic 2 you can check this out: http://www.joshmorony.com/using-http-to-fetch-remote-data-from-a-server-in-ionic-2/
Specifically the âPulling data from your own serverâ section.
this is our code i would like to connect ionic mobile with mysq database for a wordpress site:
newsletter.html
<button type="submit" class="register button button-block" ng-click="Newsletter(input)" ng-disabled="signup_form.$invalid">
S'inscrire
</button>
<p ng-show="error" class="message error">{{error}}</p>
</div>
</form>
controller.js
.controller(âNewsletterCtrlâ, function($scope, $http) {
$scope.Newsletter = function(input) {
$http.post("http://www.dev.leclubdesjuristes.com/api/page-inscriptionnewsletter.php/?email="+input+"");
}})
app.js
.state(âapp.newâ, {
url: â/newsletterâ,
views: {
âmenuContentâ: {
templateUrl: âviews/app/newsletter.htmlâ,
controller: âNewsletterCtrlâ
}
},
data: {
authenticate: true
}
})
page-inscriptionnewsletter.php
<?php /* Template Name: Inscription newsletter mobile */ ?> <?php get_template_part('templates/header'); ?><?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h1 class="title-post"><?php the_title(); ?></h1>
<?php the_breadcrumb(); ?>
<div class="content-post">
<?php
$data = json_decode(file_get_contents("php://input"));
$email = mysql_real_escape_string($data->email);
$qry = 'INSERT INTO lcdjwp_newsletter (email) values ("'.$email.'")';
$qry_res = mysql_query($qry);
if ($qry_res) {
$arr = array('msg' => "Email Created Successfully!!!", 'error' => '');
$jsn = json_encode($arr);
print_r($jsn);
} else {
$arr = array('msg' => "", 'error' => 'Error In inserting');
$jsn = json_encode($arr);
print_r($jsn);
}
?>
<?php the_content(); ?>
</div>
<!-- .content-post -->
<?php endwhile; ?>
<?php else : ?>
<!-- Si il n'y a pas de Post, j'affiche cette partie -->
<?php endif; ?>
you can refer to the link.
just follow this tutorial in this clear all the sites
hello
i want small help
i created a small register page in ionic and how to store that data into database using php please send me code or screenshots.
otherwise please send me atleast instructions.