anyone having this mysql problem with 4.0.4?
| From: | Jon Rosenberg | Date: | Fri, 22 Dec 2000 05:17:20 +0000 |
| Subject: | anyone having this mysql problem with 4.0.4? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31539@lists.php.net to get a copy of this message | ||
In 4.0.3pl1, this works perfectly, in 4.0.4, I get the error: "Warning: 1
The MySQL link supplied is not a valid link argument" or something very
similar to that.
*********** - line where it reports the error is. If I reinstall 4.0.3pl1
on the same machine (same config options), the error goes away.
Here is the code:
$user = "root"; //username needed to access db
$pass = "jhlklj"; //password needed to access db
$db_server = "localhost"; //the mysql db server
$db = "personals"; //Name of the database where information is stored
$db_table = "gay"; //db table where the information is stored
$db_connect = mysql_connect("$db_server", "$user", "$pass");
function add_to_db( $_fname, $_lname, $_email, $_uname, $_pword, $_headline,
$_sex, $_age, $_city, $_state, $_orientation, $_status, $_race, $_religion,
$_height, $_weight, $_hair, $_eyes, $_education, $_occupation, $_interests,
$_match, $_other, $_date, $bin_pic, $form_data_name, $form_data_type,
&$dberror )
{
global $user, $pass, $db, $db_table, $db_connect, $home_url, $admin_email,
$reg_subject, $reg_message, $site_title;
if ( $_uname == "" || $_pword == "" )
{
print "<br /><br /><center><font color=\"red\">You must
enter both a
username and password.<br /><br /></center></font>";
print_form_full_reg( $_fname, $_lname, $_email, $_uname, $_pword,
$_headline, $_sex, $_age, $_city, $_state, $_orientation, $_status, $_race,
$_religion, $_height, $_weight, $_hair, $_eyes, $_education, $_occupation,
$_interests, $_match, $_other );
exit;
}
if ( ! $db_connect )
{
$dberror = "Couldn't connect";
return false;
}
if (! mysql_select_db($db, $db_connect)) *************
{
$dberror = "Error selecting database to use";
return false;
}
$db_query = "INSERT INTO $db_table ( _fname, _lname, _email, _uname,
_pword, _headline, _sex, _age, _city, _state, _orientation, _status, _race,
_religion, _height, _weight, _hair, _eyes, _education, _occupation,
_interests, _match, _other, _date, bin_pic, filename, filetype ) values (
'$_fname', '$_lname', '$_email', '$_uname',
'$_pword', '$_headline',
'$_sex', '$_age', '$_city', '$_state',
'$_orientation', '$_status',
'$_race', '$_religion', '$_height', '$_weight',
'$_hair', '$_eyes',
'$_education', '$_occupation', '$_interests', '$_match',
'$_other',
'$_date', '$bin_pic', '$form_data_name', '$form_data_type'
)";
if ( ! mysql_query( $db_query, $db_connect ) )
{
$dberror = mysql_error();
return false;
}
else //sends email to user when their info is entered into the db
{
mail( "$_email","$reg_subject","$reg_message", "Content-Type:
text/html;
charset=\"iso-8859-1\"\nFrom:$admin_email\nReply-To:$admin_email\nX-Mailer:P
HP/" . phpversion() );
}
mysql_close ( $db_connect );
return true;
}