Fatal error: Uncaught Error: Call to undefined function mssql_connect() (PHP) JSON Request -
this question has answer here:
am trying run php file gives me error
<?php include ('json.php'); if(isset($_post['location_name']) && isset($_post['location_details ']) && ($_post['item_name']) && ($_post['item_price'])){ $location_name = $_post['location_name']; $location_details = $_post['location_details']; $item_name = $_post['item_name']; $item_price = $_post['item_price']; $query = "insert gpsnear(location_name, location_details, item_name, item_price) " . "values('$location_name', '$location_details', '$item_name', '$item_price')"; $data = mysqli_query($conn, $query); $gpsnear = array(); if($data){ $id = mysqli_insert_id($conn); $q = "select * gpsnear id = $id"; $r = mysqli_query($conn, $q); $row - mysqli_fetch_assoc($r); $gpsnear['location_name'] = $row['location_name']; $gpsnear['location_details'] = $row['location_details']; $gpsnear['item_name'] = $row['item_name']; $gpsnear['item_price'] = $row['item_price']; echo json_encode($gpsnear); } else { echo "error!"; } exit(); } ?> as parsing json file need read php file json oject gives me error this
fatal error: uncaught error: call undefined function mssql_connect() in c:\xampp\htdocs\apiforandroid\json.php:14 stack trace: #0 c:\xampp\htdocs\apiforandroid\gpsnear.php(2): include() #1 {main} thrown in c:\xampp\htdocs\apiforandroid\json.php on line 14 sorry if thing not clear enough , if there's thing missing
this json.php
<?php /* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ $myserver = "localhost"; $myuser = "root"; $mypass = "testroot"; $mydb = "yourneeds"; $conn = mssql_connect($myserver,$myuser,$mypass); if (!$conn) { die('not connected'); } ?> .......................................................
php 7 being used , mssql_connect has been dropped in php 7 therefor function cannot found , used.
you should switch different method pdo
Comments
Post a Comment