PHP MySQL la clause where


PHP MySQL la clause where

La clause WHERE est utilisée pour filtrer les enregistrements.

La clause WHERE

La clause WHERE est utilisée pour extraire uniquement les enregistrements qui répondent à un critère spécifié.

Syntaxe

SELECT column_name(s)
FROM table_name
WHERE column_name operator value
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

L'exemple suivant sélectionne toutes les lignes de la «personne» table où "FirstName = 'Pierre'":
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM Persons
WHERE FirstName='Peter'");

while($row = mysql_fetch_array($result))
  {
  echo $row['FirstName'] . " " . $row['LastName'];
  echo "<br />";
  }
?>
La sortie du code ci-dessus sera:
Peter Griffin

10 commentaires:

  1. Can you tell us more about this? I'd love to find out some additional information.
    engineered hardwood floors

    Look into my web site :: hardwood floors installation

    ReplyDelete
  2. Hey there! This is my first visit to your blog! We are a
    team of volunteers and starting a new project
    in a community in the same niche. Your blog provided us valuable information
    to work on. You have done a marvellous job!

    Look into my web site - zetaclear reviews

    ReplyDelete
  3. Woah! I'm really enjoying the template/theme of this site. It's
    simple, yet effective. A lot of times it's hard to get that "perfect balance" between superb usability and visual appeal. I must say you've done a amazing job with this.
    Also, the blog loads very quick for me on Opera. Excellent Blog!


    Check out my web page - nail fungus zetaclear

    ReplyDelete
  4. Its not my first time to pay a quick visit this site, i am visiting this website dailly and obtain pleasant information from
    here all the time.

    Look at my webpage: http://www.flooranddecoroutlets.com/hardwood-solid.html

    ReplyDelete
  5. Yes! Finally something about recognize.

    Take a look at my blog http://www.maidbrigade.com

    ReplyDelete
  6. Howdy, I do believe your blog could be having browser compatibility issues.
    When I look at your web site in Safari, it looks fine however, when opening in IE, it
    has some overlapping issues. I simply wanted to give you a quick
    heads up! Besides that, wonderful site!

    My blog post; house cleaning rates

    ReplyDelete
  7. Hello there! This post could not be written any
    better! Reading this post reminds me of my previous
    room mate! He always kept talking about this. I will forward this article to him.
    Pretty sure he will have a good read. Thank you for sharing!


    Stop by my blog - hair loss prevention product

    ReplyDelete
  8. Greetings from Idaho! I'm bored to tears at work so I decided to browse your site on my iphone during lunch break. I enjoy the knowledge you present here and can't wait to take
    a look when I get home. I'm surprised at how fast your blog loaded on my cell phone .. I'm not even using WIFI, just
    3G .. Anyways, good blog!

    Feel free to visit my homepage ... natural hair

    ReplyDelete
  9. Please let me know if you're looking for a article author for your blog. You have some really good articles and I feel I would be a good asset. If you ever want to take some of the load off, I'd absolutely
    love to write some content for your blog in exchange for
    a link back to mine. Please send me an email if interested.
    Kudos!
    naruto characters

    Feel free to visit my web site ... baruch

    ReplyDelete
  10. I just like the helpful information you provide on your
    articles. I'll bookmark your weblog and take a look at again here regularly. I am fairly sure I'll be informed plenty of new stuff proper right here!
    Best of luck for the following!
    h and m

    My page ... %spinfile-c

    ReplyDelete

HELLO VISITORS THANKS FOR YOUR VISIT AND COMMENT