The following code works perfectly:
Code: Select all
$user_name = "*****"; // replace your user name within the 2x "
$password = "*****"; // replace your password within the 2x "
$database_name = "*****"; // replace the database name within the 2x "
$table_name = "*****"; // replace the table name within the 2x "
$dbh = mysql_connect("*****", $user_name, $password, $database_name);
$query="SELECT streamLink FROM `$database_name`.`$table_name` WHERE streamName = 'Sands'";
$result = mysql_query($query, $dbh);
$num=mysql_num_rows($result);
echo ($num);
Code: Select all
$user_name = "*****"; // replace your user name within the 2x "
$password = "*****"; // replace your password within the 2x "
$database_name = "*****"; // replace the database name within the 2x "
$table_name = "*****"; // replace the table name within the 2x "
$dbh = mysql_connect("*****", $user_name, $password, $database_name);
function findStreamLink($stream_name)
{
$query="SELECT streamLink FROM `$database_name`.`$table_name` WHERE streamName = '$stream_name' ";
$result = mysql_query($query, $dbh);
$num=mysql_num_rows($result);
echo ($num);
}
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in *****/index.php on line 42
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ******/index.php on line 43
then I tried to change the code a bit to check where the problem is:
Code: Select all
$user_name = "*****"; // replace your user name within the 2x "
$password = "*****"; // replace your password within the 2x "
$database_name = "*****"; // replace the database name within the 2x "
$table_name = "*****"; // replace the table name within the 2x "
$dbh = mysql_connect("*****", $user_name, $password, $database_name);
function findStreamLink($stream_name)
{
if(!$dbh)
{
echo('sth wrong');
}
else
{
$query="SELECT streamLink FROM `$database_name`.`$table_name` WHERE streamName = '$stream_name' ";
$result = mysql_query($query, $dbh);
$num=mysql_num_rows($result);
echo ($num);
}
}
Thank you very much for your suggestions...
--
Pasha Latzo