mr cracker Posted April 28, 2010 Share Posted April 28, 2010 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, i´ve tried for 4 hours straight and did not work. please help. Thank you Guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.