Jump to content

PHP works, MySQL works, but AMFPHP wont connect


rondog

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.