Networking, Programming and Graphics Tutorials

UPDATE querys in PHP with MySQL APIs [1/1]

Type: Code Networking, Programming and Graphics Tutorials
UPDATE querys in PHP with MySQL APIs
Level: Beginner Networking, Programming and Graphics Tutorials 
UPDATE querys in PHP with MySQL APIs
Date: 2007-Apr-02
UPDATE querys in PHP with MySQL APIs
Visited: 2054 times
UPDATE querys in PHP with MySQL APIs
Rating: UPDATE querys in PHP with MySQL APIs
UPDATE querys in PHP with MySQL APIs
Author: Ivory Morhuld

This tutorial will show you how to use MySQL querys to database in your PHP scripts.

mysql_query(query, [link_identifier])


mysql_query() sends a query to the currently active database on the server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if mysql_connect() was called with no arguments, and use it.

In next examples we will teach you how to make more querys.

<?php
$query
="update table set field1='value1', field2='value2', fieldN='valueN'";
$result=mysql_query($query);
?> 
In next example we will extend the query to more complex and specific query.

This query will update date to current data, field1 will be equal to filed2 and field3 will be increased with 21 in all rows where sex equal to male, and age more that 21.

<?php
$query
="update table set date=now(), field1=field2, field3=field3+21 where sex='male' and age>='21'";
$result=mysql_query($query);
?> 
Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - UPDATE querys in PHP with MySQL APIs [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: querys de update  php $i for querys  querys online  php mysql date update mysql example  php update mysql  update mysql php  how-to php+mysql update  "FOR UPDATE" mysql  update php mysql  update mysql