Larry
Administrators-
Posts
5413 -
Joined
-
Last visited
-
Days Won
155
Everything posted by Larry
-
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
I just emailed you the same code I linked above. What happens when you run this? Do you see any error messages? Your last three posts don't include any details. -
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
I can email you the code but it'd be the exact same file downloaded from here: https://github.com/LarryUllman/phpmysqlvqp-5ed/blob/master/ch09/script_09_03/register.php What happens when you run this? Do you see any error messages? Your last two posts don't include any details. I can't speak for other writers, but the code in my books is generally not for illustration purposes. It worked when I wrote the book! However, code is not like a light bulb that can be screwed in in any socket (and even light bulbs vary quite a bit). Code runs within an environment; code that worked on one environment may not work on another, although PHP works across most environments well. You haven't yet said what version of PHP and OS you're using, which may shed some light on the issue. As a database expert, I'm sure you can appreciate this. I could do a MySQL 5.3 dump of a database that can't be imported into a MySQL 5.7 database, let alone a MySQL 8. That doesn't mean the dump was invalid, just that it won't work as-is for all situations. -
Related to pcre
Larry replied to vikky's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
Okay, your current rule is: RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9\%\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3 That looks correct but PCRE can be tricky. Your error message is odd, though, making me think maybe there's another problem. Does the browse script work for other categories? Can you load browse.php directly (it'll probably give an error but it should still run)? What happens if you go to localhost/browse.php?type=goodies&category=Books+%26+DVDs&id=3 directly? -
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
I would also double-check that you're running/editing the file you think you are (this chapter has multiple versions of register.php). And if it's still not obvious what's going on, please confirm your PHP version and OS. Oh, and when mentioning errors it's best to include the specific error that you're seeing. Thanks! -
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Yes, the code in the book does work. I used it while writing the book and for all the images I took. I'm a bit confused by what you're saying in this last post, though. I just downloaded the script from the site and ran it again, unedited. Here is the initial load: And after clicking "Register" without entering anything: I'm not seeing a parse or other error. -
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Yes, the code in the book does work. I used it while writing the book and for all the images I took. I'm a bit confused by what you're saying in this last post, though. I just downloaded the script from the site and ran it again, unedited. Here is the initial load: And after clicking "Register" without entering anything: I'm not seeing a parse or other error. -
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
Hmmm... I don't see anything obviously wrong. That normally means there's a gremlin character in there, like a straight quote that's actually curly or the like. These aren't as easy to debug. I'd try retyping or copying-pasting the first few lines (from a clean source). Otherwise you'll need to debug backwards to find the exact line causing the problem. For example, if you remove line 10 (which you can do here without causing a new parse error), does the current error go away? -
The "root" directory is the base or initial directory. In other words, when you unzip the file it creates a folder and when you open that folder, you're in the root directory. This is what the root directory looks like: https://github.com/LarryUllman/phpmysqlvqp-5ed The file you want is https://github.com/LarryUllman/phpmysqlvqp-5ed/blob/master/sql.sql
-
$errors = []
Larry replied to SledgeDB's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
You have a parse error in your script. This is normally caused by missing a matching parentheses, quote, bracket, or the like. It's possible it's on line 10 or, if not, then on a previous line but not triggered until line 10. If you need additional help identifying the problem, please post the actual code you're using. -
Thanks so much for the nice words. I really appreciate it. And it's great to hear you've been able to make great use of the information already! Thanks, too, for the suggestion. I thiiiiink I actually wrote such an example in one of my books, but I forget which now. Personally, though, I prefer to backup databases using the command-line tools, although that does require better access and knowledge. In any case, thank you again for the nice words and suggestion. Cheers!
-
That's not what's happening. $row['last_name'] refers to a specific column from a returned row. The sort=ln bit is used in the code to dynamically change the ORDER BY clause. Yes! If you're getting that error, you're missing the includes/footer.html file in your web directory. I'm fairly sure there should be a header file, too. I'd double-check the book's directions. It may be re-using a header file from a previous chapter. If you're seeing the source code, it could be because you're not accessing the page through HTTP.
-
You should debug the query itself to start. See if the query is returning exactly one row or not. If not, then you need to debug it backwards to see if the problem is: The value of $e in the PHP script The value of email in the database If active has a null value in the database (not an empty value)
-
Hello! First, just so you know, these forums aren't that active. I check them three days a week myself. So going forward you should assume it'll take at least a couple of days to get a reply. As for your specific issue, I've been working with PHP for 20 years now and I've never heard of that error before. What is the exact URL you're loading when you see that error and what is the exact error? Finally, do keep in mind that this book assumes solid comfort with PHP and MySQL and builds upon that knowledge to create a couple of advanced e-commerce applications. If you're not truly comfortable with both technologies, you may want to start with a different book first.
-
The differences between the two queries are pretty obvious but what's really important is: What's the users table definition look like? What error message, if any, is MySQL returning. The answer to the first might inform the second, but you ought to just look at the MySQL error directly. That's assuming there is an error. If there is no error then your query is syntactically fine, there's just no matching rows.
-
session or cookie
Larry replied to x_wd11's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
You shouldn't be storing the user_id in both a cookie and a session. Figure out which approach you ought to be using--cookies or sessions--and just go with that one. -
add_pdf.php move_uploaded_file()
Larry replied to Jumbo's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
Well, the error means that it cannot find the named file or directory, which either means the file or directory doesn't exist OR the file or directory path provided is wrong. Here it's the latter. Note that you start with /~saphiakhara That's probably wrong. In Unix, the tilde refers to the current user's home directory. So ~ in this case equals /Users/saphiakharaz. You have "/~saphiakhara" which is incorrect in a couple of ways. "~/ecom1/..." would be more correct but you should probably use the full, absolute path ("/Users/saphia...") instead.