How to display data from mysql using angular.js PHP?

后端 未结 1 371
一整个雨季
一整个雨季 2020-12-15 12:10

How to print data recieved from mysql using angular.js PHP. I want to know how to connect with mysql and angular.js

I tried with node.js mongodb. but wants to know a

1条回答
  •  被撕碎了的回忆
    2020-12-15 13:08

    Hi Can you check following sample code your HTMLpage :

    
        
            AngularJs Post Example: DevZone.co.in 
            
            
        
        
            
    • {{ error}}
    • {{ msg}}

    Sigup Form

    Devzone.co.in //////////////////////////////////////////////////////////////////////// Your php code uname); $upswd = mysql_real_escape_string($data->pswd); $uemail = mysql_real_escape_string($data->email); $con = mysql_connect('localhost', 'root', ''); mysql_select_db('test', $con); $qry_em = 'select count(*) as cnt from users where email ="' . $uemail . '"'; $qry_res = mysql_query($qry_em); $res = mysql_fetch_assoc($qry_res); if ($res['cnt'] == 0) { $qry = 'INSERT INTO users (name,pass,email) values ("' . $usrname . '","' . $upswd . '","' . $uemail . '")'; $qry_res = mysql_query($qry); if ($qry_res) { $arr = array('msg' => "User Created Successfully!!!", 'error' => ''); $jsn = json_encode($arr); print_r($jsn); } else { $arr = array('msg' => "", 'error' => 'Error In inserting record'); $jsn = json_encode($arr); print_r($jsn); } } else { $arr = array('msg' => "", 'error' => 'User Already exists with same email'); $jsn = json_encode($arr); print_r($jsn); } ?>

    Please checkthe above code you will be understand how it will work. If any problem you are facing just tell me here in comment line

    0 讨论(0)
提交回复
热议问题