randydg Posted October 27, 2009 Share Posted October 27, 2009 About: This code pulls up customer information that was saved via another script. It should pull the data for a customer on a date or by #. but needs to somehow be changed where it doesnt overright the old info. This code keeps pulling up old information that was saved from before instead of the one that was recently saved. should pull it up by the $worksheetnum unless its trying to use the same $worksheetnum for both. <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style4 {font-size: 12px} --> </style> </head> <!-- startprint --> <body> <?php $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); if (isset($_POST['submitnew'])) { $status = trim(stripslashes($_POST['status'])); $priority = trim(stripslashes($_POST['priority'])); $inshop = trim(stripslashes($_POST['inshop'])); $inprogress = trim(stripslashes($_POST['inprogress'])); $pending = trim(stripslashes($_POST['pending'])); $tobepickedup = trim(stripslashes($_POST['tobepickedup'])); $completed = trim(stripslashes($_POST['completed'])); $checkbox = trim(stripslashes($_POST['checkbox'])); $inshopa = trim(stripslashes($_POST['inshopa'])); $name = trim(stripslashes($_POST['name'])); $date = trim(stripslashes($_POST['date'])); $caller = trim(stripslashes($_POST['caller'])); $phone = trim(stripslashes($_POST['phone'])); $alt = trim(stripslashes($_POST['alt'])); $address = trim(stripslashes($_POST['address'])); $equipment = trim(stripslashes($_POST['equipment'])); $warranty = trim(stripslashes($_POST['warranty'])); $billable = trim(stripslashes($_POST['billable'])); $onsite = trim(stripslashes($_POST['onsite'])); $called = trim(stripslashes($_POST['called'])); $city = trim(stripslashes($_POST['city'])); $zip = trim(stripslashes($_POST['zip'])); $state = trim(stripslashes($_POST['state'])); $workproblem = mysql_real_escape_string ($_POST['workproblem']); $workperformed = mysql_real_escape_string ($_POST['workperformed']); // $workproblem = trim(stripslashes($_POST['workproblem'])); // $workperformed = trim(stripslashes($_POST['workperformed'])); $serial = trim(stripslashes($_POST['serial'])); $dateworked1 = trim(stripslashes($_POST['dateworked1'])); $timein1 = trim(stripslashes($_POST['timein1'])); $timeout1 = trim(stripslashes($_POST['timeout1'])); $techworked1 = trim(stripslashes($_POST['techworked1'])); $comments = trim(stripslashes($_POST['comments'])); $dateworked2 = trim(stripslashes($_POST['dateworked2'])); $timein2 = trim(stripslashes($_POST['timein2'])); $timeout2 = trim(stripslashes($_POST['timeout2'])); $techworked2 = trim(stripslashes($_POST['techworked2'])); $dateworked3 = trim(stripslashes($_POST['dateworked3'])); $timein3 = trim(stripslashes($_POST['timein3'])); $timeout3 = trim(stripslashes($_POST['timeout3'])); $techworked3 = trim(stripslashes($_POST['techworked3'])); $quanity1 = trim(stripslashes($_POST['quanity1'])); $description1 = trim(stripslashes($_POST['description1'])); $unitprice1 = trim(stripslashes($_POST['unitprice1'])); $quanity2 = trim(stripslashes($_POST['quanity2'])); $description2 = trim(stripslashes($_POST['description2'])); $unitprice2 = trim(stripslashes($_POST['unitprice2'])); $quanity3 = trim(stripslashes($_POST['quanity3'])); $description3 = trim(stripslashes($_POST['description3'])); $unitprice3 = trim(stripslashes($_POST['unitprice3'])); $quanity4 = trim(stripslashes($_POST['quanity4'])); $description4 = trim(stripslashes($_POST['description4'])); $unitprice4 = trim(stripslashes($_POST['unitprice4'])); $quanity5 = trim(stripslashes($_POST['quanity5'])); $description5 = trim(stripslashes($_POST['description5'])); $unitprice5 = trim(stripslashes($_POST['unitprice5'])); $quanity6 = trim(stripslashes($_POST['quanity6'])); $description6 = trim(stripslashes($_POST['description6'])); $unitprice6 = trim(stripslashes($_POST['unitprice6'])); $extendedprice1 = trim(stripslashes($_POST['$extendedprice1'])); $extendedprice2 = trim(stripslashes($_POST['$extendedprice2'])); $extendedprice3 = trim(stripslashes($_POST['$extendedprice3'])); $extendedprice4 = trim(stripslashes($_POST['$extendedprice4'])); $subtotal = trim(stripslashes($_POST['$subtotal'])); $tax = trim(stripslashes($_POST['$tax'])); $totalprice = trim(stripslashes($_POST['$totalprice'])); //Customer Table Vari $name = trim(stripslashes($_POST['name'])); $phone = trim(stripslashes($_POST['phone'])); $alt = trim(stripslashes($_POST['alt'])); $address = trim(stripslashes($_POST['address'])); $city = trim(stripslashes($_POST['city'])); $state = trim(stripslashes($_POST['state'])); $zip = trim(stripslashes($_POST['zip'])); $time = date ( 'H:i:s' ); $worksheetnum = trim(stripslashes($_POST['worksheetnum'])); $customerid = trim(stripslashes($_POST['customerid'])); $id = $_POST['wo']; //$status = 1; //Customer Update $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $sql = "UPDATE `customers` SET `name` = '$name', `phone` = '$phone', `alt` = '$alt', `address` = '$address', `city` = '$city', `state` = '$state', `zip` = '$zip' WHERE `id` = '$customerid' LIMIT 1"; $result = mysql_query($sql); if (!$result) { die('Invalid query: '.mysql_error()); } //Worksheet Update $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $sql = "UPDATE `worksheets` SET `date` = '$date', `time` = '$time', `caller` = '$caller', `equipment` = '$equipment', `warranty` = '$warranty', `billable` = '$billable',`inshopa` = '$inshopa',`onsite` = '$onsite', `called` = '$called',`workproblem` = '$workproblem',`workperformed` = '$workperformed',`serial` = '$serial',`comments` = '$comments', `dateworked1` = '$dateworked1',`dateworked2` = '$dateworked2',`dateworked3` = '$dateworked3',`timein1`= '$timein1',`timein2` = '$timein2',`timein3` = '$timein3',`timeout1` = '$timeout1',`timeout2` = '$timeout2',`timeout3` = '$timeout3',`techworked1` = '$techworked1',`techworked2` = '$techworked2',`techworked3` = '$techworked3',`quanity1` = '$quanity1',`quanity2` = '$quanity2',`quanity3` = '$quanity3',`quanity4` = '$quanity4',`quanity5` = '$quanity5',`quanity6` = '$quanity6',`description1` = '$description1',`description2` = '$description2',`description3` = '$description3',`description4` = '$description4',`description5` = '$description5',`description6` = '$description6',`unitprice1` = '$unitprice1',`unitprice2` = '$unitprice2',`unitprice3` = '$unitprice3',`unitprice4` = '$unitprice4',`unitprice5` = '$unitprice5',`unitprice6` = '$unitpric6',`extendedprice1` = '$extendedprice1',`extendedprice2` = '$extendedprice12',`extendedprice3` = '$extendedprice3',`extendedprice4` = '$extendedprice4',`subtotal` = '$subtotal',`tax` = '$tax',`totalprice` = '$totalprice' WHERE `id` = '$worksheetnum' LIMIT 1"; $result = mysql_query($sql); if (!$result) { die('Invalid query: '.mysql_error()); } //Call Entry $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $sql2 = "UPDATE `calls` SET `inshop` = '$inshop', `inprogress` = '$inprogress', `pending` = '$pending', `tobepickedup` = '$tobepickedup', `completed` = '$completed', `priority` = '$priority' WHERE `id` = '$id' LIMIT 1"; $result2 = mysql_query($sql2); if (!$result2) { die('Invalid query: '.mysql_error()); } $completeddate = date ( 'Y-m-d' ); //Check call Status $callstatus = 1 ; if ($completed != "-") { $callstatus = 5; } elseif ($tobepickedup != "-") { $callstatus = 4 ; //$date = $completeddate ; } elseif ($pending != "-") { $callstatus = 3; } elseif ($inprogress != "-") { $callstatus = 2; } else { } $sql = "UPDATE `calls` SET `status` = $callstatus WHERE `id` = $id LIMIT 1"; $result = mysql_query($sql); if (!$result) { die('Invalid query: '.mysql_error()); } } ?> <?php $id = $_POST['wo']; //Get Worksheet ID data from database $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT * FROM `calls` WHERE `id` = $id"; $result=mysql_query($query); $num=mysql_numrows($result); $n=0; while ($n < $num) { $customerid=mysql_result($result,$i,"customer"); $worksheetnum=mysql_result($result,$i,"worksheet"); $techid=mysql_result($result,$i,"inshop"); $n++; }; //Get Customer Data from datebase from $customerid $query="SELECT * FROM `customers` WHERE `id` = $customerid"; $result=mysql_query($query); $num=mysql_numrows($result); $n=0; while ($n < $num) { $name=mysql_result($result,$i,"name"); $phone=mysql_result($result,$i,"phone"); $alt=mysql_result($result,$i,"alt"); $address=mysql_result($result,$i,"address"); $city=mysql_result($result,$i,"city"); $state=mysql_result($result,$i,"state"); $zip=mysql_result($result,$i,"zip"); $n++; }; //Get Worksheet Data from database for $worksheetnum $query="SELECT * FROM `worksheets` WHERE `id` = $worksheetnum"; $result=mysql_query($query); $num=mysql_numrows($result); $n=0; while ($n < $num) { $date=mysql_result($result,$i,"date"); $time=mysql_result($result,$i,"time"); $caller=mysql_result($result,$i,"caller"); $equipment=mysql_result($result,$i,"equipment"); $warranty=mysql_result($result,$i,"warranty"); $billable=mysql_result($result,$i,"billable"); $inshopa=mysql_result($result,$i,"inshopa"); $onsite=mysql_result($result,$i,"onsite"); $called=mysql_result($result,$i,"called"); $workproblem=mysql_result($result,$i,"workproblem"); $workperformed=mysql_result($result,$i,"workperformed"); $serial=mysql_result($result,$i,"serial"); $comments=mysql_result($result,$i,"comments"); $dateworked1=mysql_result($result,$i,"dateworked1"); $dateworked2=mysql_result($result,$i,"dateworked2"); $dateworked3=mysql_result($result,$i,"dateworked3"); $timein1=mysql_result($result,$i,"timein1"); $timein2=mysql_result($result,$i,"timein2"); $timein3=mysql_result($result,$i,"timein3"); $timeout1=mysql_result($result,$i,"timeout1"); $timeout2=mysql_result($result,$i,"timeout2"); $timeout3=mysql_result($result,$i,"timeout3"); $techworked1=mysql_result($result,$i,"techworked1"); $techworked2=mysql_result($result,$i,"techworked2"); $techworked3=mysql_result($result,$i,"techworked3"); $quanity1=mysql_result($result,$i,"quanity1"); $quanity2=mysql_result($result,$i,"quanity2"); $quanity3=mysql_result($result,$i,"quanity3"); $quanity4=mysql_result($result,$i,"quanity4"); $quanity5=mysql_result($result,$i,"quanity5"); $quanity6=mysql_result($result,$i,"quanity6"); $description1=mysql_result($result,$i,"description1"); $description2=mysql_result($result,$i,"description2"); $description3 =mysql_result($result,$i,"description3"); $description4=mysql_result($result,$i,"description4"); $description5=mysql_result($result,$i,"description5"); $description6=mysql_result($result,$i,"description6"); $unitprice1=mysql_result($result,$i,"unitprice1"); $unitprice2=mysql_result($result,$i,"unitprice2"); $unitprice3=mysql_result($result,$i,"unitprice3"); $unitprice4=mysql_result($result,$i,"unitprice4"); $unitprice5=mysql_result($result,$i,"unitprice5"); $unitprice6=mysql_result($result,$i,"unitprice6"); $extendedprice1=mysql_result($result,$i,"extendedprice1"); $extendedprice2=mysql_result($result,$i,"extendedprice2"); $extendedprice3=mysql_result($result,$i,"extendedprice3"); $extendedprice4=mysql_result($result,$i,"extendedprice4"); $extendedprice5=mysql_result($result,$i,"extendedprice5"); $extendedprice6=mysql_result($result,$i,"extendedprice6"); $subtotal=mysql_result($result,$i,"subtotal"); $tax=mysql_result($result,$i,"tax"); $totalprice=mysql_result($result,$i,"totalprice"); $n++; }; ?> <form name="new" method="POST" action="<?=$PHP_SELF;?>"> <table width="780" border="0"> <tr> <td width="20%"> <?php //Get Tech List out of database $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `id`,`name` FROM `techs`"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<span class=\"style4\">In Shop</span><select name=\"inshop\" id=\"inshop\">"; $i=0; while ($i < $num) { $techname=mysql_result($result,$i,"name"); $techid=mysql_result($result,$i,"id"); echo "<option value=$techid>$techname</option>"; $i++; }; echo "<option value=\"NA\">Other</option>"; echo "<option value=\"-\">-</option>"; // get Current Tech value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `inshop` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $inshop=mysql_result($result,$i,"inshop"); $i++; }; // get Current Name from Tech number $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `name` FROM `techs` WHERE `id` = '$inshop'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $inshopname=mysql_result($result,$i,"name"); $i++; }; //Display Current User id and Name. echo "<option value=$inshop selected>$inshopname</option> </select>"; ?> </td> <td width="20%"> <?php $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `id`,`name` FROM `techs`"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<span class=\"style4\">In Progress</span><select name=\"inprogress\" id=\"inprogress\">"; $i=0; while ($i < $num) { $techname=mysql_result($result,$i,"name"); $techid=mysql_result($result,$i,"id"); echo "<option value=$techid>$techname</option>"; $i++; }; echo "<option value=\"NA\">Other</option>"; echo "<option value=\"-\">-</option>"; // get Current Tech value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `inprogress` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $inprogress=mysql_result($result,$i,"inprogress"); $i++; }; // get Current Name from Tech number $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `name` FROM `techs` WHERE `id` = '$inprogress'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $inprogressname=mysql_result($result,$i,"name"); $i++; }; //Display Current User id and Name. echo "<option value=$inprogress selected>$inprogressname</option> </select>"; ?> </td> <td width="20%"> <?php $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `id`,`name` FROM `techs`"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<span class=\"style4\">Pending:</span><select name=\"pending\" id=\"pending\">"; $i=0; while ($i < $num) { $techname=mysql_result($result,$i,"name"); $techid=mysql_result($result,$i,"id"); echo "<option value=$techid>$techname</option>"; $i++; }; echo "<option value=\"NA\">Other</option>"; echo "<option value=\"-\">-</option>"; // get Current Tech value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `pending` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $pending=mysql_result($result,$i,"pending"); $i++; }; // get Current Name from Tech number $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `name` FROM `techs` WHERE `id` = '$pending'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $pendingname=mysql_result($result,$i,"name"); $i++; }; //Display Current User id and Name. echo "<option value=$pending selected>$pendingname</option> </select>"; ?> </td> <td width="20%"> <?php $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `id`,`name` FROM `techs`"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<span class=\"style4\">To Be pickedup:</span><select name=\"tobepickedup\" id=\"tobepickedup\">"; $i=0; while ($i < $num) { $techname=mysql_result($result,$i,"name"); $techid=mysql_result($result,$i,"id"); echo "<option value=$techid>$techname</option>"; $i++; }; echo "<option value=\"NA\">Other</option>"; echo "<option value=\"-\">-</option>"; // get Current Tech value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `tobepickedup` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $tobepickedup=mysql_result($result,$i,"tobepickedup"); $i++; }; // get Current Name from Tech number $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `name` FROM `techs` WHERE `id` = '$tobepickedup'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $tobepickedupname=mysql_result($result,$i,"name"); $i++; }; //Display Current User id and Name. echo "<option value=$tobepickedup selected>$tobepickedupname</option> </select>"; ?> </td> <td width="20%"> <?php $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `id`,`name` FROM `techs`"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<span class=\"style4\">Completed:</span><select name=\"completed\" id=\"completed\">"; $i=0; while ($i < $num) { $techname=mysql_result($result,$i,"name"); $techid=mysql_result($result,$i,"id"); echo "<option value=$techid>$techname</option>"; $i++; }; echo "<option value=\"NA\">Other</option>"; echo "<option value=\"-\">-</option>"; // get Current Tech value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `completed` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $completed=mysql_result($result,$i,"completed"); $i++; }; // get Current Name from Tech number $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `name` FROM `techs` WHERE `id` = '$completed'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $completedname=mysql_result($result,$i,"name"); $i++; }; //Display Current User id and Name. echo "<option value=$completed selected>$completedname</option> </select>"; ?> </td> <td width="69"><span class="style4">Priority:</span> <!-- <input name="priority" type="checkbox" id="priority" value="1"> --> <?php // get Current pri value $db = mysql_connect("x","x","x") or die("Couldn't connect"); mysql_select_db("x",$db) or die("Couldn't select database"); $query="SELECT `priority` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $priority=mysql_result($result,$i,"priority"); $i++; }; $checked = ($priority == 1) ? 'checked="checked"' : NULL; echo '<input name="priority" type="checkbox" id="priority" value="1" ' . $checked . '>'; ?> </td> </tr> </table> <table width="744" border="0"> <tr> <td width="738"><img src="image001.JPG" width="661" height="182"> </td> </tr> </table> <table width="723" border="1"> <tr> <td width="33%" rowspan="2" valign="top"> <table width="239"> <tr class="style4"> <td colspan="2"> Name/Company <input name="name" <?php if(empty($name)){ } else echo "value='$name'"; ?> type="text" id="name" size="24"> </td> </tr> <tr class="style4"> <td width="43">Address:</td> <td width="184"> <input name="address" <?php if(empty($address)){ } else echo "value='$address'"; ?> type="text" id="address" size="30"> </td> </tr> <tr class="style4"> <td>City:</td> <td> <input name="city" <?php if(empty($city)){ } else echo "value=$city"; ?> type="text" id="city" size="12"> Zip <input name="zip" <?php echo "value=$zip"; ?> type="text" id="zip" size="5"> State <input name="state" <?php echo "value=$state"; ?> type="text" id="state" size="2"> </td> </tr> </table> </td> <td width="11%" class="style4">Date: <?php echo "<input name=\"date\" type=\"text\" id=\"date\" size=\"8\" value=$date>"; ?></td> <td width="41%" class="style4"> <div align="center">Phone: <input name="phone" <?php if(empty($phone)){ } else echo "value='$phone'"; ?> type="text" id="phone" size="12"> Alt: <input name="alt" <?php if(empty($alt)){ } else echo "value='$alt'"; ?> type="text" id="alt" size="12"> </div></td> <td width="15%" rowspan="2" class="style4"> <div align="left"> <table width="69%" border="0"> <tr class="style4"> <td width="57">Warranty</td> <td width="28"><input name="warranty" <?php if ( $warranty == 1 ) { echo "checked "; } else ?> type="checkbox" id="warranty" value="1"></td> </tr> <tr class="style4"> <td>Billable</td> <td><input name="billable" type="checkbox" id="billable" value="1" <?php if ( $billable == 1 ) { echo "checked"; } else ?> ></td> </tr> <tr class="style4"> <td>In Shop </td> <td> <input name="inshopa" <?php if ( $inshopa == 1 ) { echo "checked"; } else ?> type="checkbox" id="inshopa" value="1"></td> </tr> <tr class="style4"> <td>On Site </td> <td><input name="onsite" <?php if ( $onsite == 1 ) { echo "checked"; } else ?> type="checkbox" id="onsite" value="1"></td> </tr> <tr class="style4"> <td>Called</td> <td><input name="called" <?php if ( $called == 1 ) { echo "checked"; } else ?> type="checkbox" id="called" value="1"> </td> </tr> </table> </div></td> </tr> <tr> <td colspan="2" valign="top"><div align="center"> <p class="style4">Equipment to Service: </p> <p> <input name="equipment" <?php if(empty($equipment)){ } else echo "value='$equipment'"; ?> type="text" id="equipment" size="40"> </p> </div></td> </tr> <tr class="style4"> <td colspan="4" w><strong>Work Problem:</strong><br> <?php print "<textarea name= \"workproblem\" cols=\"90\" rows=\"5\" id=\"workproblem\">"; print $workproblem; print "</textarea>"; ?> </td> </tr> <tr class="style4"> <td colspan="4"><strong>Work Performed:</strong><br> <?php print "<textarea name= \"workperformed\" cols=\"90\" rows=\"5\" id=\"workperformed\">"; print $workperformed; print "</textarea>"; ?> </td> </tr> <tr> <td colspan="4"><table width="716" border="0"> <tr class="style4"> <td width="70" height="26">Date</td> <td width="48">In</td> <td width="48">Out</td> <td width="34">Tech</td> <td width="494"><div align="left">Serial/Cd-Key: <input name="serial" <?php if(empty($serial)){ } else echo "value='$serial'"; ?> type="text" id="serial" size="60"> </div></td> </tr> <tr class="style4"> <td> <input name="dateworked1" <?php if(empty($dateworked1)){ } else echo "value=$dateworked1"; ?> type="text" id="dateworked1" size="10"></td> <td> <input name="timein1" <?php if(empty($timein1)){ } else echo "value=$timein1"; ?> type="text" id="dateworked1" size="7"></td> <td> <input name="timein1" <?php if(empty($timeout1)){ } else echo "value=$timeout1"; ?> type="text" id="timeout1" size="7"></td> <td><div align="center"> <input name="timein1" <?php if(empty($techworked1)){ } else echo "value=$techworked1"; ?> type="text" id="techworked1" size="2"> </div></td> <td rowspan="3" align="left" valign="top"><div align="center">Comments:<br> <?php print "<textarea name= \"comments\" cols=\"55\" rows=\"5\" id=\"comments\">"; print $comments; print "</textarea>"; ?> </div></td> </tr> <tr class="style4"> <td><input name="dateworked2" type="text" id="dateworked2" size="10"></td> <td><input name="timein2" type="text" id="timein2" size="7"></td> <td><input name="timeout2" type="text" id="timeout2" size="7"></td> <td><div align="center"> <input name="techworked2" type="text" id="techworked2" size="2"> </div></td> </tr> <tr class="style4"> <td><input name="dateworked3" type="text" id="dateworked3" size="10"></td> <td><input name="timein3" type="text" id="timein3" size="7"></td> <td><input name="timeout3" type="text" id="timeout3" size="7"></td> <td><div align="center"> <input name="techworked3" type="text" id="techworked3" size="2"> </div></td> </tr> </table></td> </tr> <tr> <td colspan="4"><table width="731" border="0"> <tr class="style4"> <td width="40">Quanity</td> <td width="525">Description</td> <td width="72">Unit Price </td> <td width="76">Extended Price </td> </tr> <tr class="style4"> <td> <input name="quanity1" <?php if(empty($quanity1)){ } else echo "value=$quanity1"; ?> type="text" id="quanity1" size="2"> </td> <td> <input name="description1" <?php if(empty($description1)){ } else echo "value='$description1'"; ?> type="text" id="description1" size="80"> </td> <td> <input name="unitprice1" <?php if(empty($unitprice1)){ } else echo "value=$unitprice1"; ?> type="text" id="unitprice1" size="12"> </td> <td> <input name="extendedprice1" <?php $extendedprice1 = $quanity1 * $unitprice1; if(empty($extendedprice1)){ } else echo "value=$extendedprice1"; ?> type="text" id="extendedprice1" size="12"> </td> </tr> <tr class="style4"> <td> <input name="quanity2" <?php if(empty($quanity2)){ } else echo "value=$quanity2"; ?> type="text" id="quanity2" size="2"> </td> <td> <input name="description2" <?php if(empty($description2)){ } else echo "value='$description2'"; ?> type="text" id="description2" size="80"> </td> <td> <input name="unitprice2" <?php if(empty($unitprice2)){ } else echo "value=$unitprice2"; ?> type="text" id="unitprice2" size="12"> </td> <td> <input name="extendedprice2" <?php $extendedprice2 = $quanity2 * $unitprice2; if(empty($extendedprice2)){ } else echo "value=$extendedprice2"; ?> type="text" id="extendedprice2" size="12"> </td> </tr> <tr class="style4"> <td> <input name="quanity3" <?php if(empty($quanity3)){ } else echo "value=$quanity3"; ?> type="text" id="quanity3" size="2"> </td> <td> <input name="description3" <?php if(empty($description3)){ } else echo "value='$description3'"; ?> type="text" id="description3" size="80"> </td> <td> <input name="unitprice3" <?php if(empty($unitprice3)){ } else echo "value=$unitprice3"; ?> type="text" id="unitprice3" size="12"> </td> <td> <input name="extendedprice3" <?php $extendedprice3 = $quanity3 * $unitprice3; if(empty($extendedprice3)){ } else echo "value=$extendedprice3"; ?> type="text" id="extendedprice3" size="12"> </td> </tr> <tr class="style4"> <td> <input name="quanity4" <?php if(empty($quanity4)){ } else echo "value=$quanity4"; ?> type="text" id="quanity4" size="2"> </td> <td> <input name="description4" <?php if(empty($description4)){ } else echo "value='$description4'"; ?> type="text" id="description4" size="80"> </td> <td> <input name="unitprice4" <?php if(empty($unitprice4)){ } else echo "value=$unitprice4"; ?> type="text" id="unitprice4" size="12"> </td> <td> <input name="extendedprice4" <?php $extendedprice4 = $quanity4 * $unitprice4; if(empty($extendedprice4)){ } else echo "value=$extendedprice4"; ?> type="text" id="extendedprice4" size="12"> </td> </tr> <tr class="style4"> <td colspan="2" rowspan="3"><p><img src="image005.gif" width="429" height="102"></p></td> <td height="27" class="style4">Subtotal</td> <td><div align="right"> <input name="subtotal" <?php $subtotal = $extendedprice1 + $extendedprice2 + $extendedprice3 + $extendedprice4; if(empty($subtotal)){ } else echo "value=$subtotal"; ?> type="text" id="subtotal" size="10"> </div></td> </tr> <tr> <td height="30" class="style4">Tax</td> <td><div align="right"> <input name="tax" <?php $tax = $subtotal * 0.0825; $tax = round($tax, 2); if(empty($tax)){ } else echo "value=$tax"; ?> type="text" id="tax" size="10"> </div></td> </tr> <tr> <td height="49" class="style4">Total Price </td> <td><div align="right"> <input name="totalprice" <?php $totalprice = $subtotal + $tax; if(empty($totalprice)){ } else echo "value=$totalprice"; ?> type="text" id="totalprice" size="10"> </div></td> </tr> </table> </td> </tr> </table> <table width="718" border="0"> <tr> <td width="712" align="right" valign="top"> <?php print "<input type=\"hidden\" name=\"worksheetnum\" value=$worksheetnum>"; print "<input type=\"hidden\" name=\"customerid\" value=$customerid>"; print "<input type=\"hidden\" name=\"wo\" value=$id>"; ?> <input type="submit" name="submitnew" value="SUBMIT"/> <INPUT TYPE="reset"> </td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/179237-help-code-pulling-up-old-info-instead-of-new/ Share on other sites More sharing options...
randydg Posted October 29, 2009 Author Share Posted October 29, 2009 not sure if this will help but the bellow code is where the problem is. I tried changing $worksheetnum= to date time, id but when i did that it pulled up something different each time but not the correct info. the table in the database where its getting the info is called worksheets. Inside workshets is id, date, time, etc... each page has a worksheetnumber attached to it wich shold be in id. $worksheetnum=mysql_result($result,$i,"worksheet"); $query="SELECT * FROM `worksheets` WHERE `id` = $worksheetnum"; $result=mysql_query($query); $num=mysql_numrows($result); Link to comment https://forums.phpfreaks.com/topic/179237-help-code-pulling-up-old-info-instead-of-new/#findComment-947282 Share on other sites More sharing options...
lemmin Posted October 29, 2009 Share Posted October 29, 2009 I doubt this has anything to do with your problem, but you don't need to connect to your database every time you make a query since you aren't closing the connection. Link to comment https://forums.phpfreaks.com/topic/179237-help-code-pulling-up-old-info-instead-of-new/#findComment-947305 Share on other sites More sharing options...
randydg Posted October 29, 2009 Author Share Posted October 29, 2009 could that be causing it to run slow when it subits or pulls data? Link to comment https://forums.phpfreaks.com/topic/179237-help-code-pulling-up-old-info-instead-of-new/#findComment-947356 Share on other sites More sharing options...
lemmin Posted October 30, 2009 Share Posted October 30, 2009 It would be a negligible amount of time to run those calls if the database is local unless you specify a non-null new_link parameter; without one, all of those calls just return the link to the current connection. http://us.php.net/manual/en/function.mysql-connect.php Do you have a primary key set in your worksheets table? Try putting ORDER BY id at the end of your query and see if it still returns different info each time. Link to comment https://forums.phpfreaks.com/topic/179237-help-code-pulling-up-old-info-instead-of-new/#findComment-947958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.