Jump to content

Urgent help needed.!!!


whizzykid

Recommended Posts

I get this error i try to fill this form on my site.

 

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/cicpriva/public_html/Registration.php on line 62

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/cicpriva/public_html/Registration.php on line 63

 

<?php require_once('Connections/cicpriva_reg.php'); ?>

<?php

 

mysql_select_db($database_cicpriva_reg, $cicpriva_reg);

  $Result1 = mysql_query($insertSQL, $cicpriva_reg) or die(mysql_error());

 

And this is my cicpriva_reg.php file

 

$hostname_cicpriva_reg = "localhost";

$database_cicpriva_reg = "cicpriva_reg";

$username_cicpriva_reg = "cicpriva_goto";

$password_cicpriva_reg = "";

$dibby = mysql_pconnect($hostname_cicpriva_reg, $username_cicpriva_reg, $password_cicpriva_reg) or trigger_error(mysql_error(),E_USER_ERROR);

?>

Link to comment
Share on other sites

ok this is it

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {

  $insertSQL = sprintf("INSERT INTO registration (Title, `Last Name`, `First Name`, `Date of Birth`, `Marital Status`, Email, `Mobile Number`, `Phone Number`, Address, `Zip/Postal Code`, Country, `Name of Employeer/Business`, `Address of Employer/Reference`, `Postal  Code`, `Nature of Business/Occupation`, `Position_ Held`, `Gross_  Annual _Income`, `House_ Hold_ Income`, `Preferred_Method_of- Payment`, `Preferred_ Account _Type`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

                      GetSQLValueString($_POST['Title'], "text"),

                      GetSQLValueString($_POST['Last_Name'], "text"),

                      GetSQLValueString($_POST['First_Name'], "text"),

                      GetSQLValueString($_POST['Date_of_Birth'], "date"),

                      GetSQLValueString($_POST['Marital_Status'], "text"),

                      GetSQLValueString($_POST['Email'], "text"),

                      GetSQLValueString($_POST['Mobile_Number'], "int"),

                      GetSQLValueString($_POST['Phone_Number'], "int"),

                      GetSQLValueString($_POST['Address'], "text"),

                      GetSQLValueString($_POST['ZipPostal_Code'], "int"),

                      GetSQLValueString($_POST['Country'], "text"),

                      GetSQLValueString($_POST['Name_of_EmployeerBusiness'], "text"),

                      GetSQLValueString($_POST['Address_of_EmployerReference'], "text"),

                      GetSQLValueString($_POST['Postal__Code'], "int"),

                      GetSQLValueString($_POST['Nature_of_BusinessOccupation'], "text"),

                      GetSQLValueString($_POST['Position__Held'], "text"),

                      GetSQLValueString($_POST['Gross___Annual__Income'], "int"),

                      GetSQLValueString($_POST['House__Hold__Income'], "int"),

                      GetSQLValueString($_POST['Preferred_Method_of_Payment'], "text"),

                      GetSQLValueString($_POST['Preferred__Account__Type'], "text"));

 

  mysql_select_db($database_cicpriva_reg, $cicpriva_reg);

  $Result1 = mysql_query($insertSQL, $cicpriva_reg) or die(mysql_error());

 

Link to comment
Share on other sites

both topics were removed by an Admin... one was duplicated of this one and the other no idea why... anyways

 

complementing PfmAbismad answer

$dibby = mysql_pconnect($hostname_cicpriva_reg, $username_cicpriva_reg, $password_cicpriva_reg) or trigger_error(mysql_error(),E_USER_ERROR); 

mysql_select_db($database_cicpriva_reg, $cicpriva_reg);

 

$dibby <> $cicpriva_reg

 

and my answer for your second post regarding to your other mysql error for your insert was:

 

the usage of pathname delimiters ('/' and '\') are not allowed in column names...

 

Link to comment
Share on other sites

There's a number of things wrong here.

 

First, your thread title is absolutely useless.  Use the title to actually describe the problem.

 

Now, to your actual code.  Look at the error message:

 

 

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/cicpriva/public_html/Registration.php on line 62

mysql_select_db is failing, with the error that the supplied argument is not valid.  What argument are you supplying to that function?  Let's look:

 

mysql_select_db($database_cicpriva_reg, $cicpriva_reg);

So your code believes $cicpriva_reg is the database object.  Why isn't that correct?  Go look at where you make the database object:

 

 

$dibby = mysql_pconnect($hostname_cicpriva_reg, $username_cicpriva_reg, $password_cicpriva_reg) or trigger_error(mysql_error(),E_USER_ERROR); 

 

As PFMaBiSmAd and mikosiko have both already explained, $dibby is not $cicpriva_reg

 

Your database column names are unusual, but not technically incorrect if this is MySQL.  You should try to avoid using special characters like / and \ in your column names, and stick to only letters, numbers, and the underscore character.  That ensures interoperability.

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.