Jump to content

Ayuda crear sistema de puntos


Recommended Posts

algo asi:

 

mysql

id|rut|nombre|puntos

el form para obtener los puntos del cliente con el rut del user:

<form method="post" action="pesos.php">
<input type="text" name="rut-cliente" /><br />
<input type="submit" value="Ver puntos clientes" />
</form>

el php

<?php

.....mysql <- toda la mierdis de conexion y seleccion del usuario

$ususario = select_con_el_rut;

echo "El usuario "+$usuario["nombre"]+" tiene un total de: "+$usuario["puntos"]+" puntos";

?>

Ahora para agregar puntos al ususariio con el rut

<form method="post" action="compra.php">
<input type="text" name="rut-cliente"><br />
<input type="text" name="compra" / ><br />
<imput type="submit" value="Ingresar">
</form>

el php

<?php

$puntosPorPeso = 1000; //aca elijes.. 
$compra = $_POST["compra"];

.....mysql <- toda la mierdis de conexion y seleccion del usuario

$usaurio = slelect_por_rut:

$puntos = $usuario["puntos"]+($compra*$puntosPorPeso);

insert_en_el_usuario_puntos = $puntos;

?>

Para usar puntos por rut

<form method="post" action="usar.php">
<input type="text" name="rut-cliente" /><br/>
<input type="text" name="puntos" /><br/>
<input type="submit" value="usar">
</form>

el php

<?php

$puntos = $_POST["puntos"];

.....mysql <- toda la mierdis de conexion y seleccion del usuario

$ususario = select_con_el_rut;

$puntos2 = $usuario["puntos"]-$puntos;

insert_en_el_usuario_puntos = $puntos2;

?>

no quise poner las declaraciones de mysql porque me dió lata hacerlo todo...

 

Edito, es algo super vago pero es la idea... si necesitas más ayuda mande....

Edited by cañangasñangas
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...