Skip to content Skip to sidebar Skip to footer

Issues Posting To Database With CURL

UPDATED AS OF 11/16/15 11:55pm PST Below you will find the code. I am trying to get this to retrieve JSON data, and post the values to my database. JSON Structure and in which orde

Solution 1:

I have changed insert query and bind_param as below and it worked :

$sql = "
    INSERT INTO memberss (
    record,
    status,
    area,
    region,
    fullname,
    manager,
    position,
    mobilenumber,
    project_manager,
    ipad_email,
    email,
    team_leader,
    regional,
    title,
    startdate,
    empid

    )
    VALUES (
    ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

    $insert_stmt = $mysqli->prepare($sql);

    // Insert the new user into the database
    if ($insert_stmt)
    {
        $insert_stmt->bind_param('ssssssssssssssss',$user_rl,$status,$area,
                $region,$fullname,$manager,$position,$mobilenumber,
                $project_manager,$ipad_email,$email,$team_leader,
                $regional,$title,$startdate,$empid);

        // Execute the prepared query.
        if (! $insert_stmt->execute()) {
            header('Location: ../error.php?err=Registration failure: INSERT');
        }
    }

Note : Rest of the code is same.


Solution 2:

I have figured out what I did wrong.

I wasnt passing enough

VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

I was also not binding enough strings.

$insert_stmt->bind_param('ssssssssssssssss' to match my

if ($insert_stmt = $mysqli->prepare("INSERT INTO members (values)"))

This project is done, on to the next...


Post a Comment for "Issues Posting To Database With CURL"