2 Replies Latest reply: Mar 25, 2012 2:35 PM by bregent RSS

    Database, PHP help asap??

    adamjewsbury20

      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>

        • 2. Re: Database, PHP help asap??
          bregent MVP

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