Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Content Count

    5034
  • Joined

  • Last visited

  • Days Won

    139

Larry last won the day on November 16

Larry had the most liked content!

Community Reputation

409 Excellent

About Larry

  • Rank
    Administrator/Writer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I think you're missing an equals sign. This code-- if (mysqli_num_rows($r) = $username) { --is trying to assign the value of $username to mysqli_num_rows($r), which of course isn't possible. You want == $username instead. But that still won't work because mysqli_num_rows() is going to return an array and what you need to do is compare an element in that array to $username.
  2. You'll just need to use the mail() function. You can learn all the details and see examples in the PHP manual: http://php.net/manual/en/function.mail.php
  3. Ah, excellent find and fix! Kudos for figuring that out and thanks for sharing the solution!
  4. Yes, you're on the right path. And the concepts are a bit confusing. Remember that cookies are sent back and forth between the server and the browser. The $_COOKIES array is populated by the browser sending cookies back to the server. On the login page, the PHP script sets the cookie which means the cookie doesn't exist when the page is first loaded (i.e., it's not sent from the browser to the server upon login submission). So the logic has to factor in that the login page DOESN'T have the cookie, despite actually setting the cookie. Conversely, the cookie exists on the logout page when the page is first loaded but is then deleted (i.e., the cookie is sent from the browser to the server when accessing the logout script). This means the logic has to factor in that the cookie DOES exist upon first running the page. It probably also helps to remember that the includes become part of the page that included them. So when login.php is run without receiving a cookie from the browser, the included file also don't receive that cookie. (In other words, the execution of the included file is not a separate request from the browser.)
  5. It looks like PayPal is now using the lowercase "verified" for the payer_status. You could switch to that or use stricmp() instead.
  6. There shouldn't be. Part of the point of paying for a web host is they should have this stuff set up and working for you.
  7. This should do it: $sql_money = "SELECT j_id, amount_invested FROM j_members WHERE j_activated = 1 LIMIT 5"; $result_money = mysqli_query($conn, $sql_money); $split = mysqli_fetch_all($result_money, MYSQLI_ASSOC); Yours wasn't working, by the way, because the query selects j_id and your code refers to $data['id'].
  8. The log file helps a lot to debug this. It doesn't look like there's anything obviously amiss, which is to say it looks like all checks are passing. I would next debug this by running your MySQL queries by hand with dummy data to make sure they're all syntactically correct. You can also write more debugging info to the log file, things like "Running the SELECT query." and "No records selected." This should help you know what lines get executed and which don't.
  9. You're running the values through escape_data(), which probably means that the incoming \n (for example) gets turned into \\n which is why nothing else works from there on. And I would just use nl2br() instead of str_replace().
  10. Working backwards, that error should be given when the page does not receive a numeric ID passed in the URL. I'd check for that first.
  11. That means your SELECT query isn't working. You'll need to run it separately on the server to see what the results are. Hint: the problem is syntactical, from "WHERE" on.
  12. Sorry to hear you're still having problems. I haven't been able to test anything yet, but I just found a version of an IPN PHP example from PayPal. The key bits are: https://github.com/paypal/ipn-code-samples/blob/master/php/PaypalIPN.php#L63-L139 Some modifications would be required (including changing self::VALID to "VERIFIED" on line 135). Let me know if you need any more details on how to adapt this.
  13. When you use mysqli_fetch_array(), you're fetching only a single record at a time. Therefore, in your loop, the $menu_row variable represents a single record. It does not represent every record. The elements within $menu_row are columns of the single record. The code you have is attempting to create ALL the navigation items once for each record in the database. This isn't what you want to do for several reasons. What you need to do here is fetch all the MySQL records first (using, say, mysql_fetch_all()). Then you'll have a multidimensional array. Then you create all the navigation items just one time, referring to the proper array element in each spot. As a debugging and learning trick, I'd recommend you get in the habit of using print_r() on your variables to see what values they have at certain points. That might help you understand better what's going on.
  14. You're definitely on the right path! The next step would be start creating additional tables. For example, you'd want a students table that maps student IDs to the student's name. That's all I'll say for now so you can continue to learn yourself, but let me know if you have more questions.
  15. You only fetched a single row, which is why you got that error. As I said previously, you need to fetch all the rows from MySQL first.
×