-4
Example: I have a product with 10 units registered in a database, a customer buys 1 unit, this unit gives low and product quantity goes to 9 units.
How to express this in PHP?
-4
Example: I have a product with 10 units registered in a database, a customer buys 1 unit, this unit gives low and product quantity goes to 9 units.
How to express this in PHP?
5
Any system has as a basis for managing information several databases such as Mysql, Postgresql, MARIADB ... CRUD is independent of the programming language used.
CRUD are four basic operations used in relational databases to manage all information to be stored, searched and deleted.
From the moment you understand and understand the CRUD process you will be able to interact with the SGDB of your choice. One of the most widely used on the market is Mysql, mainly when it comes to PHP programming language.
Once you store all your information within variables and send and receive the necessary information via commands $_GET[]
, $_POST[]
and $_REQUEST[]
, you can send and receive them from your Mysql. In most cases, this information travels via the above mentioned forms or commands.
Example of sending and receiving information:
$produto = $_POST['nome_produto'];
$preco = $_POST['preco'];
$quantidade = $_POST['quantidade'];
Example of connection to the database
mysql_connect('host', 'user', 'pass');
mysql_select_db('db');
Use Mysqli or PDO, Mysql is being discontinued.
Once you are connected to the database, use Xampp or Wampserver to work on a local machine (localhost, on your pc), you can start using CRUD ...
CRUD
mysql_query("INSERT INTO (colunas) VALUES (valores) ...);
mysql_query("SELECT * FROM vendas WHERE id_compra = '10');
mysql_query("UPDATE vendas SET pago = 'pago' WHERE id_compra = '10';
mysql_query("DELETE FROM vendas WHERE id_compra = '10'");
There is vital information for all people who need to start treading the path of stones in the programming area.
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
Hello Marcelo Gomes, welcome to [pt.so]. I noticed that I had several questions closed recently. I suggest you read the guide [Ask] and make a [tour] to increase your chances of getting a good answer.
– Math