This script/function tests properly when using DreamWeaver's Testing Server and Live Data Settings, but fails on the live Web Server, giving the following error.
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/peweb/public_html/mydetfunc.php on line 58
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/peweb/public_html/mydetfunc.php on line 68
Here's the PHP Code for mydetfunc.php
<?php require_once('Connections/Test_Alp.php'); ?>
<?php
// Try and Create a Function from this whole section to use for Static Data
function displayme($recordIDfunc, $billinglngthfunc)
{
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_DetailRS1 = "4";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
if (isset($recordIDfunc)) {
$colname_DetailRS1 = $recordIDfunc;
}
$billname_DetailRS1 = "1";
if (isset($_GET['billinglengthID'])) {
$billname_DetailRS1 = $_GET['billinglengthID'];
}
if (isset($billinglengthfunc)) {
$billname_DetailRS1 = $billinglengthfunc;
}
mysql_select_db($database_Test_Alp, $Test_Alp);
//$query_DetailRS1 = sprintf("SELECT * FROM billings_products, products WHERE products.plan_index = billings_products.product_id AND product_id = %s AND billing_id = %s" , GetSQLValueString($colname_DetailRS1, "int"),GetSQLValueString($billname_DetailRS1, "int"));
//$query_DetailRS1 = sprintf("SELECT .......long select string..... FROM ......several tables...., WHERE billings_products.billing_id = billing_cycles.id AND products.plan_index = billings_products.product_id AND groups_products.product_id = billings_products.product_id AND product_id = %s AND billing_id = %s" , GetSQLValueString($colname_DetailRS1, "int") , GetSQLValueString($billname_DetailRS1, "int"));
$query_DetailRS1 = sprintf("SELECT .......long select string........
FROM ....several tables..........
WHERE billings_products.billing_id = billing_cycles.id
AND products.plan_index = billings_products.product_id
AND groups_products.product_id = billings_products.product_id
AND billings_products.product_id = %s AND billing_id = %s" , GetSQLValueString($colname_DetailRS1, "int") , GetSQLValueString($billname_DetailRS1, "int"));
$DetailRS1 = mysql_query($query_DetailRS1, $Test_Alp) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($DetailRS1);
//Display the Table Info...
//Calculations first
$bw = round(number_format(($row_DetailRS1['bwlimit']/10000) ,1 , ".",""))*10;
$quota= number_format(($row_DetailRS1['quota']/1000) ,1 , ".","");
$amount = money_format('%n',$row_DetailRS1['amount']);
$totaldomains = 1 + $row_DetailRS1['maxaddon'];
//End Calculations
//Check IP Availability based on Friendly Name
if ($row_DetailRS1['plan_friendly_name'] == Base3)
{
$ipavailable = "Upon Request";
}
else
{
$ipavailable = "NO";
}
//End IP Check
echo 'This Formats my Table for Display
?>
This is Test_Alp.php
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Test_Alp = "localhost";
$database_Test_Alp = "DBNAME";
$username_Test_Alp = "USERNAME";
$password_Test_Alp = "PASSWORD";
$Test_Alp = mysql_pconnect($hostname_Test_Alp, $username_Test_Alp, $password_Test_Alp) or trigger_error(mysql_error(),E_USER_ERROR);
?>
And, This is the code I am using inside the Body section of my HTML to display the table and data.
<?php displayme(4,1); ?>
Basically, this finction should read from the database and select a specific row based on the 2 variables passed to the Function. And as mentioned, this tests properly while Viewing DreamWeaver Live Data, but does not work in a Live Environment.
Please Help....
Cliff