Results 1 to 8 of 8

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User zombie13's Avatar
    Join Date: Oct:2012
    Location: Bulgaria - Ruse
    Posts: 63

    PHP - mysqli_query

    ,
    :
    email_list - first_name,last_name,email.
    John,Simpson,john@yahoo.com

    show_data.php

    PHP Code:
    $dbc mysqli_connect('localhost','root','','customersDB') or die('Error connecting to MySQL server.');
    $query "SELECT first_name,last_name FROM email_list WHERE email='peter@yahoo.com'";

    $result mysqli_query($dbc,$query) ;


    if(!
    $result){
        echo 
    'No people found!';
    }else{
            while(
    $row mysqli_fetch_array($result)){
            echo 
    $row['first_name']. ' '.$row['last_name'].'<br />';
        }


    $query , elsa , if .

    var_dump($result)
    Code:
    object(mysqli_result)[2]
      public 'current_field' => null
      public 'field_count' => null
      public 'lengths' => null
      public 'num_rows' => null
      public 'type' => null
    ? PHP

  2. #2
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    - , ?
    ( ), $result (), if (!$result) .
    ( ).
    num_rows() mysqli_result , .

    Edit: , , num_rows , , ..
    $result->num_rows > 0.
    Last edited by tedych; 28th November 2012 at 11:50.

  3. #3
    Registered User zombie13's Avatar
    Join Date: Oct:2012
    Location: Bulgaria - Ruse
    Posts: 63
    tedych e . ! ! .

  4. #4
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    mysqli_result

    mysqli_result implements Traversable {
    /* Properties */
    int $current_field ;
    int $field_count;
    array $lengths;
    int $num_rows;

    .....
    }
    $result->num_rows .

  5. #5
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , , , , .
    , (), .
    "", "" " " , . .

  6. #6
    Registered User zombie13's Avatar
    Join Date: Oct:2012
    Location: Bulgaria - Ruse
    Posts: 63


    PHP Code:

    ....

    if(!
    mysqli_num_rows($result)){
        echo 
    'No people found!';
    }else{
            while(
    $row mysqli_fetch_array($result)){
            echo 
    $row['first_name']. ' '.$row['last_name'].' '.$row['email'].'<br />';
        }
    }

    .... 
    .

    , !

  7. #7
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , . , () - mysql_ , .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |