February 12, 201115 yr Hey guys, I'm randomly displaying some information from a datasbase, and it works fine with small data, but when I try and insert say a paragraph, it becomes really glitchy? I'll give you an example: say if I have this: row 1 : "hello" row 2: "world" row 3: "hello again" It will cycle through these at random just fine. But say if I have something like the following in all my three rows: row 1: <p class="gen_text"><u>Heroes plaza</u> <br><br> It must once have been a region of colossal statues, shattered limbs scatter all around this place, half buried in the surrounding vegetation, some barely visible as they as weighed down by the thick peat which surrounds them. The golden sunlight illuminating the entire collection of shattered remains, casting cool and tranquil shadows against the grass. An ivory white plaza visible though an archway, formed by a half broken torso which seemed to once belong to the stature of an Adonis like figure. The beautifully lit promenade led to a magnificent fountain of great stature, the fountain was unlike the other statues which were randomly dotted the hills nearby, it was clean, well managed and seemed to be the focal point of the courtyard, still flowing with the clearest water imaginable. Colorful flowers bunch together in random places, trees with intertwined branches; arching majestically towards the sky and gently drooping towards the earth in graceful swathes, a scene of green, gold and saffron. <br><br>Brief: Using the short descriptive paragraph above, design a concept for the enviroment or interesting part of the scene. <br>Author : David Gavinson | Reference Number : 0004</p> <a href="#" id="opt_dl"></a> <a href="#" id="opt_vw"></a> row 2: It must once have been a region of colossal statues... etc... It becomes very unstable. I'm using type 'text' for this, which is why I can't see why there'd be a problem with me inserting a paragraph? Any of you guys know what would cause this? I was thinking maybe it was just crashing the MYSQL...but there's only three bits of data...surely that's not enough to overload it? Anyway if you guys have any clue any help would be appreciated (: Pippin. ps the line I'm using for a random peice of data is below, just incase I'm doing something wrong there? $qry = mysql_query("SELECT * FROM env ORDER BY RAND() LIMIT 1") or die (json_encode('Query error')); Edited February 12, 201115 yr by pippin
February 12, 201115 yr Author What do you mean by unstable? Storing html in a database should cause no problems at all. Are you sure you're not running your output through something like strip_tags before outputting to the page? No no, it's just being called by the AJAX and displaying straight to a DIV. By unstable I mean that, I have a button to display the data. Once the buttons is clicked it it runs a php function which displays an image and then displays the quotes on-top of that image. But when the large data is in the DB it will just randomly go back to before the first click. [show no quotes of image]. It's kinda hard to explain but in all honesty it could be the php causing the error, but I just thought seeing as it worked with small data and not larger data I figured it was the MYSQL glitching? If nothing seems wrong here I'll check my php and post back either with a fix or more info.
February 13, 201115 yr I think you have to "bind" the ajax calls. it's not a mysql problem but ajax. Edited February 13, 201115 yr by keithics
February 13, 201115 yr I think you have to "bind" the ajax calls. it's not a mysql problem but ajax. Your right, Ajax calls have to be binded, example the data ruturned by ajax can be used like this: success: function(data) { $('#mydiv').html(data); } The script above will puplate the div "mydiv". Edited February 13, 201115 yr by Shaun Childerley
February 13, 201115 yr Author Hey guys, I didn't want to bump this thread but seeing as a few people have replied I'll just inform you that the problem has been resolved. It was infact a MYSQL error. I still don't understand what was wrong exactly, but when it outputted a certain paragraph [it literally was just one paragraph it didn't like] it would always glitch. Works fine with everything else. But thanks for all the input sorry I can't be more informative to what would fix the problem if anyone else comes across this error though. +1's for you all (: Edited February 13, 201115 yr by pippin
February 13, 201115 yr Hey guys, I didn't want to bump this thread but seeing as a few people have replied I'll just inform you that the problem has been resolved. It was infact a MYSQL error. I still don't understand what was wrong exactly, but when it outputted a certain paragraph [it literally was just one paragraph it didn't like] it would always glitch. Works fine with everything else. But thanks for all the input sorry I can't be more informative to what would fix the problem if anyone else comes across this error though. +1's for you all (: Can you post the paragraph that was causing it? I'd wager there will be some sort of escape character issue.
Create an account or sign in to comment