Jump to content

[SOLVED] Urgent helpppppppppppp.


whizzykid

Recommended Posts

Hi all,

I designed a database on dreamweaver,i uploaded it on my server for my website i created a form but any time i click on it  it shows no database selected,I have tried to edit it,it still shows no database selected when i click d form,

this is the code pls help what am i nt doing right?

<?php

# FileName="Connections"

# Type="MYSQL"

# HTTP="true"

$hostname_inteecom_ellen = "localhost";

$database_inteecom_ellen = "inteecom_ellen";

$username_inteecom_ellen = "inteecom_lara";

$password_inteecom_ellen = "adebimpe";

$inteecom_ellen = mysql_pconnect($hostname_inteecom_ellen, $username_inteecom_ellen, $password_inteecom_ellen) or trigger_error(mysql_error(),E_USER_ERROR);

?>

 

this is the second one

 

<?php

# FileName="Connections"

# Type="MYSQL"

# HTTP="true"

$hostname_inteecom_ellen = "localhost";

$database_inteecom_ellen = "inteecom_ellen";

$username_inteecom_ellen = "inteecom_lara";

$password_inteecom_ellen = "adebimpe";

$inteecom_ellen = mysql_pconnect($hostname_inteecom_ellen, $username_inteecom_ellen, $password_inteecom_ellen) or trigger_error(mysql_error(),E_USER_ERROR);

?>

 

the form itself.

 

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

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

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $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;

}

}

 

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`) VALUES (%s, %s, %s, %s)",

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "public_html/index.html";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`, `Brief Comments`) VALUES (%s, %s, %s, %s, %s)",

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

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "public_html/index.html";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`, Email, `Brief Comments`) VALUES (%s, %s, %s, %s, %s, %s)",

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

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

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "file:///C|/DOCUME~1/AM/LOCALS~1/Temp/index.html";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

mysql_select_db($$database_inteecom_ellen, $inteecom_ellen);

$query_Recordset1 = "SELECT * FROM `Call Back form`";

$Recordset1 = mysql_query($query_Recordset1, $inteecom_ellen) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

body {

background-color: #E8E8E8;

}

#apDiv1 {

position:absolute;

left:314px;

top:28px;

width:413px;

height:101px;

z-index:1;

}

#apDiv2 {

position:absolute;

left:363px;

top:73px;

width:280px;

height:26px;

z-index:1;

}

#apDiv3 {

position:absolute;

left:356px;

top:145px;

width:341px;

height:37px;

z-index:2;

}

#apDiv4 {

position:absolute;

left:355px;

top:195px;

width:345px;

height:35px;

z-index:3;

}

#apDiv5 {

position:absolute;

left:366px;

top:263px;

width:354px;

height:124px;

z-index:4;

}

#apDiv6 {

position:absolute;

left:115px;

top:4px;

width:346px;

height:11px;

z-index:5;

}

#apDiv7 {

position:absolute;

left:298px;

top:182px;

width:437px;

height:24px;

z-index:1;

}

#apDiv8 {

position:absolute;

left:316px;

top:91px;

width:406px;

height:24px;

z-index:2;

}

#apDiv9 {

position:absolute;

left:308px;

top:135px;

width:428px;

height:21px;

z-index:3;

}

#apDiv10 {

position:absolute;

left:315px;

top:30px;

width:420px;

height:36px;

z-index:4;

}

-->

</style>

<script type="text/javascript">

<!--

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }

//-->

</script>

</head>

 

<body>

<div id="apDiv7">

  <form id="form2" name="form2" method="post" action="">

    Which Department do you need assistant with?

    <select name="Which Department do you need assistant with?" size="1" id="Which Department do you need assistant with?">

      <option>Customer Support</option>

      <option>Accounts</option>

      <option>General</option>

      <option>Sales and Marketing</option>

    </select>

  </form>

</div>

<div id="apDiv8">

  <form id="form3" name="form3" method="post" action="">

    <input type="radio" name="radio" id="Mr" value="Mr" />

    Mr

    <input type="radio" name="radio" id="Mrs" value="Mrs" />

    Mrs

    <input type="radio" name="radio" id="Ms" value="Ms" />

    Ms

    <input type="radio" name="radio" id="Others" value="Others" />

    others

  </form>

</div>

<div id="apDiv9">

  <form id="form4" name="form4" method="post" action="">

    Best time to call you

    <select name="Best time to call you" size="1" id="Best time to call you">

      <option>Now</option>

      <option>Later</option>

      <option>Morning</option>

      <option>Afternoon</option>

      <option>Evening</option>

    </select>

  </form>

</div>

<div id="apDiv10">

  <legend>Call us Back Form.</legend>

  <legend><strong> Ask for one of our advisors to call you back</strong></legend>

</div>

<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1" onsubmit="MM_validateForm('Firstname','','R');MM_validateForm('Brief_Comments','','R');MM_validateForm('Phone_Number','','RisNum');MM_validateForm('Phone_Number','','RisNum');return document.MM_returnValue">

  <p> </p>

<p> </p>

  <p> </p>

  <p> </p>

  <p> </p>

  <p> </p>

  <input type="hidden" name="MM_insert" value="form1" />

</form>

<form action="<?php echo $editFormAction; ?>" method="post" name="form5" id="form5">

  <table align="center">

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">Firstname:</td>

      <td><input type="text" name="Firstname" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">LastName:</td>

      <td><input type="text" name="LastName" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">Company Name:</td>

      <td><input type="text" name="Company_Name" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">Phone Number:</td>

      <td><input type="text" name="Phone_Number" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">Email:</td>

      <td><input type="text" name="Email" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right">Brief Comments:</td>

      <td><input type="text" name="Brief_Comments" value="" size="32" /></td>

    </tr>

    <tr valign="baseline">

      <td nowrap="nowrap" align="right"> </td>

      <td><input type="submit" value="Insert record" /></td>

    </tr>

  </table>

  <input type="hidden" name="MM_insert" value="form5" />

</form>

<p> </p>

<p> </p>

</body>

</html>

<?php

mysql_free_result($Recordset1);

?>

 

What is the problem cause any time i clcik on the form it shows no database selected. ???

Link to comment
https://forums.phpfreaks.com/topic/156797-solved-urgent-helpppppppppppp/
Share on other sites

After your mysql_connect(), use mysql_select_db to select a database on the server. You can run the SQL "use database_name" as well if you want.

 

Hi thank you so much now it shows the form but when i click on submit it shows this error

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/inteecom/public_html/Call back form.php on line 87

and this is the line code on line 87

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

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`) VALUES (%s, %s, %s, %s)",

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "jpg.1";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`, `Brief Comments`) VALUES (%s, %s, %s, %s, %s)",

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

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "jpg.1";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

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

  $insertSQL = sprintf("INSERT INTO `Call Back form` (Firstname, LastName, `Company Name`, `Phone Number`, Email, `Brief Comments`) VALUES (%s, %s, %s, %s, %s, %s)",

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

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

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

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

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

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

 

  mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

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

 

  $insertGoTo = "jpg.1";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

 

mysql_select_db($database_inteecom_ellen, $inteecom_ellen);

$query_Recordset1 = "SELECT * FROM `Call Back form`";

$Recordset1 = mysql_query($query_Recordset1, $inteecom_ellen) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

 

 

Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.