Link to home
Start Free TrialLog in
Avatar of Daniish
DaniishFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
Avatar of psimation
psimation
Flag of South Africa image

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.

scrap the last part of my comment, I see u already do that - but do check your sql as a starting point.
SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 !)
Avatar of Daniish

ASKER

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)?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daniish

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial