Ich habe ein Laravel-Problem für das Einfügen von Daten in MySQL-Datenbank festgestellt.Aufruf zu undefinierter Methode Illuminate Database Query Builder :: insertans()
Hier ist mein Controller in web.php:
Route::post('/insertans', '[email protected]');
Das ist mein PHP-Funktion Code für mysql:
function insertans(Request $req) {
$question1 = $req->input('question1');
$question2 = $req->input('question2');
$question3 = $req->input('question3');
$ans = array("question1"=>$question1,"question2"=>$question2,"question3"=>$question3);
DB::table('jawaban')->insertans($ans);
echo "Data successfully added";
}
Und das ist mein html für visuelle Zwecke
<!DOCTYPE html>
<html>
<head>
<title>PACKET A</title>
</head>
<body>
<form action="/insertans" method="post">
<table>
<tr>
{{ csrf_field() }}
<td>1.   What does HTTP stands for? </td>
 <td><input type="text" name="question1"></td>
</tr>
<tr>
<td>2.   What does JS stands for? </td>
 <td><input type="text" name="question2"></td>
</tr>
<tr>
<td>3.   What does CSS stands for? </td>
 <td><input type="text" name="question3"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
<td><input type="reset" name="cls" value="Cancel"></td>
</tr>
</table>
</form>
</body>
</html>
Welchen Fehler bekommen Sie? Bitte geben Sie so detailliert wie möglich das Problem an. – Peter4499