Jump to content
Larry Ullman's Book Forums

wormhandler

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by wormhandler

  1. Yes, thanks, I went through it again, found a couple of (what I thought were) minor things and uploaded it. The problem didnt appear. In fact it all went better than I expected!

     

    Ill now try something else I dont know enough about, and see if I can make that work! I must be getting old (64) because I am actually enjoying all the frustrations and eventual problem solving.

     

    Thanks again.

    • Upvote 1
  2. Ive adapted this script and it seems to work very well, apart from the following error

     

     

    Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpfinal\edit_usersllph.php on line 54

     

    I think I understand what the line is trying to do. Larry explains it very well in the book. So I dont get why its going wrong.

    Can anyone help? It doesnt stop the script and the changes are made.

     

    Here is the code again.

     

     

    $q = "SELECT customerID, cardholdersaddress FROM llphorders WHERE customerID = $id AND cardholdersaddress = $ln";

    $r = @mysqli_query($dbc, $q);

     

     

    if (mysqli_num_rows($r) == 0) {

     

    // Make the query:

    $q = "UPDATE llphorders SET cardholdersaddress='$ln' WHERE customerID= $id LIMIT 1";

    $r = @mysqli_query ($dbc, $q);

    if (mysqli_affected_rows($dbc) == 1) { // If it ran OK.

     

    // Print a message:

    echo '<p>The user has been edited.</p>';

     

    } else { // If it did not run OK.

    echo '<p class="error">The user could not be edited due to a system error. We apologize for any inconvenience.</p>'; // Public message.

    echo '<p>' . mysqli_error($dbc) . '<br />Query: ' . $q . '</p>'; // Debugging message.

    }

     

    } else { // Already registered.

    echo '<p class="error">The email address has already been registered.</p>';

    }

     

    } else { // Report the errors.

     

     

     

    I hope my changes look ok!

     

     

    Bill

  3. As I said at the top, on my pc are these versions.

    PHP version 5.3.8

    MySQL version 5.5.16

    Apache version 2.2.21

     

    however, my service provider has these

     

     

    PHP v 3.3.3

    MySQL v5.1.2

    no mention of Apache

    NOW, will I have problems?

    I think I am connecting to the server easily enough, and can SELECT and display the results in HTML, but am now having great difficulty in INSERTING data. Is it the versions please?

     

    Bill

×
×
  • Create New...