Jump to content
Larry Ullman's Book Forums

All Activity

This stream auto-updates     

  1. Today
  2. Mr Ullman, can you please share a link to the source code in chapter 4-7 , I could not find it here
  3. Yesterday
  4. So sorry for the delayed reply! This one somehow slipped past me. Are you still confused by this/still need some insights or did you figure it out while I was daydreaming? Apologies gain for missing this!
  5. Thanks for your question! The difference between the 5th and 4th editions is somewhat minimal. The difference between the 5th and 3rd edition is significant. The difference between the 5th and 2nd edition is...oceanic! The 2nd edition is probably about 10 years old and I don't even know if PHP 5 existed then (the current version is PHP 7). So much has changed!
  6. Hmmm... I've not been in this situation before but I imagine you have three options: - Uninstall MySQL and XAMPP and then reinstall XAMPP - Try to configure XAMPP to use your existing MySQL install (I have no idea what that would entail) - Just install Apache separately and forgo XAMPP I'm not sure which is best for you, it would depend in part upon how the current MySQL install was used and whether you want the easy solution or the "interesting" one!
  7. Last week
  8. AHHHHH, there it is. Thanks Larry, really good book so far.
  9. I already have MySQL on my Windows 7 PC. I installed XAMPP (unchecked MySQL) and it did not recognize my prior MySQL install. Also, phpmyadmin would not open. Do i have to uninstall MySQL and let XAMPP install it?
  10. How is PHP and MySQL for Dynamic Web Sites 5th Edition different than earlier editions? I have the 2nd Edition, so I'm wondering if I should buy the most current: 5th edition. I ask these considerations because of how much the internet may have changed in the time between editions.
  11. Ah! Good question! The reason is because we don't want to assume the data will come from the form or in an unadulterated way. It'd be really easy to submit data from elsewhere to this script or to modify the form in the browser and then submit that. So these conditionals provide an extra layer of security.
  12. Hi Everyone, Just curious. I'm looking at the gender part of this script and it has a elseif nested in a if else lines 45 - 57. Is there a reason for the nested else? The returned statement says "Gender should be either M or F!" but there's no discernible way to select anything other than M or F. Thanks!
  13. In answer to your question, the concise.css might have another class later on that's conflicting. Your best bet is probably to move on (CSS is hard if you don't do it fulltime and it's not critical to your learning at this point). Second to that, I'd use the developer tools in Chrome to see what CSS rules are or are not being applied.
  14. Earlier
  15. Guys please remind me how I can leave a cookie on the users device so that when the user revisits a login form I will check for the existance of said cookie and if exists I will make the form fields sticky.
  16. Hello Try as I might, the "text--error" class color of the font looks more brownie brown than red. I hi-jacked the concise.css file and change the color to this class to #FF0000. I still am getting this brown color. On a fresh page, I inline-styled the color #FF0000 and I saw the fire-engine red that I am expecting from the error class. Question: Does the concise.css have another class later on in its document that cancels out the red of text--error? I cannot get the PAINT pictures to upload. Under Oath: the concise, even after I changed the original text--error color to #FF0000 and the page still shows brown. When I inline style the color #FF0000, I get the red. I wish to move on in the book rather than spend more than the two hours on this I have already flushed down the drain. Thank You
  17. So could you confirm... - Running the "SHOW TABLES" command directly on the database returns multiple records (i.e., multiple results)? - The while loop is only executed once? - Do echo mysqli_num_rows($r) to see how many rows are in the result.
  18. Hello everyone! I recreated the script from chapter 11 about file compression exactly as it is in the book but it only backs up the first table from any database. Here's the code as it is in my IDE: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Database Backup</title> <link rel="stylesheet" href="style.css"> </head> <body> <?php # Script 11.1 - db_backup.php // Set the name of the database $db_name = 'testlogin'; // Make sure that the backup directory exists $dir = "backups/$db_name"; if (!is_dir($dir)) { if (!@mkdir($dir)) { die("<p>The backup directory--$dir--could not be created.</p></body></html>"); } } // Get the current time $time = time(); // Connect to the database $dbc = @mysqli_connect('localhost', 'root', 'pass', $db_name) OR die("<p>The database--$db_name--could not be backed up.</p></body></html>"); // Retreive the tables in this database $r = mysqli_query($dbc, 'SHOW TABLES') OR trigger_error("Error: " . mysqli_error($dbc)); // Confirm that at least one record was returned and print a message. No need to back-up an empty database! if (mysqli_num_rows($r) > 0) { echo "<p>Backing up database '$db_name'.</p>\n"; // Create a loop that fetches each table name while (list($table) = mysqli_fetch_array($r, MYSQLI_NUM)) { # Retrieve all the records from this table print_r($table); $q = "SELECT * FROM $table"; $r2 = mysqli_query($dbc, $q); // If the table contains some records, open the text file for writing if (mysqli_num_rows($r) > 0) { if ($fp = gzopen("$dir/{$table}_{$time}.sql.gz", 'w9')) { # Retrieve all of the table's data and write it to the file while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) { foreach ($row as $value) { $value = addslashes($value); gzwrite($fp, "'$value', "); } gzwrite($fp, "\n"); } // End of WHILE loop. // Close the file and print a message to the browser gzclose($fp); echo "<p>Table '$table' backed up.</p>"; } else { echo "<p>The file--$dir/{$table}_{$time}.sql.gz--could not be opened for writing.</p>\n"; break; } // End of gzopen() IF. } // End of mysqli_num_rows() IF. } // End of WHILE loop. } else { echo "<p>The submitted database--$db_name--contains no tables.</p>\n"; } ?> I tried to print out the $table array and it contains only one element which is baffling since the given database has multiple tables. The query runs fine, so it can't be the cause of the problem. I'm really out of clues here as to what is going wrong. Any suggestions would be much appreciated! Thank you!
  19. I am now getting the 'no image available' default jpg, -a bit of progress,
  20. That's all good info! The files should be just numbers without extensions, that's good. The next thing I'd do is run view_print.php?pid=1 directly in your browser and see the result. Hopefully you'll see a PHP error that explains what's going on.
  21. btw the information does show up in the DB
  22. sorry two images uploaded. No need to hurry, I'm just going through your book at leisure and review
  23. Here is the part where it echos the prin from the while loop in the browse_prints file:: Also in the image file you can see that the uploaded files look incomplet without file extensions. The properties just say 'File' --weird // Display each record: echo "\t<tr> <td align=\"left\"><a href=\"browse_prints.php?aid={$row['artist_id']}\">{$row['artist']}</a></td> <td align=\"left\"><a href=\"view_print.php?pid={$row['print_id']}\">{$row['print_name']}</a></td> <td align=\"left\">{$row['description']}</td> <td align=\"right\">\${$row['price']}</td> </tr>\n";
  24. What is the HTML tag for one of the images that's not showing?
  25. Hi, Everything is working ok the image upload and even the cart checkout. But getting the No image available message. Can anyone tell me how to make the image appear? it is only a jpg and very small. It does not upload to the uploads folder either.
  26. Hey Jack. Right now you're literally passing the string "lid" around, which won't do anything. You should double-check how the book does it. (Separately, there's no method for A tags but that's not causing your problem.)
  27. Hi,HartleySan,thank you for you help, but please look,if I am doing this right?For example all links <a href="login.php?lid"> <a hrf="forum.php?lid> <a href="post.php?lid> method="get" then <form action="login.php?lid"> <form action="post.php?lid"> method="post" right or error? thanks
  28. Necuima

    Checking MIME Type

    To avoid compiler warnings change the following: Change 'char jpg_signature' to 'unsigned char jpg_signature' and 'char buff[12]' to 'unsigned char buff[12]'. Tested and still works correctly. The method should probably be named 'checkMimeType'. Cheers
  1. Load more activity