PHP/MYSQL Insert code

I am new to php/MYSQL but I am trying to learn. I built an
insert page using DW8. I was looking back over the code trying to
figure it out. Is it just me or does dreamweaver an a bunch of junk
to there code to do a simple insert from 4 form fields.
Can anyone explain what DW is doing since I am now dumber for
having looked at it.
<?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 = $_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 reviews (review_date,
review_name, review_address1, review_city, review_state) VALUES
(%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['date'], "date"),
GetSQLValueString($_POST['textfield'], "text"),
GetSQLValueString($_POST['textfield2'], "text"),
GetSQLValueString($_POST['textfield3'], "text"),
GetSQLValueString($_POST['textfield4'], "text"));
mysql_select_db($database_siteData, $siteData);
$Result1 = mysql_query($insertSQL, $siteData) or
die(mysql_error());
$insertGoTo = "
http://www.yahoo.com/";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
mysql_select_db($database_siteData, $siteData);
$query_Recordset1 = "SELECT * FROM reviews";
$Recordset1 = mysql_query($query_Recordset1, $siteData) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

newhorizonhosting.com wrote:
> I am new to php/MYSQL but I am trying to learn. I built
an insert page using
> DW8. I was looking back over the code trying to figure
it out. Is it just me or
> does dreamweaver an a bunch of junk to there code to do
a simple insert from 4
> form fields.
No, it's not a bunch of junk. It's filtering the input to
make sure that
things are inserted correctly into your database.
> Can anyone explain what DW is doing since I am now
dumber for having looked at
> it.
This function filters the form content to prepare it for
insertion in
the database.
> function GetSQLValueString($theValue, $theType,
$theDefinedValue = "",
> $theNotDefinedValue = "")
This sets the action value of the form tag, including any
query string.
> $editFormAction = $_SERVER['PHP_SELF'];
> if (isset($_SERVER['QUERY_STRING'])) {
> $editFormAction .= "?" .
htmlentities($_SERVER['QUERY_STRING']);
> }
This builds the SQL query and inserts the form content into
the database.
> if ((isset($_POST["MM_insert"])) &&
($_POST["MM_insert"] == "form1")) {
> $insertSQL = sprintf("INSERT INTO reviews (review_date,
review_name,
> review_address1, review_city, review_state) VALUES (%s,
%s, %s, %s, %s)",
> GetSQLValueString($_POST['date'], "date"),
> GetSQLValueString($_POST['textfield'], "text"),
> GetSQLValueString($_POST['textfield2'], "text"),
> GetSQLValueString($_POST['textfield3'], "text"),
> GetSQLValueString($_POST['textfield4'], "text"));
>
> mysql_select_db($database_siteData, $siteData);
> $Result1 = mysql_query($insertSQL, $siteData) or
die(mysql_error());
This redirects the page after the database query has
finished.
> $insertGoTo = "
http://www.yahoo.com/";
> if (isset($_SERVER['QUERY_STRING'])) {
> $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" :
> $insertGoTo .= $_SERVER['QUERY_STRING'];
> }
> header(sprintf("Location: %s", $insertGoTo));
> }
This is unrelated to the insert. It's a recordset that
retrieves
everything from the reviews table of your database.
> mysql_select_db($database_siteData, $siteData);
> $query_Recordset1 = "SELECT * FROM reviews";
> $Recordset1 = mysql_query($query_Recordset1, $siteData)
or die(mysql_error());
> $row_Recordset1 = mysql_fetch_assoc($Recordset1);
> $totalRows_Recordset1 = mysql_num_rows($Recordset1);
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Similar Messages

  • PHP MySQL Error Code 500

    May be someone can help me out with this problem.
    I have setup a new site using PHP MySQL and Dreamweaver 8.02.
    Dreamweaver connects to the database but after creating a
    recordset the recordset cannot be used.
    instead Dreamweaver returns:
    HTTP Error Code 500 internal Server Error
    Any help will be much appriciated.
    Jos

    Hello,
    I have also had the same error - namely that whilst I could connect via ftp, upload/download files, and view database tables, any attempt to view of modify recordsets resulted in error 500.
    Having checked other potential causes (e.g. selection/non-selection use of passive FTP setting, enabling of php, etc.), on the back of posts here I contacted my host and asked if if could relate to mod security, as further investigation revealed that the issue only occurred on sites where mod security had not been disabled (I don't like to disable mod security for obvious reasons - and I'm told you can't do that site by site with apache2 anyway).
    After a few false starts, the problem was resolved - with the following response from my host: "The false positives were being generated by "/_mmServerScripts/MMHTTPDB.php" and that is what we've worked around in the rules. As such, any domain on [servername] using that script in the same way shouldn't generate a false-positive moving forward."
    So it seems the answer (assuming your on an apache server of course) may be to modify the rules to allow full access for MMHTTPDB.php.
    I hope that is of help to some.

  • PHP/MySQL Insert Record

    I've got a multi page form that carries values across
    multiple pages with the use of Hidden Fields and then on last page
    inserts the record into a MySQL database (for this I used the built
    in Insert Record function of dreamweaver). My problem is that it
    works well when using Internet Explorer, values are carried forward
    and everything is inserted successfully to the database.
    But, when using Mozilla Firefox it looks as if it works, I
    get the confirmation at the end, but the record is not being
    inserted to the database. I've worked through this step by step and
    the values are being carried across in the hidden fields but it
    just will not insert anything to the database.
    Has anyone got any ideas??
    Thank you in advance.

    Cade06 wrote:
    > Thanks alot for your reply, but I am completely new to
    MySQL, and I am not
    > quite sure how the syntax works. When you say " WHERE
    landlord_username =
    > 'whatever' "I'm not sure what needs to go in the
    'whatever' portion of the
    > code. Do I need to insert static text here or something
    else? I am totally out
    > of my element here, sorry :-/
    It's probably not so much MySQL syntax that's the problem for
    you, but a
    lack of understanding how to work with Dreamweaver
    recordsets, server
    behaviors, and sessions. Building database-driven sites with
    Dreamweaver
    isn't difficult, but there are a lot of things involved.
    The Log In User server behavior automatically creates a
    session variable
    called $_SESSION['MM_Username']. You can use this as a
    parameter to pass
    to the SQL query in the Advanced Recordset dialog box. In the
    SQL area
    you would type (I'm guessing the name of your table and the
    username
    column):
    SELECT landlord_id FROM landlords
    WHERE landlord_username = 'col1'
    Then click the plus button above the Variables area, and
    create a
    Parameter with the following values:
    Name: col1
    Default value: 1
    Runtime value: $_SESSION['MM_Username']
    You can then extract the result of the recordset, and assign
    it to a
    session variable like this:
    $_SESSION['landlord_id'] = $row_recordsetName['landlord_id'];
    > Also, I understand that I need to do this on the login
    page, but do I need to
    > define the recordset again on the add_site page as well?
    I guess I'm still not
    > quite clear on how I specify the session variable as the
    value that needs to be
    > entered in the sites table as the landlord_ID.
    As long as the session is still valid (which it would be if
    you use
    Restrict Access to Page), you will always have access to that
    landlord's
    id through $_SESSION['landlord_id'].
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • PHP/mySQL Insert/Update Problems

    I hope someone can help because I can't find anything online
    that is helping me with this problem. I can't get the Dreamweaver
    controls to work when coding a PHP insert or update record page. It
    looks like it creates the code correctly but when I put them out on
    my webserver and then fill out the form and click submit the page
    submits and tries to use a URL string of (null)/admin/index.php
    where index.php is the form page not the page I told it to redirect
    to. I don't know why the (null) value keeps getting inserted into
    the string either. The browser obviously can't find this URL so
    gives a page cannot be displayed screen and nothing get's inserted
    or updated in the mySQL database.
    Any help would be greatly appreciated. This problem is
    driving me crazy because I want to save time not having to hand
    code things. Below is a User Authentication page using the
    Dreamweaver controls that does the same thing when I try to
    login.

    tobyd wrote:
    > the page submits and tries to use a URL string of
    (null)/admin/index.php
    > where index.php is the form page not the page I told it
    to redirect to. I don't
    > know why the (null) value keeps getting inserted into
    the string either.
    The following two lines set the URL for login success and
    failure.
    > $MM_redirectLoginSuccess = "../admin_index.php";
    > $MM_redirectLoginFailed = "../admin/index.php";
    As you can see, they are relative paths, suggesting that the
    login form
    is in a different subfolder, but at the same level as
    admin_index.php
    and the admin folder. The (null) almost certainly comes from
    the fact
    that your login page is in the site root. If you're typing in
    the
    redirect filenames manually, use the Browse button instead.
    Dreamweaver
    should set the correct path for you.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • PHP-MySQL "INSERT INTO" query not working

    Hi,
    The code below fails to update a MySQL table I have made called "tampa."  I'm not sure why.  The field "id" is an index field, auto-increment, and primary-type.  The field "site" is also an index field, but just unique-type.  Does the fact that these two fields are index fields have anything to do with why the code below won't update the table?
    Thanks in advance,
    John
    <form action="process.php" method="post">
    Add a blog to this category: <input name="site" type="text" size="50">
    <input type="submit" value="Submit">
    </form>
    PHP code in a file called "process.php":
    <?
    $site=$_POST['site'];
    mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
    mysql_select_db("sand2") or die(mysql_error());
    mysql_query("INSERT INTO `tampa` ('id', 'site', 'value') VALUES (NULL, '$site',1)");
    $result = mysql_query("INSERT INTO `tampa` ('id', 'site', 'value') VALUES (NULL, '$site',1)");
    ?>

    The reason it fails is because you have surrounded the column names with quotes. You are also running the insert query twice. And yet another problem: you are inserting a form value into the database without filtering it.
    <?php
    mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
    mysql_select_db("sand2") or die(mysql_error());
    // strip slashes if magic quotes are enabled
    $site = get_magic_quotes_gpc() ? stripslashes($_POST['site'] : $_POST['site'];
    // make form value safe to insert in DB
    $site = mysql_real_escape_string($site);
    mysql_query("INSERT INTO `tampa` (id, site, value) VALUES (NULL, '$site',1)");
    ?>

  • Php/mysql all caps

    I have a php mysql insert record application built in
    dreamweaver. Is there a way to force or convert all inputted text
    to all caps? I tried a style sheet text transform, but that doesn't
    make the actual entry into the database all caps. Thanks.

    Admittedly though, that's pretty easy too.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Gary White" <[email protected]> wrote in message
    news:[email protected]..
    > On Tue, 13 Jan 2009 23:09:15 +0000, David Powers
    <[email protected]>
    > wrote:
    >
    >>Why? That means converting the data every time it's
    displayed. If the
    >>data is always required as uppercase, it makes more
    sense to convert it
    >>once at the time of storage.
    >
    > For the most part, I agree. However, there is the
    possibility down the
    > road, that they might want to use the data for something
    other than the
    > current ticker. In that case, it might display better in
    mixed case. It's
    > a lot easier to convert to all upper case for the
    ticker, than to try to
    > convert all upper case to mixed case.
    >
    > Gary

  • PHP/mySQL code help please

    Hi all,
    Thanks to David Powers fab tutorial I am now well on my way to competeing my first dynamique website using PHP/mySQL, (thanks David ), however I am stuck on one particular area....can anyone please help?
    I know that the mySQL database uses the format YYYY/MM/DD for dates, and that is fine. I've sorted out how to display in a more regular format (eg. 1st September 2011) for my application, but I am stuck on how to convert a more regular formatted date entered by the site user into the mySQL format.
    Ideally I would like for the users entry or say either 1/9/11 or 1-9-11 (or something along those lines, to be recognised and displayed on the entry form, but to have a backend function that converts the data to mySQL format. I seem to be reading plenty of forum posts which say this can be done, but unfortunately I can't quite seem to fathom how, or where the code should sit. Would someone mind taking a look at my code page to actually identify what I need to insert, and equally as importantly...where!!!
    Along these lines...is it possible to have a mini-calendar date picker that could be embedded next to the date entry field to ensure that a valid date is entered and in the correct format? Where could this be sourced?
    Thanks in advance of some much needed help
    Mark

    This is becoming really frustrating for me (so god knows how I am to you!!!!), but I usually pick things up so fast and yet this whole PHP/SQL thing is eluding me!!
    I can see (I think) how the code would work, but am struggling to see where it fits into place with my own Dreamweaver 'Update Record' code, as follows. I have spent a couple of days trawling through PHP.net and various other sites and forums before bringing my stupidity to the public domain, but I just can't seem to crack it.
    This one last time then i'll leave you in peace??????
    <?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_update"])) && ($_POST["MM_update"] == "form1")) {
        $updateSQL = sprintf("UPDATE gig_guide SET `date`=%s, town=%s, venue=%s, private_or_public=%s, start_time=%s WHERE `index`=%s",
                           GetSQLValueString($_POST['date'], "date"),
                           GetSQLValueString($_POST['town'], "text"),
                           GetSQLValueString($_POST['venue'], "text"),
                           GetSQLValueString($_POST['type'], "text"),
                           GetSQLValueString($_POST['start_time'], "text"),
                           GetSQLValueString($_POST['index'], "int"));
      mysql_select_db($database_online, $online);
      $Result1 = mysql_query($updateSQL, $online) or die(mysql_error());
      $updateGoTo = "index.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    $colname_updatePost = "-1";
    if (isset($_GET['index'])) {
      $colname_updatePost = $_GET['index'];

  • Inserting special character like apostrophes with PHP/Mysql

    Hi friends,
    I have a problem with php/mysql. I have created a form inton a php page with dreamweaver and when i try to fill the form with a string containing apostrophe ( ' ), i have a error. It seems that the insertion is not possible. Could you have any idea for that. I give you the php dreamweaver code and thank you for your help.
    <?php require_once('Connections/Mainconnect.php'); ?>
    <?php require_once('Zend/Date.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":
    if ($theValue=="")
        $theValue="NULL";
    else
        $zendDate=new Zend_Date($theValue,"dd/MM/yyyy");
        $theValue="'".$zendDate->toString("yyyy-MM-dd")."'";
          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_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE pers_soc_reg SET field1=%s, field2=%s,
                           GetSQLValueString($_POST['field1'], "text"),
                           GetSQLValueString($_POST['field2'], "double"));

    "Normally, you canot use mysql_real_escape_string without connection to database"
    That is not true at all. Try running the following script.
    <?php
    if ($_POST['submit']){
    $x1=$_POST['test1'];
    foreach ($_POST as $key => $value) {
    if (!is_array($value)){
    $_POST[$key] = mysql_real_escape_string($value);
    extract($_POST);
    echo "The text after 'becomes' should be escaped (\')<br/>";
    echo "$x1 becomes $test1<br/>";
    ?>
    <hr/>
      <form action="#" method="post" />
    Enter some text, including an apostrophe: <input name="test1" type="text"><br/>
        <p><input name="submit" value="submit" type="submit"/>
      </form>

  • Problem to insert id into the foreign key  php/mysql

    Hello all,
    I'm having rouble to understand the process and there is no tutorial about my problem anywhere
    I have two table:
    Table 1 (member) with id, name, phone etc
    Table2 (post) add_id, title, description, price, member_id
    I got a form to post the add and I need to insert the id of table 1 into my table 2 member_id zone
    Fisrt I did the recorset to get user id
    $colname_rsMember = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsMember = $_SESSION['MM_Username'];
    mysql_select_db($database_connect, $connect);
    $query_rsMember = sprintf("SELECT * FROM member WHERE username='".$_SESSION['MM_Username']."'")or die(mysql_error());
    $rsMember = mysql_query($query_rsMember, $connect) or die(mysql_error());
    $row_rsMember = mysql_fetch_assoc($rsMember);
    $totalRows_rsMember = mysql_num_rows($rsMember);
    This part is working and I'm able to retreive info via echo just for testing
    After this code I have my insert code
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
      $insertSQL = sprintf("INSERT INTO add (title, `description`, price, member_id) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['title'], "text"),
                           GetSQLValueString($_POST['description'], "text"),
                           GetSQLValueString($_POST['price'], "text"),
                           GetSQLValueString($_POST['member_id'], "int"));
      mysql_select_db($database_connect, $connect);
      $Result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
      $insertGoTo = "ok.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    Do I need to include hidden field in y form?
    I'm having the same error message. Col member_id can't not be null
    Any idea what I'm doing wrong?
    Thank You!

    When someone logs in, Dreamweaver creates a session variable called $_SESSION['MM_Username']. Use that session variable to create a recordset to get the user's ID, which can then be entered into the foreign key field of the child table.
    Dreamweaver automatically puts the code for recordsets immediately above the DOCTYPE declaration, so you will need to move it above the code for the Insert Record server behavior. So, it needs to be in this order:
    Recordset to get user ID
    Insert Record for child table

  • PHP/MySql Error Message

    I've posted this before and didn't get the answer that I need, probably because I didn't post all of my codes. I am using PHP/MySql.  I created a website that has several forms.  When I process three of the forms, I get the error messages below:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Condition, Length, Color, City, `State`, Email, Photo) VALUES ('29', '4', 'Used'' at line 1.
    Below I am posting the codes.  Hopefully, this time I posted everything that I should have so that I can get assistance.   
    FORM
    <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
      <table width="594" border="0" class="test">
      <tr></tr>
      <tr>
        <td width="166" class="td">Posting Title</td>
        <td colspan="3"><span id="sprytextfield1">
          <label>
            <input name="Posting Title" type="text" class="test" id="Posting Title" size="35" />
            </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">Price</td>
        <td colspan="3"><span id="sprytextfield2">
          <label>
            <input name="price" type="text" class="test" id="price" size="35" />
          </label>
          <span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td class="td">Size(s)</td>
        <td colspan="3"><label>
          <select name="size" size="1" multiple="multiple" class="test" id="size">
    <option>0</option>
            <option>2</option>
            <option>4</option>
            <option>6</option>
            <option>8</option>
            <option>10</option>
            <option>12</option>
            <option>14</option>
            <option>16</option>
            <option>18</option>
            <option>20</option>
            <option>22</option>
            <option>24</option>
            <option>26</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Condition</td>
        <td colspan="3"><label>
          <select name="Condition" class="test" id="Condition">
    <option>New</option>
            <option>Used</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Length</td>
        <td colspan="3"><label>
          <select name="Length" class="test" id="Length">
    <option>Long</option>
    <option>Short</option>
    <option>Mid-Length</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Color</td>
        <td colspan="3" class="td"><span id="sprytextfield5">
          <label>
            <input name="Color" type="text" class="test" id="Color" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">City</td>
        <td class="td"><span id="sprytextfield4">
          <label>
            <input name="City" type="text" class="test" id="City" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
        <td class="td"> </td>
        <td class="td"> </td>
      </tr>
      <tr>
        <td class="td">State</td>
        <td colspan="3"><label>
          <select name="State" class="test" id="State">
            <option>AL</option>
            <option>AK</option>
            <option>AZ</option>
            <option>AR</option>
            <option>CA</option>
            <option>CO</option>
            <option>CT</option>
            <option>DE</option>
            <option>DC</option>
            <option>FL</option>
            <option>GA</option>
            <option>HI</option>
            <option>ID</option>
            <option>IL</option>
            <option>IN</option>
            <option>IA</option>
            <option>KS</option>
            <option>KY</option>
            <option>LA</option>
            <option>ME</option>
            <option>MD</option>
            <option>MA</option>
            <option>MI</option>
            <option>MN</option>
            <option>MS</option>
            <option>MO</option>
            <option>MT</option>
            <option>NE</option>
            <option>NV</option>
            <option>NH</option>
            <option>NJ</option>
            <option>NM</option>
            <option>NY</option>
            <option>NC</option>
            <option>ND</option>
            <option>OH</option>
            <option>OK</option>
            <option>OR</option>
            <option>PA</option>
            <option>RI</option>
            <option>SC</option>
            <option>SD</option>
            <option>TN</option>
            <option>TX</option>
            <option>UT</option>
            <option>VT</option>
            <option>VA</option>
            <option>WA</option>
            <option>WV</option>
            <option>WI</option>
            <option>WY</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Email</td>
        <td colspan="3"><span id="sprytextfield3">
          <label>
            <input name="Email" type="text" class="test" id="Email" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Confirm Email</td>
        <td colspan="3"><span id="spryconfirm1">
          <label>
            <input name="Confirm Email2" type="text" class="test" id="Confirm Email2" size="35" />
          </label>
          <span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Photo(s)</td>
        <td colspan="3"><label>
          <input name="Photo" type="file" class="test" id="Photo" size="35" />
        </label></td>
      </tr>
      <tr>
        <td height="131" class="td">Additional Details</td>
        <td colspan="3"><label>
          <textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
        </label></td>
      </tr>
      </table>
      <p>
        <label>
          <input name="Submit" type="submit" class="test" id="Submit" value="Post" />
        </label>
      </p>
      <input type="hidden" name="MM_insert" value="individual" />
    </form>
    SERVER BEHAVIOR
    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"] == "individual")) {
      $insertSQL = sprintf("INSERT INTO donations (postingTitle, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['Posting Title'], "text"),
                           GetSQLValueString($_POST['size'], "text"),
                           GetSQLValueString($_POST['Condition'], "text"),
                           GetSQLValueString($_POST['Length'], "text"),
                           GetSQLValueString($_POST['Color'], "text"),
                           GetSQLValueString($_POST['City'], "text"),
                           GetSQLValueString($_POST['State'], "text"),
                           GetSQLValueString($_POST['Email'], "text"),
                           GetSQLValueString($_POST['Photo'], "text"));
      mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
      $Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
      $insertGoTo = "donations.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    DATABASE CONNECTION
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_bridesmaidsrack_db = "localhost";
    $database_bridesmaidsrack_db = "bridesmaidsrack";
    $username_bridesmaidsrack_db = "";
    $password_bridesmaidsrack_db = "";
    $bridesmaidsrack_db = mysql_pconnect($hostname_bridesmaidsrack_db, $username_bridesmaidsrack_db, $password_bridesmaidsrack_db) or trigger_error(mysql_error(),E_USER_ERROR);

    Hi David,
    I did as you recommended. For good measure, I even changed the case of the letters to make sure that they coincide with exactly what's in the database.  I still kept getting the same error message.  So I deleted the recordset and attempted to recreate it.  When I attempted to recreate the record set, I got the following error message: "RangeError: invalid array length".  My codes are listed below:
    Form:
    <form method="POST" enctype="multipart/form-data" name="individual" class="individual" id="individual">
      <table width="594" border="0" class="test">
      <tr></tr>
      <tr>
        <td width="166" class="td">Posting Title</td>
        <td colspan="3"><span id="sprytextfield1">
          <label>
            <input name="posting_title" type="text" class="test" id="posting_title" size="35" />
            </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">Size(s)</td>
        <td colspan="3"><label>
          <select name="size" size="1" multiple="multiple" class="test" id="size">
      <option>0</option>
            <option>2</option>
            <option>4</option>
            <option>6</option>
            <option>8</option>
            <option>10</option>
            <option>12</option>
            <option>14</option>
            <option>16</option>
            <option>18</option>
            <option>20</option>
            <option>22</option>
            <option>24</option>
            <option>26</option>
            </select>
          <span class="Text">To select multiple sizes, hold ctrl and select each size.</span></label></td>
      </tr>
      <tr>
        <td class="td">Condition</td>
        <td colspan="3"><label>
          <select name="condition" class="test" id="condition">
    <option>New</option>
            <option>Used</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Length</td>
        <td colspan="3"><label>
          <select name="length" class="test" id="length">
    <option>Long</option>
    <option>Short</option>
    <option>Mid-Length</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Color(s)</td>
        <td colspan="3" class="td"><span id="sprytextfield5">
          <label>
            <input name="color" type="text" class="test" id="color" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
      </tr>
      <tr>
        <td class="td">City</td>
        <td class="td"><span id="sprytextfield4">
          <label>
            <input name="city" type="text" class="test" id="city" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span></span></td>
        <td class="td"> </td>
        <td class="td"> </td>
      </tr>
      <tr>
        <td class="td">State</td>
        <td colspan="3"><label>
          <select name="state" class="test" id="state">
            <option>AL</option>
            <option>AK</option>
            <option>AZ</option>
            <option>AR</option>
            <option>CA</option>
            <option>CO</option>
            <option>CT</option>
            <option>DE</option>
            <option>DC</option>
            <option>FL</option>
            <option>GA</option>
            <option>HI</option>
            <option>ID</option>
            <option>IL</option>
            <option>IN</option>
            <option>IA</option>
            <option>KS</option>
            <option>KY</option>
            <option>LA</option>
            <option>ME</option>
            <option>MD</option>
            <option>MA</option>
            <option>MI</option>
            <option>MN</option>
            <option>MS</option>
            <option>MO</option>
            <option>MT</option>
            <option>NE</option>
            <option>NV</option>
            <option>NH</option>
            <option>NJ</option>
            <option>NM</option>
            <option>NY</option>
            <option>NC</option>
            <option>ND</option>
            <option>OH</option>
            <option>OK</option>
            <option>OR</option>
            <option>PA</option>
            <option>RI</option>
            <option>SC</option>
            <option>SD</option>
            <option>TN</option>
            <option>TX</option>
            <option>UT</option>
            <option>VT</option>
            <option>VA</option>
            <option>WA</option>
            <option>WV</option>
            <option>WI</option>
            <option>WY</option>
          </select>
        </label></td>
      </tr>
      <tr>
        <td class="td">Email</td>
        <td colspan="3"><span id="sprytextfield3">
          <label>
            <input name="email" type="text" class="test" id="email" size="35" />
          </label>
          <span class="textfieldRequiredMsg">Required</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Confirm Email</td>
        <td colspan="3"><span id="spryconfirm1">
          <label>
            <input name="confirm_email2" type="text" class="test" id="confirm_email2" size="35" />
          </label>
          <span class="confirmRequiredMsg">Required</span><span class="confirmInvalidMsg">The values don't match.</span></span></td>
      </tr>
      <tr>
        <td height="26" class="td">Photo(s)</td>
        <td colspan="3"><label>
          <input name="Photo" type="file" class="test" id="Photo" size="35" />
        </label></td>
      </tr>
      <tr>
        <td height="131" class="td">Additional Details</td>
        <td colspan="3"><label>
          <textarea name="Additional Details" cols="40" rows="6" class="test" id="Additional Details"></textarea>
          <input name="hiddenField" type="hidden" id="hiddenField" value="Date" />
        </label></td>
      </tr>
      </table>
      <p>
        <label>
          <input name="Submit" type="submit" class="test" id="Submit" value="Post" />
        </label>
      </p>
    </form>
    Server Behavior
    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"] == "individual")) {
      $insertSQL = sprintf("INSERT INTO donations (posting_title, `size`, condition, length, color, city, `state`, email, photo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['posting_title'], "text"),
                           GetSQLValueString($_POST['size'], "text"),
                           GetSQLValueString($_POST['condition'], "text"),
                           GetSQLValueString($_POST['length'], "text"),
                           GetSQLValueString($_POST['color'], "text"),
                           GetSQLValueString($_POST['city'], "text"),
                           GetSQLValueString($_POST['state'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['Photo'], "text"));
      mysql_select_db($database_bridesmaidsrack_db, $bridesmaidsrack_db);
      $Result1 = mysql_query($insertSQL, $bridesmaidsrack_db) or die(mysql_error());
      $insertGoTo = "donations.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));

  • (PHP/MySql) Create Recordset but no column

    Thanks for reading this, I am new to PHP/MySql
    I have created a website www.ritchiecraft.co.uk which uses
    PHP/MySql with Dreamweaver 8. I have created recordsets on most
    items pages and filtered data as neccessary. After the site was up
    and running I was required to insert a new topic and when I went to
    create a new page and insert the recordset no data was placed in
    the columns area and the filter/sort options were greyed out. I
    checked the existing pages and found that this was happening to all
    pages with recordsets. The connection, table data was there.
    The site still works fine but I cannot introduce new pages or
    edit existing because of the recordset problem. I was advised
    previously to delete the Dreamweaver cache file but this did not
    help.
    The site is hosted commercially and the database was created
    with phpMyAdmin and dont seem to have any connection problems.
    Thanks for your time and any suggestions are welcome.

    sweetman wrote:
    > How can I set a query so that it sounds like this:
    >
    > SELECT $_GET['id'] FROM mytable ORDER BY myorder ASC?
    You can't do it through the Recordset dialog box. The simple
    way to do
    it is to create this query in the Recordset dialog box:
    SELECT * FROM myTable
    ORDER BY myOrder ASC
    Then go into Code view and locate the following line:
    $query_recordsetName = "SELECT * FROM myTable ORDER BY
    myOrder ASC";
    Change it to this:
    if (isset($_GET['id'])) {
    $col = get_magic_quotes_gpc() ? stripslashes($_GET['id']) :
    $_GET['id'];
    $col = mysql_real_escape_string($_GET['id']);
    else {
    $col = '*';
    $query_recordsetName = "SELECT $col FROM myTable ORDER BY
    myOrder ASC";
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • PHP/MySQL field recognize carriage returns?

    I'm a novice PHP/MySQL database driven site builder. I need
    to have users enter text into a field with carriage returns and
    have the database recognize and store those carriage returns so it
    displays when the data is displayed on a PHP page.
    How do I do this and please keep it simple?
    Do I need to use a particular type of MySQL datafield?
    Will I be able to use the same code on an "update"
    page?

    quote:
    Originally posted by:
    geschenk
    >>
    so it displays when the data is displayed on a PHP page
    >>
    if you just need to replace the \n - type line breaks
    generated by multiline textareas with <br /> on a page, just
    use PHP´s native "nl2br"
    (new line to break) function:
    <?php echo nl2br($row_queryname['field_name']); ?>
    That works... sort of...
    When I use the update page to modify the entry it puts the
    proper "br" code in it's proper place. However when I return to
    that page to edit the text again (as my customer likely will), it
    displays the "br" code in the text field, and if I submit the
    update with the "br" code in place, it duplicates the "br" code
    again, so I get double "br" statements. How do I get the update
    field to read the "br" code back as carriage returns?
    In addition, my insert page uses the following code to write
    the original entry, and I'm not sure where to place the "nl2br"
    statement in the following query (generated by WebAsssist DW
    extensions):
    <?php
    // WA Application Builder Insert
    if (isset($_POST["Insert_x"])) // Trigger
    $WA_connection = $nm_connect;
    $WA_table = "tb_news";
    $WA_sessionName = "WADA_Insert_tb_news";
    $WA_redirectURL = "tb_news_Results.php";
    $WA_keepQueryString = false;
    $WA_indexField = "id";
    $WA_fieldNamesStr =
    "sort|s_head|s_text|head|subhead|bodytext|photoid|photocaption|name|phone|email|linktitle |linkaddress|show_pfm|show_arch|show_cab";
    $WA_fieldValuesStr =
    "".((isset($_POST["sort"]))?$_POST["sort"]:"") ."" . "|" .
    "".((isset($_POST["s_head"]))?$_POST["s_head"]:"") ."" . "|" .
    "".((isset($_POST["s_text"]))?$_POST["s_text"]:"") ."" . "|" .
    "".((isset($_POST["head"]))?$_POST["head"]:"") ."" . "|" .
    "".((isset($_POST["subhead"]))?$_POST["subhead"]:"") ."" . "|" .
    "".((isset($_POST["bodytext"]))?$_POST["bodytext"]:"") ."" . "|" .
    "".((isset($_POST["photoid"]))?$_POST["photoid"]:"") ."" . "|" .
    "".((isset($_POST["photocaption"]))?$_POST["photocaption"]:"") .""
    . "|" . "".((isset($_POST["name"]))?$_POST["name"]:"") ."" . "|" .
    "".((isset($_POST["phone"]))?$_POST["phone"]:"") ."" . "|" .
    "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" .
    "".((isset($_POST["linktitle"]))?$_POST["linktitle"]:"") ."" . "|"
    . "".((isset($_POST["linkaddress"]))?$_POST["linkaddress"]:"") .""
    . "|" . "".((isset($_POST["show_pfm"]))?$_POST["show_pfm"]:"") .""
    . "|" . "".((isset($_POST["show_arch"]))?$_POST["show_arch"]:"")
    ."" . "|" . "".((isset($_POST["show_cab"]))?$_POST["show_cab"]:"")
    $WA_columnTypesStr =
    "none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',n one,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|none,none,NUL L";
    $WA_fieldNames = explode("|", $WA_fieldNamesStr);
    $WA_fieldValues = explode("|", $WA_fieldValuesStr);
    $WA_columns = explode("|", $WA_columnTypesStr);
    $WA_connectionDB = $database_nm_connect;
    mysql_select_db($WA_connectionDB, $WA_connection);
    if (!session_id()) session_start();
    $insertParamsObj =
    WA_AB_generateInsertParams($WA_fieldNames, $WA_columns,
    $WA_fieldValues, -1);
    $WA_Sql = "INSERT INTO " . $WA_table . " (" .
    $insertParamsObj->WA_tableValues . ") VALUES (" .
    $insertParamsObj->WA_dbValues . ")";
    $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or
    die(mysql_error());
    $_SESSION[$WA_sessionName] = mysql_insert_id();
    if ($WA_redirectURL != "") {
    if ($WA_keepQueryString && $WA_redirectURL != ""
    && isset($_SERVER["QUERY_STRING"]) &&
    $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
    $WA_redirectURL .= ((strpos($WA_redirectURL, '?') ===
    false)?"?":"&").$_SERVER["QUERY_STRING"];
    header("Location: ".$WA_redirectURL);
    ?>

  • Problems with recordset in PHP/MySQL setting

    We use Dreamweaver CS5 for creating dynamic pages (PHP pages with MySQL database). We test the site locally on a Windows 7 operating system with EasyPHP as WAMP server.
    We often have a problem in managing the record set.
    The following problem occurs quite often:
    We take a PHP page. We create a recordset. We use a dynamic table or a repeated region to show the results of the recordset. So far so good.
    Then we want to change something to the recordset for example the filter. When editing the recordset, the advanced mode is shown, it is impossible to swith to the simple mode.
    By deleting the recordset the problem is not solved. By deleting and afterwards rebuilding the recordset, syntax errors occur. It seems that the php code for building the recordset didn't dissapear.
    The only solutions till now seems to completely restart with a new PHP page.
    Anyone has a solution for this or anyone did experience the same problem ?
    Thank you very much in advance.
    Ilse 

    You cannot switch to Simple mode in the Recordset dialog box if you have made any changes to the SQL in Advanced mode.
    Opening the Recordset dialog box to edit the settings does occasionally result in the code being inserted again instead of being changed. This appears to be an intermittent bug, which I have experienced myself, and know that others have complained about it, too. As far as I know, there is no solution other than to watch carefully the code that Dreamweaver generates.
    If you don't understand the code, you would be well advised to learn what it means and does. Relying on Dreamweaver to do everything for you severely limits what you can do with PHP/MySQL. Adobe regards the server behaviors as quick prototyping tools, rather than for developing production websites.

  • [php+mysql] best way to integrate a tree category menu base on db?

    Hi all,
    I have a products catalog where all products are organized in
    categories.
    The category structure is something similar to this:
    category 1
    subcategory 1.1
    sub-subcategory 1.1.1
    sub-subcategory 1.1.2
    sub-subcategory 1.1.3
    sub-subcategory 1.1.4
    sub-subcategory 1.1.5
    subcategory 1.2
    subcategory 1.3
    category 2
    subcategory 2.1
    subcategory 2.2
    sub-subcategory 2.2.1
    sub-subcategory 2.2.2
    sub-subcategory 2.2.3
    sub-subcategory 2.2.4
    subcategory 2.3
    ...and so on...
    In general, I have 3 category levels.
    I manage these catagories with only one table using self
    foreign keys.
    Now I need to add a tree menu that will reflect the above
    category
    structure.
    I use php + mysql to store the tables (products and
    categories.
    I found several javascript samples that allow you to do
    something similar
    but with static data.
    I'm searching for a tree menu that is easily customizable and
    that can use
    dynamic data from mysql db.
    Is there a tutorial or smple that would do the trick?
    TIA very much!
    tony ;).

    The page I'm trying to create is here www.hollisterairshow.com/plan-results.php and the questionnaire is here www.hollisterairshow.com/helpusplan.php .
    I went ahead and created recordsets using advanced recordsets and these seem to be working, here's a sample SQL
    SELECT *
    FROM plan
    WHERE Saturday = 'Saturday' AND plan.howArriving = 'Auto'
    I created a recordset for each combination of day and transportation mode - six in all
    This selected the correct records.
    To display the count of how many records selected I then used in DW Insert/Data Objects/ Display Record Count/Total Records which generated the following code:
    <?php echo $totalRows_rsSatAuto ?>
    This worked OK - not elegant but OK and I repeated it for each combination of Day and Transportation mode!!
    So there are two problems I'm having:
    I know I can select the records I want but how do I display the sum of the column containing "How many in your party" - i.e. in the PHP code generated above what do I replace $totalRows_rsSatAuto with?
    There are two questions using radio buttons where I'd like to display the count and % for each option selected. I can select all records for these questions but what code do I put to sum the number of selections for each option and what code do I put to calculate the percentage
    I understand the arithmetic involved which is pretty simple but it's the mechanics of coding that has me stumped. It would really help if you could give me a sample for say the "Are you camping overnight" question which has a "Yes/No" option only. In my mundane way I would create two recordsets, one for "Yes" and one for "No", and use the same technique I describe above for counting Total Records in each recordset, but then I'm stuck with how do I calculate and display the percentages. I must be missing something very obvious as I'm sure there just has to be a more elegant solution.
    Thanks so much for your continued interest.
    Tony

  • Updating to 10.4.11 killed my PHP/MYSQL connections

    Hi all - I use Dreamweaver CS3 for web development, and have been using some very simple PHP/MYSQL Select and Inserts. Everything was working fabulously up until this morning, when I updated to 10.4.11 (Macbook Pro, CoreDuo). As soon as I updated, I get a 'No Database Selected' message in Safari, Firefox and IE. I can see the database and work with it in DWeaver, just can't get it to go live in browsers.
    I'm running PHP 5.2.4, MYSQL 5.1.8 and whatever version of Apache is bundled in OS X (I think it's 1.x - but can't find how to get that number!)
    Just for record, I have stopped/restarted Personal Web Sharing, Personal File Sharing, OS X, MYSQL to just check whether something wasn't working there.
    I'm about to close out, zap the PRAM and then come back in.
    Any ideas?
    Vince

    Thanks - A couple of additional points. This is OS X 10.4.11, not OS X Server, so I had installed MYSQL and PHP as fresh installations. MYSQL has not changed since I installed and is running fine through direct client (Navicat).
    For PHP I was running 4 and it had been running fine. When the update to OSX came through, PHP 4 didn't work - no change had been made to any configuration file that was working already. These are the httpd.conf instructions I had followed to set-up PHP 4:
    +1 Launch Terminal from /Applications/Utilities.+
    +2 Open the Apache configuration file and edit the UNIX shell prompt:+
    +sudo pico /etc/httpd/httpd.conf+
    +3 When prompted for a password, enter the Mac OS X administrator account password.+
    +4 Uncomment the following lines:+
    +LoadModule php4_module libexec/httpd/libphp4.so+
    +AddModule mod_php4.c+
    +5 Add the following lines (add these lines above: AddType application/x-tar .tgz):+
    +AddType application/x-httpd-php .php+
    +AddType application/x-httpd-php-source .phps+
    +Note: All the commands for the pico editor display on the screen and you can start any commands with the Control key. Use the arrow keys to move around. Pico is a text editor, mostly for UNIX users to use at the UNIX command line. The pico text editor resides in /usr/bin/ directory.+
    +6 Add a new index page for PHP (index.php) so that the web server will recognize it as the first page to load:+
    +<IfModule mod_dir.c>+
    +DirectoryIndex index.html index.php index.htm+
    </IfModule>
    +7 Save the httpd.conf file by pressing ^X (control & x keys). When the screen asks "Save Modified buffer?", press "Y". When prompted for "File Name to write : httpd.conf", press Return once to accept it. This will return you to the UNIX shell prompt.+
    When PHP 4 stopped working, I took the decision to upgrade to 5 and then fix the breakdown (by now, I was convinced it was an Apache change (nothing in config had changed at all). So, upgraded to PHP 5 and, to do so, had to reverse the directions above. Since then, I've tried reenabling the above, replacing with PHP5 wherever PHP4 appears, all to no avail (in fact, it just froze the Personal Web Sharing that turns Apache on/off).
    Right now, running the phpinfo check detailed above tells me the PHP 5 is successfully installed and running. The text from the test copied here:
    +System Darwin Vincet-MacBook-Pro.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386+
    +_Build Date_ Aug 31 2007 23:38:11+
    +_Configure Command_ './configure' '--prefix=/usr/local/php5' '--with-apxs' '--with-config-file-scan-dir=/usr/local/php5/php.d' '--with-iconv' '--with-openssl=/usr' '--with-zlib=/usr' '--with-gd' '--with-zlib-dir=/usr' '--with-ldap' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-snmp=/usr' '--enable-exif' '--enable-wddx' '--enable-soap' '--enable-sqlite-utf8' '--enable-ftp' '--enable-sockets' '--enable-dbx' '--enable-dbase' '--enable-mbstring' '--enable-calendar' '--enable-bcmath' '--with-bz2=/usr' '--enable-fastcgi' '--enable-cgi' '--enable-memory-limit' '--enable-zip' '--enable-pcntl' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-curl=shared,/usr/local/php5' '--with-mysql=shared,/usr/local/php5' '--with-mysqli=shared,/usr/local/php5/bin/mysql_config' '--with-pdo-mysql=shared,/usr/local/php5' '--with-libxml-dir=shared,/usr/local/php5' '--with-xsl=shared,/usr/local/php5' '--with-pdflib=shared,/usr/local/php5' '--with-imap=../imap-2004g' '--with-kerberos=/usr' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr/local/php5' '--with-png-dir=/usr/local/php5' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/php5' '--with-iodbc=shared,/usr' '--with-pgsql=shared,/usr/local/php5' '--with-pdo-pgsql=shared,/usr/local/php5' '--with-t1lib=/usr/local/php5' '--with-gettext=shared,/usr/local/php5' '--with-ming=shared,/usr/local/php5' '--with-mcrypt=shared,/usr/local/php5' '--with-mhash=shared,/usr/local/php5' '--with-mssql=shared,/usr/local/php5' '--with-fbsql=shared,/Users/liyanage/svn/entropy/universalbuild/src/FBDeveloper Libraries/Library/FrontBase' '--with-json=shared' '--enable-memcache' '--enable-openbase_module'+
    +_Server AP_I Apache+
    +_Virtual Directory Suppor_t disabled+
    +_Configuration File (php.ini) Path_ /usr/local/php5/lib+
    +_Loaded Configuration File_ /usr/local/php5/lib/php.ini+
    +_Scan this dir for additional .ini files_ /usr/local/php5/php.d+
    +_additional .ini files parsed_ /usr/local/php5/php.d/10-extension_dir.ini, /usr/local/php5/php.d/50-extension-curl.ini, /usr/local/php5/php.d/50-extension-fbsql.ini, /usr/local/php5/php.d/50-extension-gettext.ini, /usr/local/php5/php.d/50-extension-json.ini, /usr/local/php5/php.d/50-extension-mcrypt.ini, /usr/local/php5/php.d/50-extension-mhash.ini, /usr/local/php5/php.d/50-extension-ming.ini, /usr/local/php5/php.d/50-extension-mssql.ini, /usr/local/php5/php.d/50-extension-mysql.ini, /usr/local/php5/php.d/50-extension-mysqli.ini, /usr/local/php5/php.d/50-extension-odbc.ini, /usr/local/php5/php.d/50-extension-pdf.ini, /usr/local/php5/php.d/50-extension-pdo_mysql.ini, /usr/local/php5/php.d/50-extension-pdo_pgsql.ini, /usr/local/php5/php.d/50-extension-pgsql.ini, /usr/local/php5/php.d/50-extension-xsl.ini+
    +_PHP API_ 20041225+
    +P_HP Extension_ 20060613+
    +_Zend Extension_ 220060519+
    +_Debug Build_ no+
    +_Thread Safety_ disabled+
    +Zend Memory Manager enabled+
    +_IPv6 Support_ enabled+
    +_Registered PHP Streams_ zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps+
    +_Registered Stream Socket Transports_ tcp, udp, unix, udg, ssl, sslv3, sslv2, tls+
    +_Registered Stream Filters_ string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*, zlib.*+
    I don't know if any of this helps, but it's what I find. From my online troubleshooting and reading, I believe all of the above looks right and that things should work. So, I'm still left with an informed gut decision that something in the set-up of Apache changed (location in file structure, configuration file, etc.) Could it be looking at a second copy of httpd.conf somewhere else? That would seem to make sense - however I haven't managed to turn up how to assess which version of Apache is loaded (I think 1.3) or where it's located.
    If anyone can confirm what PHP5 code should be included in httpd.conf given the above, that would be a great next step.
    Thanks for all your assistance!
    Vince

Maybe you are looking for

  • Are my plugins living inside my FCP project?

    Okay, this is strange.  I've never encountered this before. I was using a PowerPC G5 (running Tiger, I think) to cut a project in FCP 6, and I was using tons of those old Eureka Plugins (silk, film look, etc.). Long story short, because my computer w

  • Recording of Bank Guarantees

    Hi, I am using the transaction code F-38, special G/L "G" to post the bank guarantees. These Guarantees  will be given due period and on the due date the guarantee will be expired. Therefore on the expiry date i need to change the " due date" and use

  • Use system-wide Text replacement to superscript characters? 1st, 2nd, etc

    I wanted to use the new text substitution in Snow Leopard to transform typed "1st" and "2nd's" into their 'correct' form with superscripted numerical suffixes. I tried to just easy do it by copying a corrected form out of Pages where I had created a

  • Selecting specified selection from combobox

    Hi guys i have a combobox to which i have binded names from db like:- combobox values     test1                               test2                               test3 now my question is how to make combo box to select a particular string with out ma

  • "The Directory Service is Busy." Error Message When Trying to Rename PCs on AD 2012 R2 Domain

    As the title says, I'm trying to rename some existing PCs on a Windows 2012 R2 Active Directory domain, but I keep getting the error: The Directory Service is Busy. The command I am using is: netdom renamecomputer <OLD_NAME> /newname:<NEW_NAME> /ud:D