My app with web database does not work

The code performs locally. When I switch from locally to web server, it does not run.
Variable C_mes does not exist
lerapagar.phpcodigo2 codigo1 rotinas2

Rogerio, what exactly is not working? Your code in PHP or your app when using the PHP code?

Hello. In the tests of the PHP code, I noticed that the names of the tables have to be all in small. I circled within PHPADMIN online and came to that conclusion. But the error persists.
PHP code in web host:
$c_cpf = $_POST[‘c_cpf’] ;
$c_anoletivo = $_POST[‘c_anoletivo’];
$db = new Db();
$dados=array();
$sqlBusca ='SELECT alunos.cnomealu,tbdiario.cn1,tbdiario.cn2, tbdiario.cn3,tbdiario.cn4,tbmateria.cabrev FROM ';
$sqlBusca .='tbdiario INNER JOIN alunos ON alunos.ncodaluno=tbdiario.ncodaluno ';
$sqlBusca .='INNER JOIN tbementa ON tbdiario.ccodementa=tbementa.ccodementa ';
$sqlBusca .='INNER JOIN tbmateria ON tbmateria.ncodmat=tbementa.ncodmat ‘;
$sqlBusca .=‘INNER JOIN tbturma ON tbementa.ncodtur=tbturma.ncodtur ‘;
$sqlBusca .=‘WHERE alunos.ccpf="’.$c_cpf.’" and tbturma.cletivo="’.$c_anoletivo.’" Order by tbmateria.cnomemat ';

Already changed :

  • table names for minuscule
  • single quotes for double
  • ’ .$c_anoletivo. ’ to " ‘.$c_anoletivo.’ " (because the fields values ​​are strings)
  • $c_anoletivo variable name to $x_anoletivo

Hello people. After stopped 3 months, I went back to trying to make the KODULAR app access remote mysql database. The problem was: the version of PHP that was installed on the server did not recognize the function, mysqli_connect () from PHP. This generated the “Call to undefined function mysqli_connect ()” error. I got this error by running the PHP file inside the server folder. My idea is to have a local client server desktop system also supplying a remote database. This remote bank will be accessed by a Kodular app.

yes you can do this, but on the desktop a web server must be running…
you could look into XAMPP


see also App Inventor Tutorials and Examples: MySQL | Pura Vida Apps

Taifun

Good morning. I already use XAMPP, so the app ran locally on XAMPP and it did not run on the remote server. I discovered that it was the PHP version installed on the remote server. The version did not recognize the myslqi_connect function. After changing the PHP version, it ran Ok, doing a SQL query, super fast, with 4 tables (Inner Join) where the main table has more than 100.000 records. Thank You.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.