PHP MySQL Mise à jour


PHP MySQL Mise à jour

L'instruction UPDATE est utilisé pour modifier les données dans une table.

Jour des données dans une base de données

L'instruction UPDATE est utilisé pour mettre à jour des enregistrements existants dans une table.

Syntaxe

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Remarque: Notez que la clause WHERE dans la syntaxe UPDATE. La clause WHERE spécifie les dossiers ou documents qui doivent être mis à jour. Si vous omettez la clause WHERE, tous les enregistrements seront mis à jour!
Pour en savoir plus sur SQL, s'il vous plaît visitez notre tutoriel SQL .
Pour obtenir de PHP pour exécuter l'instruction ci-dessus, nous devons utiliser la fonction mysql_query () la fonction. Cette fonction est utilisée pour envoyer une requête ou une commande à une connexion MySQL.

Exemple

Plus tôt dans le tutoriel, nous avons créé une table nommée "personnes". Voici à quoi il ressemble:
PrénomLastNameÂge
PeterGriffon35
GlennBourbier33
Les mises à jour suivantes, par exemple certaines données dans l'affaire «Personnes» table:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

mysql_query("UPDATE Persons SET Age=36
WHERE FirstName='Peter' AND LastName='Griffin'");

mysql_close($con);
?>
Après la mise à jour, l'affaire «personne» de table ressemblera à ceci:
PrénomLastNameÂge
PeterGriffon36
GlennBourbier33

11 commentaires:

  1. Hello are using Wordpress for your blog platform?
    I'm new to the blog world but I'm trying to get started and create my own.
    Do you need any coding expertise to make your own blog?
    Any help would be really appreciated!
    hardwood flooring

    My weblog - hardwood floor refinishing

    ReplyDelete
  2. This is the right site for anyone who really wants to
    find out about this topic. You understand so much its almost tough to argue with you (not that I really will need to…HaHa).
    You definitely put a fresh spin on a subject that has been
    written about for years. Wonderful stuff, just wonderful!


    Also visit my webpage - hardwood flooring

    ReplyDelete
  3. That is a good tip especially to those new to the blogosphere.

    Short but very precise info… Appreciate your sharing this one.
    A must read article!

    Here is my web-site hardwood floors
    my web site :: hardwood flooring

    ReplyDelete
  4. My brother recommended I might like this website. He was
    totally right. This post truly made my day. You can not imagine simply how much time I had spent for this information!
    Thanks!

    my web site :: toenail fungus treatment

    ReplyDelete
  5. I am curious to find out what blog system you have been using?
    I'm experiencing some minor security problems with my latest blog and I'd like to find something more safeguarded.

    Do you have any suggestions?

    Take a look at my site: housekeeper resume sample

    ReplyDelete
  6. Nice weblog here! Additionally your website rather a lot up very fast!
    What web host are you the use of? Can I am getting your affiliate link for your host?
    I desire my site loaded up as quickly as yours lol

    Here is my web-site: housekeeping at hospitals

    ReplyDelete
  7. I know this website presents quality based posts and additional data, is there any other website which provides these data
    in quality?

    my website; sponsiblebuys.com
    My webpage - wetfouru.com

    ReplyDelete
  8. hello there and thank you for your info – I've definitely picked up anything new from right here. I did however expertise a few technical issues using this web site, since I experienced to reload the site lots of times previous to I could get it to load correctly. I had been wondering if your hosting is OK? Not that I'm complaining, but slow loading instances times will sometimes
    affect your placement in google and could damage your high quality score if advertising and
    marketing with Adwords. Well I am adding this RSS to my email and could look out for much more of your respective fascinating content.
    Make sure you update this again very soon.

    Feel free to visit my webpage - facebookpeace.com

    ReplyDelete
  9. Hi there, I desire to subscribe for this website to take most up-to-date updates, therefore where can i do it please help out.


    My blog post: http://jugaadbaba.in/index.php?do=/blog/50/for-natural-hair-regrow-it-is-worth-considering-hair-loss-vitamins
    My website > hair loss prevention product

    ReplyDelete
  10. Hello there! Quick question that's entirely off topic. Do you know how to make your site mobile friendly? My website looks weird when viewing from my iphone. I'm trying to
    find a theme or plugin that might be able
    to resolve this problem. If you have any recommendations, please share.
    Thanks!

    My page: cleaning companies

    ReplyDelete
  11. I really like what you guys are up too. This sort of clever work and reporting!
    Keep up the great works guys I've added you guys to my blogroll.
    hosting solution web

    Also visit my website - video cards

    ReplyDelete

HELLO VISITORS THANKS FOR YOUR VISIT AND COMMENT