|
Posted by fedor on 12/05/06 00:27
I have two peaces of code which are allmost the same.
The first -see the comment OK- executes
the second -NOK- (as I see it) generates an error.
Why executes the first and the second not. Is it because the second is a
char and the first an integer.
Or is it because one of the names is a reserved word or is b1
hexadecimal.
I am looking at this code and do not know how to continue the coding.
Can you and give me an advice?
thanks in advance.
ERROR
Could Not Execute SQL statementUnknown column 'b1' in 'where clause'
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in
/nfs/vsp/dds.nl/t/thmulder/public_html/topbimini.nl/upd/vinalux_modify2.php
on line 21
CODE
<?php
include "db.php";
$link = mysql_connect("$hostname", "$username", "$password");
if(!$link)
print "Could Not Connect to DB Server";
$db = mysql_select_db("$databasename", $link);
if(!$db)
print "Could Not Open DB";
$query = "select * from vinalux join (size, price)
where vinalux.size_key = size.size_key
and vinalux.size_key = price.size_key
and vinalux.fabric = price.fabric
and vinalux.vinalux_id =
$_POST[vinalux_id]
order by vinalux.vinalux_id, vinalux.size_key,
vinalux.color";
$result= mysql_query($query);
if(!$result)
print "Could Not Execute SQL statement".mysql_error();
while($row = mysql_fetch_array($result))
{
$query = "update vinalux
set qty = qty - 0
where vinalux_id = $_POST[vinalux_id]";
/* OK */
$result= mysql_query($query);
if(!$result)
print "Could Not Execute SQL statement".mysql_error();
$query = "update size
set size_qty = size_qty - 0
where size_key = $_POST[size_key]";
/* NOK */
$result= mysql_query($query);
if(!$result)
print "Could Not Execute SQL statement".mysql_error();
}
$r = mysql_affected_rows();
if($r == 1)
header("location:vinalux_modify_confirm.php");
?>
Navigation:
[Reply to this message]
|