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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Roger BaklundCommented:
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
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

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
Roger BaklundCommented:
create table temp_backup select * from TheTable where ...
delete from TheTable where ...

...and later:

insert into TheTable select * from temp_backup
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 BaklundCommented:
Like this:

insert into locations_backup select * from locations where id in (167, 168, 171, 172, 173)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.