Jump to content

7 eleven kind of problem....


mr cracker

Recommended Posts

Hello Guys, First Post!!!  :)

I´ll try to explain myself the best i can.

 

So, im writting a 7 eleven kind of program to use the computer as  a cash register.  Let´s say i am at the cash register/computer so a customer buys 2 or 3 cokes. So i have this form and textarea in my program in which you  insert the barcode numbers of the product, so you hit enter and it connects to de DB and checks for the corresponding barcode and returns the product, price etc. and it should display it in the screen in the space between the Registered Products line and the send button (see image below).  and then you insert the next product´s barcode and it should display below the first one and so on until you register all of them.

 

The form action is set to registroproducto.php and this is the php code of that file

<?php// RETRIEVES THE BARCODE
                $codigobarras=$_POST['codigobarras'];

			  // DB CONNECTION
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("bd_sistemaventas") or die(mysql_error());

// CHECKS FOR A BARCODE MATCH IN DB AND DISPLAYS THE PRODUCT INFO 	
$result = mysql_query("SELECT codigobarras,familia,descripcion,precio,costo,proveedor FROM tbl_productos WHERE codigobarras = '$codigobarras'");
if (!$result) {
    echo 'No se puede ejecutar el query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);

echo $row[0]; // codigo de barras
$descripcion = $row[2]; // descripcion
$precio = $row[3]; // precio

// INSERTS THE JUST REGISTERED PRODUCT IN THE DB SO I CAN  SAVE IT SOMEWHERE AND DISPLAY IT WITH THE NEXT  REGISTERED PRODUCTS IN A LIST LIKE FORM				
mysql_query("INSERT INTO tbl_ventas 
(id_venta, numventa, concepto, precio) VALUES('',  '1', '$descripcion', '$precio') ") 
or die(mysql_error());  				



			  ?>

I have no idea how to do it, :wtf: i´ve tried for 4 hours straight and did not work.  please help.  Thank you Guys!  :D

 

sales.gif

Link to comment
https://forums.phpfreaks.com/topic/200003-7-eleven-kind-of-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.