Skip to content
CoursesWeb Forum

Stuck on your code? Ask the CoursesWeb forum.

10 threads, 100% answered. Search before you ask. The answer is usually here.

Sections
  1. ✓

    How do I use prepared statements with mysqli or PDO in PHP?

    Write the SQL with a placeholder where each value goes, prepare it, bind the values separately, then execute. The database treats the values as data, never as...

    MySQL Queries from PHPCallum IwuStaff answer
    0replies
  2. ✓

    What does mysqli_query() expects parameter 1 to be mysqli mean?

    It means the first value you gave mysqliquery() is not a database connection. Usually the connection variable is empty, false, or a different type, because the...

    Error Messages ExplainedCallum IwuStaff answer
    1reply
  3. ✓

    Why is my CSS rule ignored? How does specificity decide which rule wins?

    When two rules set the same property on one element, the browser scores each selector and the higher score wins. An id counts most, then classes, attributes...

    CSS Styling and SelectorsTeodora VanceStaff answer
    1reply
  4. ✓

    How do I handle GET and POST form data safely in PHP?

    Read GET data from $GET and POST data from $POST, then treat every value as untrusted. Check that it exists, check its type and length, and escape it with...

    PHP Forms, Sessions and BasicsCallum IwuStaff answer
    0replies
  5. ✓

    How do I convert old jQuery code to plain JavaScript?

    Convert it one habit at a time, not all at once. Replace $() with document.querySelector or querySelectorAll, .on() with addEventListener, .addClass() with...

    jQuery and Older Front End CodeTeodora VanceStaff answer
    1reply
  6. ✓

    How do I clear a form after sending it with fetch or AJAX?

    Call the form's reset method after the server has answered successfully, not before. Stop the normal submit with preventDefault, send the fields with fetch and...

    JavaScript Events, Timers and FetchTeodora VanceStaff answer
    1reply
  7. ✓

    querySelector or querySelectorAll: which one should I use?

    Use querySelector when you need one element: it returns the first match, or null if there is none. Use querySelectorAll when you need every match: it returns a...

    JavaScript and the DOMTeodora VanceStaff answer
    1reply
  8. ✓

    Why does getElementById return null and break innerHTML in my script?

    getElementById returns null when no element with that exact id exists in the page at the moment the line runs. The usual cause is a script that runs before the...

    Error Messages ExplainedTeodora VanceStaff answer
    1reply
  9. ✓

    Why does content overflow my HTML table cell even with a fixed width?

    By default a table sizes its columns to fit their content, so a width on a cell is only a hint. A long word or web address can push the column wider or spill...

    HTML Structure and SemanticsTeodora VanceStaff answer
    1reply
  10. ✓

    How do I put two divs side by side inside a container?

    Make the container a flex container with display flex, and the two divs inside it line up in a row on their own. Give each div a flex value so they share the...

    CSS Layout: Flexbox and GridTeodora VanceStaff answer
    1reply
CoursesWeb Forum. Questions and answers on learning web development: HTML, CSS, JavaScript, PHP, MySQL, Node.js and AI coding help.