Jump to content

[SOLVED] Its official PHP hates me, Connection issue


Recommended Posts

No errors it just does nothing why?

 

	
        $username="xxx";
		$password="xxxx";
		$database="xxxxx";
		$server="xxxx";

mysql_connect($server,$username,$password);
@mysql_select_db($database) or die("Unable to select database");

mysql_query (" INSERT INTO affiliates (Company , Contact , domain , email , Tel , Fax , Cell , Address , Postal , Referrer , Confirm , Type , ref2 , ref3 , ref4 , aff_id) VALUES ( '$company', '$fname', '$domain', '$email', '$tel', '$fax', '$cell', '$address', '$postal', '$userid', '0', '$type', '$aff', '$aff1', '$aff2', '$aff3', 'affid')");

if ($coid != NULL) {
$aff = $coid;
$fname = $_REQUEST['fname'];
	if ($fname != NULL) {
	  $company = $_REQUEST['company'];
		$domain = $_REQUEST['domain'];
		$type = $_REQUEST['type'];
		$address = $_REQUEST['address'];
		$postal = $_REQUEST['postal'];
		$tel = $_REQUEST['tel'];
		$cell = $_REQUEST['cell'];
		$fax = $_REQUEST['fax'];
		$email = $_REQUEST['email'];
		$pay = $_REQUEST['payment'];
		/* make sure they are all here */

		$username="xxx";
		$password="xxx";
		$database="xxxx";
		$server="xxxx";

mysql_connect($server,$username,$password);
@mysql_select_db($database) or die("Unable to select database");

mysql_query (" INSERT INTO affiliates (Company , Contact , domain , email , Tel , Fax , Cell , Address , Postal , Referrer , Confirm , Type , ref2 , ref3 , ref4 , aff_id) VALUES ( '$company', '$fname', '$domain', '$email', '$tel', '$fax', '$cell', '$address', '$postal', '$userid', '0', '$type', '$aff', '$aff1', '$aff2', '$aff3', 'affid')");

		/* INSERT INTO DATABASE
			 SEND CONFIRMATION EMAIL TO CLIENT


		*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<style>
body {
font-family :Verdana;
font-size: 9pt;
text-align: left;
text-decoration:none;
background-attachment : fixed;
background-position : center top;
background-repeat : no-repeat;
background-color : white;
background-image : url(webtech.jpg);}
h1 {font-family :Verdana;
font-size: 11pt;
text-align: left;}
a {font-family :Verdana;
font-size: 10pt;
font_weight: bolder;
color: #009999;
text-decoration:none;
text-align: left;}
td {
font-family :Verdana;
font-size: 10pt;
text-align: left;
text-decoration:none;}
</style>


<title>Website order page</title>
</head>
<body><div align="center"><table summary="" width="770">
<tr>
<td>
<h1>Success</h1>



<?php
		echo "Dear $fname" ;
?>			
		<br /><br /> Thank you for your order. Due to high levels of spam and in order to confirm your email address we have sent you a confirmation link to the email address you have given us. You will need to visit the link to finalise this transaction and receive payment details. <br /><br />Once we have received your confirmation, signed debit order and proof of payment we will reserve your domain name and install your website within 3 - 4 days.
</table>
</form>
</div>

<?php			
	}	
?>

Try as Maq suggested.  I would rewrite it like so:

 

$query=" INSERT INTO affiliates (Company , Contact , domain , email , Tel , Fax , Cell , Address , Postal , Referrer , Confirm , Type , ref2 , ref3 , ref4 , aff_id) VALUES ( '$company', '$fname', '$domain', '$email', '$tel', '$fax', '$cell', '$address', '$postal', '$userid', '0', '$type', '$aff', '$aff1', '$aff2', '$aff3', 'affid')";

 

echo $query;

 

mysql_query($query);

 

That will list your exact query so you can check for errors

mysql_query (" INSERT INTO affiliates (Company , Contact , domain , email , Tel , Fax , Cell , Address , Postal , Referrer , Confirm , Type , ref2 , ref3 , ref4 , aff_id) VALUES ( '$company', '$fname', '$domain', '$email', '$tel', '$fax', '$cell', '$address', '$postal', '$userid', '0', '$type', '$aff', '$aff1', '$aff2', '$aff3', 'affid')") or die(mysql_error());

put the or die extension on the mysql_query function rather than mysql_select_db

 

if the db wasn't selected...mysql_query won't even work, so there's no reason to put an or die on the select db unless you really want to know why...which would most likely be a mispell or a bad permission.

 

so..

 

try

mysql_query("INSERT query blahblah blah") or die("ERROR: " . mysql_error());

Thank you, I now have input happening YAY. Time for me to check some other stuff before coming back here to ask more noob questions. Who knew PHP was gonna make me feel like I have never coded before. Actually MY ASP skills helped solve one or two problems and I am guessing that the logic at least helps a bit, but these curly brackets and things are verry confusing

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.