![]() |
Funny Parse -> MySQL Insert error
Im parsing a feed, then entering the data into mysql.
When i echo $elemt->title or any of the others, it shows the correct value. However when i insert it, its just blank.... Some help pl0x? PHP Code:
|
You're attempting a loop on the data outside the
<entry> node. Try modifying your loop to reflect the following, so that you're looping entry:php Code:
|
nope :( doesnt return anything that way! :(
|
I don't know why but it appears to work for me when I make that change:
php Code:
|
Incidentally, you're assigning the values to new variables at the beginning of the loop, but you're not using them. Also, looking inside the commented code, you're using
$elemt which won't be set at all.I think you should be using $title, $content and $time as they're the variables you have created.Edit: Another incidentally, if in your MySQL table you set the title column to a unique index, you won't have to use a SELECT to check if it first exists. It simply won't be entered into the MySQL table if it already exists.One step at a time though :-) ! |
the vars at the top were just me testing to see if it was something else, which i should of deleted ;), however element->title when echoed works fine, just when i try insert it, its blank?
I tried your one, and that too is blank, did you manage to get it in the database? |
I see another problem that will prevent it from being entered into the database correctly. It concerns the content of the first entry (It's the only one I checked): "...it's place in business..."
If the body contains an apostrophe then it will break. You need to escape those characters: php Code:
You need to do the same for title, also. If you add the or die to your mysql_query function then you will see any further errors:php Code:
|
| All times are GMT. The time now is 02:19 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0