Skip navigation
adamjewsbury20
Currently Being Moderated

Database, PHP help asap??

Mar 25, 2012 5:11 AM

Tags: #cs5 #help #php #dreamweaver #code #dw

Okay, I seem to have forgetten everything I once knew about PHP in the space of a 3 month break from it haha

 

I am attempting to take a user details (name, address, card number, card type, etc) and add them to a database, seems fairly simple but I dont have a clue

 

Also, I would like a search option that will allow the user to search using their email address to display their account details..

 

And if they can search their details, they are able to delete their account..

 

If anyone can help me with any of these it would be greatly appreciated!

 

I made it this far in the code till mind went blank!

 

 

 

<!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>

</head>

 

 

<body>

 

 

<?php require_once('../../../Connections/localhost.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;

}

}

 

 

mysql_select_db($database_localhost, $localhost);

$query_Recordset1 = "SELECT * FROM paymentdetails";

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

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

 

 

<?php

mysql_free_result($Recordset1);

?>

 

 

</body>

</html>

 
Replies
  • Currently Being Moderated
    Mar 25, 2012 10:47 AM   in reply to adamjewsbury20
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2012 2:35 PM   in reply to adamjewsbury20

    >I am attempting to take a user details (name, address, card number,

    >card type, etc) and add them to a database

     

    You can use DW insert record server behavior for this. Think twice before you decide to store payment card information in your database - it's a huge liability. You need to use SSL and encrypt the database, plus much more. Unless you are familar with PCI standards and have expertise in web security, don't do it.

     

    >Also, I would like a search option that will allow the user to

    >search using their email address to display their account details..

     

    Use DW's search data behavior

     

    >And if they can search their details, they are able to delete their account..

     

    Use the delete record behavior. Of course, you need to take precautions that the logged in user can only delete their own account.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points