access mysql db with DW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I created a database in mysql - running php via apache on a XP os.  I get a
good connection in dreamweaver with the database panel - no problems
connecting and viewing tables in dw.

I created a form that I want to load the user info to the table.  My run
line is:
ttp://127.0.0.1:8080/dreamweaverhotel/bookings/add_user_record.php  - the
page shows blank - in the view source I get a basic shell of html -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

That's it! - the path is good - I loaded some other php files that work in
there and they run fine.  My phpMyAdmin works great - So I know the
localhost connection is good and php is working and mysql is fine I can
access it through phpMyAdmin or dw in database panel, those parts are
working.  So there is obviously something wrong with my add_user.php file
(the one that won't work).  Now DW has put the connection variables in my
code - can anyone tell me what is wrong? - hopefully.

This was all created with DW.

And here is what is in the connHotel.php file:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_connHotel = "127.0.0.1:8080";
$database_connHotel = "dwhotel";
$username_connHotel = "root";
$password_connHotel = "t4540";
$connHotel = mysql_pconnect($hostname_connHotel, $username_connHotel,
$password_connHotel) or die(mysql_error());
?>

Thanks - This is just the php part - the html form part goes below - I
didn't want to lload too much.


<?php require_once('../Connections/connHotel.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"]
== "userform")) {
  $insertSQL = sprintf("INSERT INTO clients (title, firstname, lastname,
address1, address2, town, province, postcode, email) VALUES (%s, %s, %s, %s,
%s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['title'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['firstname'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['lastname'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['address1'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['address2'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['town'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['province'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['postcode'],
"text"),
                       GetSQLValueString($HTTP_POST_VARS['email'], "text"));

  mysql_select_db($database_connHotel, $connHotel);
  $Result1 = mysql_query($insertSQL, $connHotel) or die(mysql_error());

  $insertGoTo = "booking_details.php?email=".HTTP_POST_VARS["email"]."";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux