Now, the obvious next step is I am trying to get a VXML document to recite or play back the data that is in my MySQL db. But all hell breaks loose with errors galore!
I don't get errors from the scratchpad. I only get the errors when calling in, and they are very strange.
Of course I tried my code many different ways and what's below is the simplest. And I tried it as .VXML and .PHP.
When I name the document .VXML I get an error that's kind of unbelieveable, because I don't get the error in other .VXML documents.
XML Parsing Error: not well-formed
Line Number 3, Column 30:
echo("<?xml version=\"1.0\"?>\n");
----------------------------------^
Now, here's another kick in the head.
When I rename the identical document as .PHP
It denies access to a different user of an altogether different db on our server.
The user that's being denied access is not the user indicated in the code!
Below is that error:
XML Parsing Error: junk after document element
Line Number 3, Column 1:
<b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'xxxxxxxxmobi'@'nn.nnn.nnnn.nn' (using password: XX) in <b>GetDataFromMySQL.php</b> on line <b>13</b><br />
^
How can either of these errors occur?
And what's the solution?
Tech Support was successful in helping me get the data into MySQL.
And you have my gratitude. Again.
Now how can we fix these problems so I can present the info in the db to the caller?
Here's the code:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
$program_name= $_POST[program_name];
$dbhost='HHHHHHHHHHHHH';
$dbusername='UUUUUUUUUUU';
$dbuserpass='PPPPPPPPPPPPP';
$dbname='NNNNNNNNNNNNNN';
$dbTable='TTTTTTTTTTTTTT';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'.mysql_error());
mysql_select_db($dbname);
$query = "SELECT program_name FROM $dbTable WHERE trx_agent='MASTER'";
$result = mysql_query($query);
mysql_close($conn);
?>
<vxml version="2.0">
<form>
<var name="program_name" expr=" '<? echo ($program_name) ?>' " />
<block>
<prompt> This is <value expr="program_name"/></prompt>
</block>
</form>
</vxml>