Active Record is producing wrong SQL. Please help |
[eluser]FutureKing[/eluser]
Hi, I am trying to make a RSS2.0 feed reader with code igniter. This app will to the following task: 1. Downloading RSS2.0 feed from URL 2. Insert everything in MySQL Database. for second step I am using Active Record Insert But I am getting following error: Code: A Database Error Occurred I am using SimpleXmlElement for Downloading feeds.(see tutorial: http://nettuts.com/javascript-ajax/how-t...creencast/) Why there is no inverted comma on my SQL query?
[eluser]xwero[/eluser]
What is your AR code? The problem with your sql statement is that none of the text values, except the f_url are surrounded by single quotes.
[eluser]jdfwarrior[/eluser]
[quote author="xwero" date="1241787596"]What is your AR code? The problem with your sql statement is that none of the text values, except the f_url are surrounded by single quotes.[/quote] What he said. And that's something that's done automatically so... yeah, feed us the code please.
[eluser]FutureKing[/eluser]
Hi, My problem solved! I converted everything to string by the following code: Code: settype($title, "string");
[eluser]Unknown[/eluser]
I just faced this problem and sorted it in a similar manner, but I want to know why this is a problem in the first place. When generating the query, can't AR do a gettype() and then decide to put quotes or not? The funny thing is that I just finished one project that had mixed data types and I never got any error. Why did I get it with this project? |
Welcome Guest, Not a member yet? Register Sign In |