Ok what I am trying to do is submit changes. I have all the information being collected. I'm just having trouble with the proper query to run.

I currently have:

$sql = "UPDATE anime_list SET anime_name = '$animename' rating = '$rating' episodes = '$episodes' WHERE id='$id'";
$result = mysqli_query($dbc, $sql)
or die('Error Submitting Series Changes');

It always stops at the error message I have set.

also I am using if isset to grab the variable values from a javascript function.

Recommended Answers

All 8 Replies

Change line 3 to or die(mysql_error()) which will tell you about the problem: You have to separate the assignment by comma:

UPDATE anime_list SET anime_name = '$animename', rating = '$rating', episodes = '$episodes' WHERE id='$id'

oh...maybe that is the problem one moment while I make those changes. I'll post back the results.

Ok so I made those changes, and added the mysql_error(). However it has no output. it doesn't display anything.

If you don't see an error message that means that there probably hasn't been an error.
How would you generate any output? Not in your sample code above.

Hmm I did find a typo, however it still isn't submitting the changes. Would more code help?

Nevermind, I'm an idiot...the code was fine. I was calling a div id instead of the MySQL database table name...

Ok I have one other issue with my update query. If the fields I'm updating are blank to begin with, and I fill in the information the update query fails. Instead of an or die statement is it possible to run an else statement with the insert query?

Ok so I figured out what the problem was. It's not the query,it was the contents of the post. seems commas aren't allowed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.