Jump to content
Larry Ullman's Book Forums

armlocker

Members
  • Posts

    83
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by armlocker

  1. Nope that didn't work either.... error where code starts begins from here. I copied it straight off the book, and proof read it. I can't really see where I am going wrong. <?php echo '<h3>Most Popular Pages</h3><p>'; $q = "SELECT COUNT(history.id) AS num, pages.id, pages.title FROM pages, history WHERE pages.id=history.page_id AND history.type='page' GROUP BY (history.page_id) ORDER BY num DESC LIMIT 10"; $r = mysqli_query($dbc, $q); $n = 1; while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) { echo "<h4>$n. <a href=\"page.php?id=$row[1]\">$row[2]</a></h4>\n"; $n++; } echo '</p>'; ?> <?php echo '<h3>Highest Rated Pages</h3><p>'; $q = "SELECT ROUND(AVG(rating),1) AS average, pages.id, pages.title FROM pages, page_ratings WHERE pages.id=page_ratings.page_id GROUP BY (page_ratings.page_id) ORDER BY average DESC LIMIT 10"; $r = mysqli_query($dbc, $q); while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) { echo "<h4>$row[0]. <a href=\"page.php?id=$row[1]\">$row[2]</a></h4>\n"; } echo '</p>'; ?> =================== On another note: where do I put this piece of code in to show errors: // show errors ini_set('display_errors', 1); // adjust error reporting: error_reporting(E_ALL | E _STRICT); ====================
  2. Hi Antonio I've been trying to work through this methodically using the debugging techniques in Larry's other php book, but still really stuck with this script. The errors are echoed out at: http://wolfcut.co.uk/html/index.php I have narrowed it down to errors occuring in creation of the database on my hosting site - can you take a look an tell me what you think, much appreciated as always
  3. Hi there Error keeps popping up and I've tried everything to rectify. Its a pretty long error message that appears on the home page of Knowledge is Power, and starts like this: '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/html/index.php' on line 37: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given The error is occurring on line 37 - that I know. Any pointers in the right direction will be most appreciated.
  4. Why was there no closing PHP tag at the end of the form_functions.inc.php script?
  5. PROBLEM SOLVED. Because I am testing the site live via my hosting provider - FatCow - I simply asked them the path to my folder. Thanks Antonio for the assistance.
  6. Hi, the mysql.inc.php is indeed in the BASE_URI directory as that was the structure of the code that I downloaded from this site. I think I am stuck on the naming of the location of BASE_URI. I've tried every cominbination under the sun, currently it looks like this: define ('BASE_URI', '/My_Passport/WEBSITES/ex1/'); define ('BASE_URL', 'http://www.wolfcut.co.uk/ex1'); The My_Passport is just an external hard drive with all the files in ex1 under the folder WEBSITES The BASE URK is just a hosting name I am using to test everything in. Any ideas where I am going wrong?
  7. Hi there - just trying to test the index.php in web browser via FTP but keep getting the folling message: An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/index.php' on line 15: require(/WEBSITES/ex1/mysql.inc.php) [function.require]: failed to open stream: No such file or directory The corresponding line of error is: [1] => require(/WEBSITES/ex1/mysql.inc.php) [function.require]: failed to open stream: No such file or directory I have a feeling it has something to do with this BASE_URI I have entered below: define ('BASE_URI', '/WEBSITES/ex1/'); define ('BASE_URL', 'http://www.wolfcut.co.uk/'); define ('PDFS_DIR', BASE_URI . 'pdfs/'); define ('MYSQL', BASE_URI . 'mysql.inc.php'); Any help most appreciated
×
×
  • Create New...