rondog Posted March 4, 2009 Share Posted March 4, 2009 I've created a mysql db on localhost, used php to get the data and echoed it successfully. Now when I try and run a service through AMFPHP, I get Unsupported data type: mysql link. This script works fine when viewing it via http://localhost/test.php <?php $host = "localhost"; $usernameDB = "user"; $passwordDB = "pass"; $whichDB = "somedb"; $con = mysql_connect($host,$usernameDB,$passwordDB); if (!$con) { echo "unable to connect to DB"; echo mysql_error($con); exit(); } $db = mysql_select_db($whichDB); if (!$db) { echo "unable to open DB"; echo mysql_error($db); exit(); } $query = mysql_query("SELECT * FROM JITVideos") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { echo $row['source']."<br/>"; } ?> This service for AMFPHP does not: <?php class JITVideos { /** * description * @returns */ function __construct() { $host = "localhost"; $usernameDB = "user"; $passwordDB = "pass"; $whichDB = "somedb"; $con = mysql_connect($host,$usernameDB,$passwordDB); if (!$con) { echo "unable to connect to DB"; echo mysql_error($con); exit(); } $db = mysql_select_db($whichDB); if (!$db) { echo "unable to open DB"; echo mysql_error($db); exit(); } } /** * Get all of the Just In Time Videos * @returns id, source title and description for the JIT Videos */ function getVideos() { return mysql_query("SELECT * FROM JITVideos ORDER BY id DESC"); } /** * Get the latest JIT Video * @returns id, source title and description for the latest JIT Video */ function getLatestVideo() { return mysql_query("SELECT * FROM JITVideos ORDER BY id DESC LIMIT 1"); } } ?> Can anyone think of a reason why? Link to comment https://forums.phpfreaks.com/topic/147854-php-works-mysql-works-but-amfphp-wont-connect/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.