Salams,
I am making an inventory management web app as a personal project and I need help with deciding on the back end.
Firstly, I have no formal training in web development, I used the missing manual php book and Rob Percival's udemy course to make my FYP and am only using free online resources, mostly Youtube, to continue the learning parts of this.
I am currently using a kind of fake REST api as PUT and DELETE requests give a 405 "Request not allowed" error. So I did used POST and some flags( I don't know the proper term if there is one) like this instead:
It is working perfectly but he problem is, more complex data is to be retrieved and sent later and I am not sure I should continue with this messy kind of solution.
Error handling is also a mess for me in PHP/javascript as I don't know any if tools exist for it. I mistakenly used mysql_query instead of mysqli_query due to notepad++'s built in suggessions and spent almost an hour before figuring out why the edit_item function was not working. I really don't want to run into that kind of stupidity again.
Writing so much code to just get some simple data also seems like I am doing something wrong.
I could abandon the PHP version and start on ASP.net or Java or even learn Ruby but then the problem is with hosting the back end but then hosting may become a problem.
Can someone suggest how I continue this?
I am making an inventory management web app as a personal project and I need help with deciding on the back end.
Firstly, I have no formal training in web development, I used the missing manual php book and Rob Percival's udemy course to make my FYP and am only using free online resources, mostly Youtube, to continue the learning parts of this.
I am currently using a kind of fake REST api as PUT and DELETE requests give a 405 "Request not allowed" error. So I did used POST and some flags( I don't know the proper term if there is one) like this instead:
PHP:
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
require_once('../../../scripts/database_connection.php');
if(isset($_POST["edit_id"]) && isset($_POST["name"]) && isset($_POST["description"]))
{
$id = trim(mysqli_real_escape_string($link, $_POST["edit_id"]));
$name = trim(mysqli_real_escape_string($link, $_POST["name"]));
$description = trim(mysqli_real_escape_string($link, $_POST["description"]));
$data = edit_item($link, $id, $name, $description);
deliver_response(200,"item edited", $data);
}
else if(!isset($_POST["edit_id"]) && isset($_POST["name"]) && isset($_POST["description"]))
{
$name = trim(mysqli_real_escape_string($link, $_POST["name"]));
$description = trim(mysqli_real_escape_string($link, $_POST["description"]));
$data = add_item($link, $name, $description);
deliver_response(200,"item added", $data);
}
else if(isset($_POST['delete_id']))
{
$id = trim(mysqli_real_escape_string($link, $_POST["delete_id"]));
$data = delete_item($link, $id);
deliver_response(200,"item deleted", $data);
}
else
{
deliver_response(200,"NO DATA ENTERED",NULL);
}
}
Error handling is also a mess for me in PHP/javascript as I don't know any if tools exist for it. I mistakenly used mysql_query instead of mysqli_query due to notepad++'s built in suggessions and spent almost an hour before figuring out why the edit_item function was not working. I really don't want to run into that kind of stupidity again.
Writing so much code to just get some simple data also seems like I am doing something wrong.
I could abandon the PHP version and start on ASP.net or Java or even learn Ruby but then the problem is with hosting the back end but then hosting may become a problem.
Can someone suggest how I continue this?