I am building a PHP site for a class project, and we use the MS SQL Server 2008 database to populate the fields on the site. However, one of the fields displays garbage on the page instead of what is actually stored in the database.
The field in question is called descriptiona field varchar(MAX); the stored procedure queries the database for the tuple and uploads the values from its table into the text fields on the page; the field descriptionis displayed on the control textarea.
Here is the PHP that handles extracting information from a database:
$res = odbc_exec($dbhandle, "exec dbo.usp_ProgramGet " . $_GET["program"]);
$id = $_GET["program"];
$name = odbc_result($res, "title");
$desc = odbc_result($res, "description");
The variable $nameworks as expected (in the database it is of type char(15)). However, if (for example) the field descriptioncontains "This is a test", then it $descwill lead to "$ ime", and this is what is then dumped into the control textareaof what is stored in the database.
I searched everything and did not find solutions to this problem, although it sounds like an error in PHP itself, although I'm not sure.
Update
I am using SQL Server queries to update varchar values. I tried to insert a very long string, and I got the following:
,ime stringDayToInt É à‰, N={
"stringDayToInt" is the name of the PHP function that I wrote, which lives in a completely different file, which ended up on the page I'm trying to execute. Very strange.