PHP Question/MySQL

Tengo una duda, ¿como hago para no tener que modificar un php para agregar datos a una tabla?, es que en app inventor tengo un spinner que se puede seleccionar las tablas y agregar datos en la tabla seleccionada.

Por ejemplo: Si tomo la tabla "tabla_usuarios" (que contiene 7 columnas) y agrego datos si lo permite pero si tomo la tabla "usuarios" no permite agregar datos.

(Mi PHP tiene 7 var para agregar datos)

// Juan Antonio Villalpando

// 1.- IDENTIFICACION nombre de la base, del usuario, clave y servidor

// mysql_select_db($db_name) or die(mysql_error());
$link = new mysqli($db_host, $db_login, $db_pswd, $db_name);
// Check connection
if ($link->connect_error) {
    die('Connect Error: ' . $mysqli->connect_error);
    mysqli_query($link, 'SET NAMES utf8');
	$nombre = $_POST['nombre'];
    $var1 = $_POST['var1'];
    $var2 = $_POST['var2'];
    $var3 = $_POST['var3'];
    $var4 = $_POST['var4'];
    $var5 = $_POST['var5'];
    $var6 = $_POST['var6'];
    $var7 = $_POST['var7'];
	echo $nombre;
	echo $var1;
	echo $var2;
	echo $var3;
	echo $var4;
	echo $var5;
	echo $var6;
	echo $var7;

    $hacer = mysqli_query ($link, "insert into $nombre values ('$var1', '$var2', '$var3', '$var4', '$var5', '$var6', '$var7')");
	$resultado = mysqli_query($link, $hacer)or die(mysqli_error()."<hr/>Line: ".__LINE__."<br/>$hacer");
    if($result == true){
        echo "OK_ADD";

I have a question, how do I not have to modify a php to add data to a table? In app inventor I have a spinner that can select the tables and add data to the selected table.

For example: If I take the table "user_table" (which contains 7 columns) and add data if it allows it, but if I take the table "users" it does not allow adding data.

(My PHP has 7 var to add data)

for example using this solution App Inventor Tutorials and Examples: MySQL | Pura Vida Apps

1 Like

and how can I place what is inside the text field inside a query?

use the join block to join everything you need to build your SQL statement and send that to the php script
it might be a good idea to try the example project together with the php script...

1 Like

And how do I put a query in a list view?

Put your query/queries in a list, and set the list to the elements of a listview

and how? D:


what I mean is to make a query for example "select * from table_users" and that the result appears in a listview

Well you do much the same thing with the




a query.

Converts the results to a list, and show in a list view.

If you are returning multiple columns, you will get a better "view" if you use the TableView extension

i can't, u can show me pls

Show what you have tried. Include your responseContent(results) as text

Seems you did not read/follow Taifun's mySQL guide correctly.

Where is your Web1.GotText event block?

very basically...


Hi again, any can help with the tableview?

Not sure I understand what all this is for:


based upon your raw response content, you should be able to feed this directly to the Tableview.Datastring

Also, ensure you have set the row delimiter to \n in the designer properties

Thank you very much, I did it, the last two things, how can I accommodate this in a uniform way, and the other, how can I add an upstream ID data automatically and not manually?

Stretch to Fit in the designer

Do not understand....

my table have the column "ID" what is auto_increment
pero no se como hacer para no tener que no ingresar un dato en la columna id