User Tools

Site Tools


2019-07-23

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
2019-07-23 [2019/07/23 16:18]
nmckillop
2019-07-23 [2019/07/23 16:30] (current)
nmckillop
Line 5: Line 5:
 ==== Scratch Notes ==== ==== Scratch Notes ====
 Adding this to the top of your programs will force errors to be displayed (as opposed to hiding them from general users). ​ It might help find the source of your problem if you get an 'Error 500'. Adding this to the top of your programs will force errors to be displayed (as opposed to hiding them from general users). ​ It might help find the source of your problem if you get an 'Error 500'.
-<​code>​+<​code ​php>
 error_reporting(E_ALL);​ error_reporting(E_ALL);​
 ini_set("​display_errors",​ 1); ini_set("​display_errors",​ 1);
Line 219: Line 219:
   * Ask someone else for their IP and see if you can load their questions into your quiz   * Ask someone else for their IP and see if you can load their questions into your quiz
   * Checkout The Moonwalk problem below   * Checkout The Moonwalk problem below
 +  * [[working_with_rss|Working with RSS]] - I made some brief notes on RSS and how to access it with PHP
  
 ==== The Moonwalk ==== ==== The Moonwalk ====
Line 302: Line 303:
 https://​www.php.net/​manual/​en/​ref.math.php https://​www.php.net/​manual/​en/​ref.math.php
  
 +
 +==== Troubleshooting ====
 +----
 +I get this error on the page sometimes: ''​Notice:​ Undefined offset: 4 in /​var/​www/​starflyer/​html/​tmp/​coding/​quiz.php on line 49''​
 +
 +You've encountered the bug on line 14.  The size of the question array is 4, but it contains elements indexed 0 to 3.  So if we use the rand() function it needs to be picking a number from 0 to the size of the array minus 1 (so it returns at most 3, not 4).  Change the random number line (14) to:
 +
 +<code php>​$random_number = rand(0, $size_of_question_list-1);</​code>​
 +----
 +I can't log into Adminer (or I'm getting access denied errors). ​ Make sure the were set properly (there was a mistake on the instructions on the wiki). ​ Log into your server and run this to reset your password:
 +
 +  * Connect to the database as the root (admin) user:
 +
 +  sudo mysql -u root
 +
 +  * Then, inside the mysql client, we created the database and created a user called ‘coding_username’,​ with the password ‘cheese’ and gave it access to the newly created ‘coding’ database:
 +
 +  create database coding;
 +  grant all on coding.* to coding_username@localhost identified by '​cheese';​
 +  quit
 +
 +Then use these details:
 +| username | coding_username |
 +| database | coding |
 +| password | cheese |
 +| host | localhost |
 +
 +----
 +My page is blank.
 +
 +Make sure you have error reporting turned on.  Add these lines to the very top of your page (after the ''<?''​):​
 +
 +<code php>
 +error_reporting(E_ALL);​
 +ini_set("​display_errors",​ 1);
 +</​code>​
  
  
Line 310: Line 347:
   - Abhishek Singh   - Abhishek Singh
   - Alan Kennedy   - Alan Kennedy
-  - Allan Mullen+  - [[https://​glasgow.social/​@Angelina|Angelina Blyth]]
   - Araceli Pérez   - Araceli Pérez
   - Ayse Busra Parnell   - Ayse Busra Parnell
   - Casian Florin Dănilă   - Casian Florin Dănilă
   - Chris Cavani   - Chris Cavani
 +  - Connor Stewart
   - Donald   - Donald
   - [[https://​glasgow.social/​@Legomancer|Ed]]   - [[https://​glasgow.social/​@Legomancer|Ed]]
 +  - Erika Anderson
   - Ewan Miller   - Ewan Miller
   - [[https://​glasgow.social/​@garethk|Gareth King]]   - [[https://​glasgow.social/​@garethk|Gareth King]]
Line 326: Line 365:
   - MaryF   - MaryF
   - [[https://​glasgow.social/​@neil|Neil McKillop]] (Event Organiser)   - [[https://​glasgow.social/​@neil|Neil McKillop]] (Event Organiser)
-  - Rameez 
   - Revathi Lalam   - Revathi Lalam
   - [[https://​glasgow.social/​@M|Steven]]   - [[https://​glasgow.social/​@M|Steven]]
2019-07-23.1563898728.txt.gz · Last modified: 2019/07/23 16:18 by nmckillop