Page 1 of 1

How to get help

Posted: Thu Jan 20, 2011 6:06 am
by PaxBritannia
You're stuck.

Well, there's something wrong with your code, and you don't really know what to do, so you post on the forums. You wait, wait, and wait. Still nothing. 'Why is is taking so long,' I hear you ask. I'll tell you why.

Most of the time the replies will take a while, because of a few things. Most of the time, it's not the actual coding problem which is difficult, it's the communication.

Guideline 1: Speak properly
It helps if you use capital letters at the start of the sentence and full stops where they end. Try and not use extravagant words, and just speak plain English/American (for those who know the difference:lol:).

Guideline 2: Your point of view
It would help us to understand the problem if we were standing behind you (but it would also be pretty scary :) ). Regardless, we're not. So we don't know what "that line of code" is and we don't know what "line 23" is unless you give us that line and mark it out, or give us the whole script.

Guideline 2.1: Give us the whole script
On second thoughts, just give us the whole script anyway, often the error isn't on that line, but the lines before it. Most often it's a missing/extra semicolon, bracket, or period; in these cases, we'll need most if not all the lines before it - so just give us the whole script. In the cases which it isn't we'll still need the entire script. Paste the script in between code tags "[co de][/co de]" (without the space), and tell us what the name of the page is like this:

index.php:

Code: Select all

<?php require connect.php; ?> 
Guideline 2.2: Give us the page errors
When you run a page, you'll get errors. If you only get a blank page, put this line at the beginning of your script in php brackets:

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', '1');
These lines of code will tell you if anything is wrong and what line it is on.

Copy these errors, and paste them in between code tags "[co de][/co de]" (without the space), and tell us what the name of the page is and that they are the results, like this:

index.php returns:

Code: Select all

Parse error: syntax error, unexpected T_string in /folder/connect.php on line 3 
Guideline 2.3: Give us the script inside the script
You see how in the error message above it says the error is actually on connect.php? Well if your script includes or requires any other scripts, include that too and remember to label the script so we know what it is.

connect.php:

Code: Select all

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password')
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
 
Guideline 2.3: And the database please
If the problem is with the database fields not getting updated, or if it's a mysql error, we'll need to see the database. The easiest way to do this is to take a screenshot of the relevant fields and then upload the screenshot. However, if it is the database connection, a screenshot won't be necessary, but it would help to add in the connection values.

Guideline 3: When there's no error messages
If you don't get any errors messages, but the script still isn't acting properly, that means the problem isn't a coding problem: its a logic problem. That means that it's working but not the way you want it to. If we don't know how it's supposed to work, we can't really help you on the one. So you need to tell us.

Guideline 4: Be patient
After making sure your help topic follows those three guidelines, there shouldn't be much of a problem with debugging or getting your problem across. All you can do now is wait. In the meantime, maybe you could help other people experiencing problems with their code. Sometimes replies will be instant, other times, debugging can be quite a challenge and might take a longer while. In this case though, the solution to the bug was easy: a missing semicolon on line 2.

See you around!

pax.

Re: How to get help

Posted: Fri Jan 21, 2011 8:37 pm
by Jackolantern
All very good advice!