I’m having a ‘mare trying to get some simple data from my MySQL database.
Executing the following command in phpMyAdmin works fine:
SELECT coords FROM btDCSimpleMapMarkers WHERE bID = 152

but when I attempt the same in PHP (where bID is dynamically substituted):
echo $db->query("SELECT coords FROM btDCSimpleMapMarkers WHERE bID = {$bID}");
I get this:
"coords
"
"coords
"55.8858884,-3.5473646","56.1962574,-4.7451167","58.1476532,-5.2027190","55.9714768,-3.1769557","57.6809791,-4.3305414","55.9409414,-3.5107965","56.2444546,-4.2167933","55.5162577,-4.3799082","57.1417936,-2.0930123","55.9699585,-3.1853694","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","55.6459257,-3.1714130","55.8614198,-3.0658253","55.9433622,-3.0590451","55.9563443,-2.7912248","55.8533561,-4.3041345","55.2410909,-4.8555597","55.8577681,-4.2443929","55.8781498,-4.2898555","57.1426478,-2.1232869","56.8705582,-5.4453786","56.1884131,-4.4899996","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","55.9717258,-3.1931145","55.9491408,-2.7235834","55.8922571,-3.0575724","57.0761811,-2.7793013","56.1888841,-3.0137383","55.6956709,-3.3806546","57.4871048,-4.2490284","56.4125195,-5.4727019","56.0751328,-3.4419449","58.4337677,-3.0813735","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0","0,0"
"
I don’t know where the extra stuff at the beginning is coming from (especially the column name). The field contains one long string, and the column type is VARCHAR(20000).
Any help would be appreciated, cos I’m stumped!
You seem to be trying to echo the mysql result directly.
What you need to do is use mysql_fetch_array() to get each row of data and then echo that.
This is how I would do it: