Jump to content

Mysql_query not doing anything


JChilds

Recommended Posts

Hi all,

I have been stuck on this for ages and have no idea what is wrong.

 

Nothing is happening (iin the database)

 

Here is the doce

 

<?php
$host="localhost";

                                              $username="root";

                                              $password="";

                                              $db_name="TMT";
                                              

                                       
				      
				      // Reusable connection for my own sanity:

				      // Establish database link
				      $mysql_twtamer = mysql_connect($host, $username, $password)
				      or die ("Cannot make the connection");
				      mysql_select_db($db_name, $mysql_twtamer)
				      or die ("Cannot connect to the database");

				      
				      

mysql_connect("$host", "$username", "$password")or die("cannot connect to server");

                                              mysql_select_db("$db_name")or die("cannot select db");





$barcode = $_POST['Barcode'];
$description = $_POST['Description'];
$code = $_POST['Code'];
$previous_price = $_POST['Previous_Price'];
$invoice_price = $_POST['Invoice_Price'];
$qty_ordered = $_POST['Qty_Ordered'];
$qty_delivered = $_POST['Qty_Delivered'];


echo $barcode."<br>";
echo $code."<br>";
echo $description."<br>";
echo $qty_delivered."<br>";
echo $invoice_price."<br>";

		mysql_query("INSERT INTO items(Barcode, Code, Description, Qty, Price) VALUES('$barcode', '$code', '$description', '$qty_delivered', '$invoice_price'");


		$new_qty = $i - $qty_delivered;
		mysql_query("UPDATE invoices SET qty = $new_qty WHERE qty=$i AND code=$code");
?>

Link to comment
https://forums.phpfreaks.com/topic/204248-mysql_query-not-doing-anything/
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.