0

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.

2
Contributors
8
Replies
10
Views
6 Years
Discussion Span
Last Post by UzuNarU
0

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'
0

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

0

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

0

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.

0

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

0

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

0

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?

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.