T
T
tmnovice2015-11-29 19:30:56
PHP
tmnovice, 2015-11-29 19:30:56

Updating data in mysql vs.?

Hello.
Through this query, I add fields such as model (article), quantity (quantity) and price (price) to the product database. How now to make an update in the database compared to the article? (model) i.e. so that only the price and quantities are updated, and with the article it only compares exactly where to update / add the price
$ins="INSERT INTO `product` (`model`,`quantity`,`price`
)VALUES('$cell1','$cell2 ','$cell3')";
$query = mysql_query($ins);
if(!$query){
die('Error');
}
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2015-11-29
@Rsa97

UPDATE `product` (`quantity`, `price`) WHERE `model` = :model

And don't use mysql_ functions, they've been deprecated for two years now. use parametrized mysqli_ or PDO queries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question