#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    8
    Rep Power
    0
    Unexperienced programmer, needs HELP!!!
    Attempting to update to my database, no errors, but no update! What am I doing wrong?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Netherlands
    Posts
    77
    Rep Power
    15
    Can you at least show us what you are doing or trying to do?
    Please share a bit of code!

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    8
    Rep Power
    0
    Sorry, I guess a little more information is in order...
    I have emailed you personally, but for anyone else who may be of assistance here is my code so far...

    <html>
    <head>
    <title>Today at Versaterm</title>
    </head>
    <body>

    <?php
    //Test buttons for update

    if ($in) {
    //update status to in
    $result = mysql_query("Update tblToday Set todStatus = 'OUT' Where todID = '3'",
    $dbOffice);
    }

    if ($out) {
    //update status to out
    $result = mysql_query("Update tblToday Set todStatus = 'OUT' Where todID = '3'",
    $dbOffice);

    }

    if ($home) {
    //update status to home
    $result = mysql_query("Update tblToday Set todStatus = 'HOME' Where todID = '3'"
    , $dbOffice);

    }

    if ($na) {
    //update status to not avail
    $result = mysql_query("Update tblToday Set todStatus = 'NOT AVAIL' Where todID =
    '3'", $dbOffice);

    }

    if ($remarks) {
    //update remarks to contents of text box
    $result = mysql_query("Update tblToday Set todRemarks = 'remarks' Where todID =
    '3'", $dbOffice);

    }

    ?>

    <center>

    <form method="post" action="<?php echo $PHP_SELF?>">
    <input type="Submit" name="in" value="IN">
    <input type="Submit" name="out" value="OUT">
    <input type="Submit" name="home" value="HOME">
    <input type="Submit" name="na" value="NOT AVAIL">
    <br>
    <input type="text" name="remarks" value="Enter Remarks Here">
    <input type="Submit" name="remarks" value="Update Remarks">
    <br>
    <input type="button" value="MINE" onClick="document.location='March.html'" style
    ="background-color: rgb(0,255,255); color: rgb(0,0,128); text-align: center">
    <input type="button" value="GROUP" onClick="document.location='MarchGroup.html'"
    style="background-color: rgb(0,255,255); color: rgb(0,0,128); text-align: center
    ">
    <input type="button" value="CUSTOM" onClick="document.location='customprompt.htm
    l'" style="background-color: rgb(0,255,255); color: rgb(0,0,128); text-align: ce
    nter">
    <input type="button" value="ADMIN" onClick="document.location='AdminMain.html'"
    style="background-color: rgb(0,255,255); color: rgb(0,0,128); text-align: center
    ">
    </form>
    <?php

    //Connect to the database
    $dbOffice = mysql_connect("localhost", "root", "triton4");
    mysql_select_db("OfficeView", $dbOffice);
    //Get the recordset
    $result = mysql_query("Select distinctrow emp.empFName, emp.empLName, em
    p.empExt, tod.todStatus, tod.todRemarks From tblEmployee As emp, tblToday As tod
    Where emp.empID = tod.todID",$dbOffice);


    if ($record = mysql_fetch_array($result)) {
    echo "<table border=1>n";
    echo "<tr><td ALIGN="center" BGCOLOR="000000"><font STYLE="Arial"
    COLOR="FFFFFF" SIZE="2"><b>Employee Name</b></font></td><td ALIGN="center"
    BGCOLOR="000000"><font STYLE="Arial" COLOR="FFFFFF" SIZE="2"><b>Ext</b>
    </font></td><td ALIGN="center" BGCOLOR="000000"><font STYLE="Arial" COLOR=
    "FFFFFF" SIZE="2"><center><b>Status</b></center></font></td><td ALIGN="cent
    er" BGCOLOR="000000"><font STYLE="Arial" COLOR="FFFFFF" SIZE="2"><b>Rem
    arks</b></font></td></tr>n";

    do {
    printf("<tr><td BGCOLOR="F7EFDE"><font STYLE="Arial" SIZE="
    2">%s %s</font></td>n", $record["empFName"], $record["empLName"]);

    printf("<td BGCOLOR="F7EFDE"><font STYLE="Arial" SIZE="2">
    %s</font></td>n", $record["empExt"]);

    $status = $record["todStatus"];
    if ($status == 'IN'):
    printf("<td BGCOLOR="80FF80"><font STYLE="Arial" SIZE="2">
    <center>%s</center></font></td>n", $record["todStatus"]);
    elseif ($status == 'OUT'):
    printf("<td BGCOLOR="80FFFF"><font STYLE="Arial" SIZE="2">
    <center>%s</center></font></td>n", $record["todStatus"]);
    elseif ($status == 'HOME'):
    printf("<td BGCOLOR="80FFFF"><font STYLE="Arial" SIZE="2">
    <center>%s</center></font></td>n", $record["todStatus"]);
    elseif ($status == 'NOT AVAIL'):
    printf("<td BGCOLOR="FFFF80"><font STYLE="Arial" SIZE="2">
    <center>%s</center></font></td>n", $record["todStatus"]);
    endif;

    printf("<td BGCOLOR="F7EFDE"><font STYLE="Arial" SIZE="2">
    %s</font></td></tr>n", $record["todRemarks"]);

    } while ($record = mysql_fetch_array($result));
    echo "</table>n";
    } else {
    echo "Sorry, no records were found!";
    }

    ?>
    </center>
    </body>
    </html>
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 1999
    Location
    Seattle
    Posts
    133
    Rep Power
    15
    In your code at the top, you called mysql_query(), but didn't connect to the database. You need to connect to the database before you call mysql_query().

    Don
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    8
    Rep Power
    0
    Thanks for all your help...I got it working fine!
    Appreciated...Stephanie

Similar Threads

  1. Limiting factor of update/insert performance
    By bcyde in forum PostgreSQL Help
    Replies: 12
    Last Post: February 26th, 2004, 02:14 PM
  2. insert and update 2 tables
    By welly in forum PHP Development
    Replies: 14
    Last Post: February 23rd, 2004, 07:41 AM
  3. sql update inserts '0' and not var
    By SeenGee in forum PHP Development
    Replies: 2
    Last Post: February 16th, 2004, 09:18 PM
  4. update a record in PHP/MySQL
    By tintintin in forum PHP Development
    Replies: 2
    Last Post: February 2nd, 2004, 08:20 AM
  5. update table data from md array
    By MikePeterson in forum MySQL Help
    Replies: 2
    Last Post: July 18th, 2003, 02:16 AM

IMN logo majestic logo threadwatch logo seochat tools logo