Fiersegrise
New Member
I have a frustrating experience in PHP because I keep getting my MEDIUMTEXT field returned as a non-string string. When I check the variable's type it says it's a string, but it's actually an array, basically a character array so I do:\[code\]while ($row = mysql_fetch_assoc($records)) { print_r($row["myText"]);}\[/code\]Which instead of printing out the actual text stored there like "here is a line", it just prints 1. This is confusing because I ask it what it's datatype it and it says string... However if I do \[code\]$row["myText"][0]\[/code\]It will return "h". I'm totally lost on how I can change this value into a string, I mean I would assume php has some function for it, but I can't find it. I also have no idea why it says it's not an array.Any ideas?edit by requestmysql query\[code\]select * from snippets\[/code\]a print_r:text is the name of the MEDIUMTEXT column in mysql. The others aren't related\[code\]Array ( [index] => 1 [name] => a name [language] => english [text] => ) 1\[/code\]edit2:All the code that produced this error: \[code\]$username = "root";$password = "";$hostname = "localhost"; $dbname = "TestSnippets";$dbh = mysql_connect($hostname, $username, $password) $selected = mysql_select_db("snippets",$dbh); $records = mysql_query("select * from snippets");while ($row = mysql_fetch_assoc($records)) { echo print_r($row);}\[/code\]This produces the error every time. All other fields come in perfectly fine. Not the MEDIUMTEXT field however.edit3:I tried installing a new webserver (Apache) and a new version of PHP, but it still has the same issue. Interestingly enough when I call php-cgi.exe it returns the data with that variable being output properly. I have zero clue what it could be, the only other this is I could install a different version of mysql. I'll try that tomorrow and report back.edit4: I solved this myself keeping in mind what I was told here. See my answer to my own question below.