brilliant. that done it, thanks for your help. i see what i done, thanks againCelauran wrote:No. You're getting the error becausejonnyfortis wrote:like this??Celauran wrote:You needed the ; after mysql_query() when the next line was commented out. Now you need to put it back.Code: Select all
$result=mysql_query($query); or die(mysql_error());is not a valid statement. You needCode: Select all
or die(mysql_error());Code: Select all
$result=mysql_query($query) or die(mysql_error());
update sql not updating
Moderator: General Moderators
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: update sql not updating
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: update sql not updating
i have just noticed something. even though this works, should my query not include a reference to the database connection
should be
Code: Select all
$result=mysql_query($UpdateQuery) or die(mysql_error());Code: Select all
$result=mysql_query($UpdateQuery, $wiz) or die(mysql_error());Re: update sql not updating
As per the manual, it's optional. http://php.net/manual/en/function.mysql-query.php
Your code shouldn't be using mysql_query, and definitely shouldn't have die statements in it.
Your code shouldn't be using mysql_query, and definitely shouldn't have die statements in it.
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: update sql not updating
sorry bit confused, this is for another UPDATE statement to update stock, this is working but i wanted to know if it needed to included the database, as you say its optional.Celauran wrote:As per the manual, it's optional. http://php.net/manual/en/function.mysql-query.php
Your code shouldn't be using mysql_query, and definitely shouldn't have die statements in it.
Code: Select all
if ($row_rsUpdateStock['TransactResult'] == 'Completed') {
// UPDATE THE DATABASE
$oldStock = $row_rsUpdateStock['Stock'];
$stockSold = $row_rsUpdateStock['Quantity'];
$newStock = $row_rsUpdateStock['Stock'] - $row_rsUpdateStock['Quantity'];
$SKU = $row_rsUpdateStock['SKU'];
$UpdateQuery="UPDATE wiz_Stock SET Stock = '$newStock' WHERE wiz_Stock.SKU = '$SKU'";
$result=mysql_query($UpdateQuery);
$result=mysql_query($UpdateQuery) or die(mysql_error());
}