Results 1 to 3 of 3

Thread: [RESOLVED] MySQLi fail - trying to INSERT

  1. #1
    Join Date
    Apr 2011
    Seattle, WA

    resolved [RESOLVED] MySQLi fail - trying to INSERT

    Ok, so I've pinpointed the problem to this spot:

    PHP Code:
    $query "INSERT INTO project(`id`, `name`, `summary`, `client_id`, `detail`, `link`, `scope`, `type`, `progress`, `status`)
    VALUES (NULL, 'Project Title', 'Summary of Project', '2', 'Details', NULL, 'Scope Example', 'project type', NULL, 1)"

    if ($result $mysqli->query($query)) {
    // Never gets to this spot...
    // This is what it gives me... every time
    echo("Error Message");

    I've tried a bunch of different display-a-specific-error-message things, but none of them show anything.

    Any help or advice would be greatly appreciated. Thanks in advance!

  2. #2
    Join Date
    Aug 2004
    See if this gives you any useful info:
    PHP Code:
    else {

    (Ultimately you'll want something that doesn't splash application/database info on the user's screen, but for now it should hopefully give you the needed info.)
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Apr 2011
    Seattle, WA
    That helped immensely! Apparently one of the values being passed (a 0 where it is anything from 0 to 100) was being passed as NULL, but "NULL" wasn't marked in the database, so I made it number_format($variable) and that did the trick. Thank you very much!

    An alternative solution would've been to change it to accept "NULL" in the database too, but I prefer it be stored as a number, so oh well -- and this is the only place it can be added or edited from, so if that's covered then there's really no harm in keeping it as it is.

    And now that it's fixed, I can clean it up and remove (or hide) the comment bits. I had a whole list of them with each step in the process, which is how I narrowed it down to which one was having a problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center