Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

reda1109's avatar

"SQLSTATE[42S02]: Base table or view not found: 1146 Table

I have written two laravel apps. FirstApp and CryptoApp ( name of apps respectively )

In which I send encrypted text to a function called ( Decrypt ) in CryptoApp that is supposed to return decrypted text

In FirstApp i am sending a curl POST request with the encrypted text to CryptoApp

cURL post code: inside FirstApp

private function DecryptApi($data) {

$ch = curl_init();                    // initiate curl
$url = "http://crypto.dev/Decrypt"; // where you want to post data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, "data=".$data); // define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
$output = curl_exec ($ch); // execute

curl_close ($ch); // close curl handle

return $output; // show output

} The Route : Route::post('/Decrypt','CryptoController@Decrypt');

The Function :

public function Decrypt(Request $request) { $crypt = Crypto::find(1);

return openssl_decrypt($request['data'],"AES-256-CBC",$crypt->secretKey,0,$crypt->iv);

} the Error i am getting is : "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel_firstapp.crypto' doesn't exist (SQL: select * from crypto where crypto.id = 1 limit 1)"

this error has confused me because i know that FirstApp does not have a table named 'crypto' but CryptoApp does, why is laravel not returning the text i want ?

0 likes
0 replies

Please or to participate in this conversation.