issue with inserting data that has hyphen in

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: issue with inserting data that has hyphen in

Post by Celauran »

Nothing's jumping out at me
can't seem to insert the data
Can you elaborate? Are you getting any errors?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: issue with inserting data that has hyphen in

Post by Celauran »

Have you checked the return value of $stmt->execute? Called $mysqli->error?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: issue with inserting data that has hyphen in

Post by Celauran »

ianhaney wrote:Not yet no, how do I do that?
For debugging, this will do

Code: Select all

// insert the new record into the database
if ($stmt = $mysqli->prepare("INSERT software (software_title, software_number, times_used, customers_name) VALUES (?, ?, ?)"))
{
    $stmt->bind_param("ssss", $software_title, $software_number, $times_used, $customers_name);
    $success = $stmt->execute();
    if ($success === false) {
        var_dump($mysqli->error); exit;
    }
    $stmt->close();
}
You'll want to implement some proper error checking and handling but, for now, this will let us get to the bottom of the current issue.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: issue with inserting data that has hyphen in

Post by Celauran »

I noticed INTO keyword is absent. INSERT INTO software...
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: issue with inserting data that has hyphen in

Post by Weirdan »

Has that solved your problem?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: issue with inserting data that has hyphen in

Post by Weirdan »

Great!
Post Reply