Skip to content

Instantly share code, notes, and snippets.

@Cvar1984
Created February 22, 2025 10:14
Show Gist options
  • Save Cvar1984/f7eddd99b57f90cc6ca5b056b801d94a to your computer and use it in GitHub Desktop.
Save Cvar1984/f7eddd99b57f90cc6ca5b056b801d94a to your computer and use it in GitHub Desktop.
generated by GPT-3

How to Ask a Technical Question

When you're trying to ask a technical question, following a structured approach can help you get the most accurate and useful responses. Here’s a simple tutorial to guide you:

1. Define the Problem Clearly

  • Be Specific: Describe exactly what the issue is. Instead of saying, “My code doesn’t work,” explain what the code is supposed to do and what it is doing instead.
  • Context: Provide background information about the project or situation.

2. Provide Relevant Details

  • Code or Configurations: If applicable, share relevant code snippets, configuration files, or error messages. Make sure to format the code properly for readability.
  • Environment: Mention the technology stack (e.g., programming languages, frameworks, libraries) and the environment (e.g., operating system, software versions).

3. Explain What You’ve Tried

  • List any solutions or troubleshooting steps you’ve already attempted. This helps responders avoid suggesting the same solutions and can lead to more targeted advice.

4. Ask a Specific Question

  • Frame your question in a way that is easy to answer. Instead of asking, “Why doesn’t my code work?” you might ask, “What is causing the ‘undefined variable’ error in line 15 of my PHP script?”

5. Be Polite and Open to Feedback

  • Use polite language, and express appreciation for any help offered. Be open to follow-up questions or clarifications, as they can help you get a better answer.

Example of a Well-Structured Technical Question


Title: “Undefined Variable Error in PHP Script”

Body: Hi, I'm working on a PHP script that fetches user data from a database, but I’m encountering an "undefined variable" error on line 15. Here’s a snippet of my code:

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT id, name FROM Users";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"] . " - Name: " . $row["name"];
    }
} else {
    echo "0 results";
}
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment