MySQL data not displaying on website

Hello,

My website is updated by entering data into a MySQL database through PHPMyAdmin.

Frustratingly, i am frequently plagued with problems using this approach and today is no exception! I have added several new records to my database and now when i view my site - none of the database records are displayed.

www.globexposure.net

Records are displayed as markers on my Google Map. You can see the individual markers/record data that is extracted from my database here:

www.globexposure.net/includes/read.php

Please can you help me diagnose the problem - i suspect there is special character or some such which is causing this problem but i can't see what exactly. I use a str_replace to try and pick these up but obviously something is missing (please see the attached script).


Many thanks
read.php.txt
DaniishAsked:
Who is Participating?
 
Roger BaklundConnect With a Mentor Commented:
create table temp_backup select * from TheTable where ...
delete from TheTable where ...

...and later:

insert into TheTable select * from temp_backup
0
 
psimationCommented:
start by making sure your sql is actually returning values.

I usually echo the query if there are variables that needs substitution, but in your case, just run the query in your script in phpmyadmin and see if it returns rows.

Then, wrt "special" characters, use functions like stripslashes() and htmlspecialchars() as well as htmlentities() on your output.

0
 
psimationCommented:
scrap the last part of my comment, I see u already do that - but do check your sql as a starting point.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Roger BaklundConnect With a Mentor Commented:
I think there is something wrong with the function parseToXML() and how you use it.

You do some stuff with $xmlStr in this function, but in the end you return

return(htmlspecialchars(str_replace("#","<br /><br />",$htmlStr), ENT_QUOTES));

htmlspecialchars() translates < and > to < and >, but also translates & to &amp;

In line 65 you call this function like this:

parseToXML(htmlentities(...))

This applies to $row['exchange_rate'] and $row['national_dish']

htmlentities() does the same thing as htmlspecialchars. If these columns contains any html tags, they will be escaped twice, i.e. < becomes &amp;lt; and so on.
0
 
Roger BaklundCommented:
EE escapes these characters also, so it is hard to write this correctly...

htmlspecialchars() translates < and > to & lt; and & gt; (without the space between & and lt/gt !)
0
 
DaniishAuthor Commented:
Thanks CXR i shall have a good look at that.

My site was working properly a few hours ago and the only thing that has changed, is that i deleted 2 fields and added 6 new records.
Presumably its possible to export my newly added records to confirm they are not the cause - any idea how this is done (obviously i'll want to be able to import them again too)?
0
 
DaniishAuthor Commented:
OK i did:

create table locations_backup select * from locations where id=166

How do i backup another record to locations_backup ?

e.g. i want to back up id = 167, 168, 171, 172, 173


Thanks again CXR
0
 
Roger BaklundConnect With a Mentor Commented:
Like this:

insert into locations_backup select * from locations where id in (167, 168, 171, 172, 173)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.