Skip navigation links

MySQL Forums :: PHP :: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 50


Advanced Search

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 50
Posted by: Jonathan Denwood ()
Date: October 05, 2007 12:57PM

Hi Folks, I wonder if you might be able to give me some advice. I have an small e-commence application which I developed about 3 to 4 years ago using PHP and MySQL. I have returned to it recently, to use it as part of my personal portfolio site. I did have some troubles getting the site to work on a newer versions of MySQL . This was mostly connected to the changes between MySQL version 4 and version 5 connected to password usage. However, I managed to overcome this problems. I have managed to get the application to work on a mixture of local development environments on Windows and Mac plus I have got the application to work on an my small test Linux server running Fedora which I can view outside my local loop.

However, when I have transferred this application to my main external website which is run on by an Internet Provider. I get this message which I find very puzzling. I did develop this application in Dreamweaver however, I feel that I have changed the DW connect php file with the right information see below.

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 50

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 55

Here is the code from the page

<?php setcookie("username_cookie", $HTTP_POST_VARS["username"], time()+86400*90); ?>
<?php require_once('Connections/jonathan.php'); ?>
<?php
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;
}
}
?><?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "welcome.php";
$MM_redirectLoginFailed = "search.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_jonathan, $jonathan); (line 50 Jonathan Denwood)

$LoginRS__query=sprintf("SELECT username, password FROM login WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $jonathan) or die(mysql_error()); (line 55 Jonthand Denwood)
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>

I have changed the connect.php file so it should have the right remote database connect information see below

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_jonathan = "localhost";
$database_jonathan = "digita47_products";
$username_jonathan = "digita47_jonathan";
$password_jonathan = "**************";
$jonathan = mysql_pconnect($hostname_jonathan, $username_jonathan, $password_jonathan) or trigger_error(mysql_error(),E_USER_ERROR);
?>


I don’t really understand why I am getting this warning message when I have tested on the application on an local environment using the same version of PHP and MySQL. I thought it could be that my external website provider was using the latest versions of PHP and MySQL the company offered to transfer me to different server which was running MySQL 4.1 and PHP 4 however, I still get the same warning message. I wonder if you can give me some advice on why I am having this problems.

Take care


Jonathan Denwood

Options: ReplyQuote


Subject Written By Posted
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 50 Jonathan Denwood 10/05/2007 12:57PM
Re: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/digita47/public_html/stridesdrycleaners/default.php on line 50 Hartmut Holzgraefe 10/06/2007 11:49PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.