Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2017
    Posts
    845
    Rep Power
    0
    Originally Posted by DSmabismad
    No, mysqli_stmt_store_result() is used so that mysqli_stmt_num_rows() will work, this is in addition to, not instead of mysqli_stmt_bind_result(). Each of these statements do something different, that you can learn by reading the php.net documentation for each of them.

    And reading the php.net documentation will also tell you what value is returned by each statement. $result in the following line of your posted code does not have anything to do with the result set from the query -

    PHP Code:
    $result mysqli_stmt_store_result($stmt); 
    The value returned by mysqli_stmt_store_result() is either a Boolean true or false, depending on if that statement executed successfully or if it failed due to an error. Remove $result = from that line of code.
    Ok, did so and still working. Thanks!

    PHP Code:

    <?php 

    //Required PHP Files. 
    include 'config.php'
    include 
    'header.php'

    //Check if User is already logged-in or not. Get the login_check() FUNCTION to check. 
    if (login_check() === FALSE
    {
        
    //Redirect User to Log-in Page after 2 secs. 
        
    header("refresh:2; url=login.php"); 
        exit(); 

    else 

        
    $user $_SESSION["user"]; 
        
        
    $id $_SESSION["id"]; 
        
    $account_activation_status $_SESSION["account_activation_status"]; 
        
    $id_video_verification_status $_SESSION["id_video_verification_status"]; 
        
    $id_video_verification_url $_SESSION["id_video_verification_url"]; 
        
    $sponsor_username $_SESSION["sponsor_username"]; 
        
    $recruits_number $_SESSION["recruits_number"]; 
        
    $on_day_number_on_7_days_wish_list $_SESSION["on_day_number_on_7_days_wish_list"]; 
        
    $primary_website_domain $_SESSION["primary_website_domain"]; 
        
    $primary_website_email $_SESSION["primary_website_email"]; 
        
    $username $_SESSION["username"]; 
        
    $first_name $_SESSION["first_name"]; 
        
    $middle_name $_SESSION["middle_name"]; 
        
    $surname $_SESSION["surname"]; 
        
    $gender $_SESSION["gender"]; 
        
    $age_range $_SESSION["age_range"]; 
        
    $religion $_SESSION["religion"]; 
        
    $marital_status $_SESSION["marital_status"]; 
        
    $working_status $_SESSION["working_status"]; 
        
    $profession $_SESSION["profession"]; 
        
        
    $recipient_username $user;

        
    ?> 
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional/EN"> 
        <html> 
        <head> 
          <meta content="text/html; charset=ISO-8859-1"  http-equiv="content-type"> 
        <title><?php $user ?>Notices in <?php $server_time ?> time.</title>
        </head> 
        <body> 
        <br> 
        <center><span style="font-weight: bold;"><?php $user ?>Notices in <?php $server_time ?> time.</span></center> 
        <br> 
        <br> 
        
    <?php 
        
    if (!$conn)
    {
        
    $error mysqli_connect_error();
        
    $errno mysqli_connect_errno();
        print 
    "$errno$error\n";
        exit();
    }

    $query "SELECT id,date_and_time,recipient_username,sender_username,message FROM notices WHERE recipient_username = ?";

    if (
    $stmt mysqli_prepare($conn$query)) {

        
    /* bind param */
        
    mysqli_stmt_bind_param($stmt,'s',$recipient_username);
        
        
    /* execute statement */
        
    mysqli_stmt_execute($stmt);    

        
            
    mysqli_stmt_store_result($stmt);
        
    $rows_num mysqli_stmt_num_rows($stmt);
        
    printf("Result set has %d rows.\n",$rows_num);
      
    }
    }
    ?>
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2017
    Posts
    845
    Rep Power
    0
    Originally Posted by Sepodati
    PHP Code:
    $page_count 10;  
    $page_size ceil($rows_num $page_count);  
    //Get the Page Number, Default is 1 (First Page)  
    $page_number $_GET["page_number"];  
    if (
    $page_number == ""$page_number 1;  
    $offset = ($page_number -1) * $page_size;  
    $query .= " limit {$offset},{$page_size}"
    MOST people approach the problem, such as having 15 results, by showing 10 on the first page and 5 on the second. Your solution sure is unique.
    I do agree most ppl do it like that. Infact, I too think that is the only way to do it. But, is not this the case ? When I test, I see 10 results per page. Why do you see 15 ? Oh btw, that part of the code is not mine. I copied & pasted. I did say last night that, I would bug you guys to explain some part of the code that I copied from elsewhere. And since you were kind enough to find fault in the copied code and start criticising it then who better to ask more about it ?
    Someone, once upon a time, did point-out that there is an error on that part of the code but I did not quite understand him and thought he got his wires crossed. Now, since 2 ppl are pointing me to bring attention to this part of the code then I have no choice but to assume that the original coder got his wires crossed.
    Anyway, I'd like to see a sample from your end how you'd mend the code.
  4. #18
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Caro, Michigan
    Posts
    14,964
    Rep Power
    4576
    No.
    -- Cigars, whiskey and wild, wild women. --
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2017
    Posts
    845
    Rep Power
    0
    Originally Posted by Sepodati
    No.
    Why not ?
  8. #20
  9. Lord of the Dance
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Oct 2003
    Posts
    4,190
    Rep Power
    2012
    Originally Posted by UniqueIdeaMan
    Why not ?
    Because ... if you want some else to do some coding for you, please ask in the correct forum:
    Hire A Programmer
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo