Help mysql code PHP/Dreamweaver

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Doomingdr
    Junior Member
    • Nov 2012
    • 39

    #1

    Help mysql code PHP/Dreamweaver

    OK, so i maybe doing this backwards but its a personal choice as I am not able to customize shopping the carts the way I want the rest of the site to look so I thought I would design the website first and then add the shopping cart on using PHP and mysql. At the moment I am running wamp (Apache, mysql) I have a database that was set-up using a shopping cart that I have installed, deleted it leaving me with only the database, all good so far - however, here lies the problem.

    I have my database called goodness and in this database is a table called xcart_categories and in this table I have a few row but the ones I am interested in are called category (self explain) and another one called avail (with options of either Y or N). What i want to do is write the code to should all categories with the option of avail as Y. I have tried different combinations searched the web, but unless you know what you are looking for its hard to pin down. I am using Dreamweaver for the design and with my current code I am only able to display one of the category's and cannot figure it out. My code is below. Too keep things simple I have removed all other items from the website. I hope that some one can help me Thanks in advance

    "<?php require_once('Connections/glutenfree.php'); ?><?php require_once('Connections/glutenfree.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_glutenfree, $glutenfree);
    $query_Recordset1 = "SELECT * FROM xcart_categories WHERE xcart_categories.avail=0";
    $Recordset1 = mysql_query($query_Recordset1, $glutenfree) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?php require_once('Connections/glutenfree.php'); ?>
    <?php require_once('Connections/glutenfree.php'); ?>
    <!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">
    </style>
    </head>


    <body>
    <div id="apDiv1">
    <p>Categorys</p>
    <p><?php echo $row_Recordset1['category']; ?></p>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>"

    Windows 7 64bit
    Apache 2.4.2
    PHP 5.4.3
    MYSQL 5.5.24
    Dreamweaver CS6
Working...