Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

it's been a week that i'm working with a project with angularJS and all i want is to display data after submit the form .
i did this with php and mysql and could'nt show data from database .
php

$data = json_decode(file_get_contents("php://input"));
$subject = mysql_real_escape_string($data->subject);
$body = mysql_real_escape_string($data->body);
mysql_select_db("angular") or die(mysql_error());
mysql_query("INSERT INTO newstory (subject,body) VALUES ('$subject', '$body')");
Print "Your information has been successfully added to the database.";



$query = "SELECT * FROM newstory";
$result = mysql_query($query);

$arr = array();
while ($row = mysql_fetch_array($result)) {
    $subject = $row['subject'];
    $body = $row['body'];
    $arr[] = $row;

}

$json_response = json_encode($arr);
echo $json_response;

Now i want to work with $resource and i got a question !!
Should i use this with mongoDb ?as i know mongo is a database like mysql !
can i use $resource with mysql ?
thx in advance

share|improve this question
1  
$resource is just a way of interacting RESTfully, so PHP/MySQL works fine as an endpoint, no other necessary pieces are required although MongoDB is usually preferred because the way the data is stored is more suitable for modern REST/JSON web services. –  Dylan 18 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.