muddy004
New Members-
Posts
6 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
muddy004's Achievements
Newbie (1/5)
0
Reputation
-
What do you mean "missing quotes?" Do you mean that there's something wrong in the code? If so, that's what I'm trying to figure out. thanks
-
Dear Freaks, This is an odd question. I've inherited a very old php application. I attempted to upgrade it. The application is used to add certain columns of data. On the original server, three columns add just fine (output to a report). On the upgraded server (newer mysql and php), the report displays zero for the three columns. This is the code for adding the three columns: # locations $sql_locs = "SELECT sum(C1NearHome)+sum(C2NearHome)+sum(C3NearHome), sum(C1NearWork)+sum(C2NearWork)+sum(C3NearWork), sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) FROM request WHERE YMDHMS >= $bgnDate AND YMDHMS <= $endDate"; $res_locs = mysql_query($sql_locs); $nrow_locs = mysql_num_rows($res_locs); if ($nrow_locs > 0) { $row_locs = mysql_fetch_row($res_locs); $stats[$stindx . "nearHome"] = $row_locs[0]; $stats[$stindx . "nearWork"] = $row_locs[1]; $stats[$stindx . "nearSchool"] = $row_locs[2]; } This line: sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) isn't adding correctly. The report on the new server shows zero, but on the old server, for example, the number is 4. If I remove two of the sums and make it: sum(C1NearSchool) the report displays the total for that column. When I add the two other sums back to the equation, I get zero again. Any ideas what's wrong here? Any help is greatly appreciated.
-
Thank for the try. Unfortunately, these fixes didn't work. I'll try the mysql forums. thanks
-
Dear Freaks, This is an odd question. I've inherited a very old php application. I attempted to upgrade it. The application is used to add certain columns of data. On the original server, three columns add just fine (output to a report). On the upgraded server (newer mysql and php), the report displays zero for the three columns. This is the code for adding the three columns: # locations $sql_locs = "SELECT sum(C1NearHome)+sum(C2NearHome)+sum(C3NearHome), sum(C1NearWork)+sum(C2NearWork)+sum(C3NearWork), sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) FROM request WHERE YMDHMS >= $bgnDate AND YMDHMS <= $endDate"; $res_locs = mysql_query($sql_locs); $nrow_locs = mysql_num_rows($res_locs); if ($nrow_locs > 0) { $row_locs = mysql_fetch_row($res_locs); $stats[$stindx . "nearHome"] = $row_locs[0]; $stats[$stindx . "nearWork"] = $row_locs[1]; $stats[$stindx . "nearSchool"] = $row_locs[2]; } This line: sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) isn't adding correctly. The report on the new server shows zero, but on the old server, for example, the number is 4. If I remove two of the sums and make it: sum(C1NearSchool) the report displays the total for that column. When I add the two other sums back to the equation, I get zero again. Any ideas what's wrong here? Any help is greatly appreciated.
-
Can you tell what the exact date field is that I need to use from the code above?
-
Dear Freaks, I have a very simple php page (that I've inherited) that grabs 3 sets of data from the database using a drop down menu and a go button: The drop down shows these 3 choices: Show New Records Show Processed Orders Show All Records What do I have to do to the page below to make the "Show Processed Orders" display the records sorted by date? Thanks a million! [code]<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Secure Data Retrieval</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <?php $dbh = mysql_pconnect('localhost', 'username', 'password') or die('Could not connect with the database'); mysql_select_db('3pr', $dbh); //CHECK FOR SET POST_VARS foreach($_POST as $Key => $Value) { if(preg_match('/^FV_Delete_Me_*./', $Key)) { $Delete_Match .= "$Value," ; } if(preg_match('/^FV_Process_Me_*./', $Key)) { $Process_Match .= "$Value," ; } } //DELETE RECORDS if(isset($Delete_Match)) { $Delete_Customer = "DELETE FROM Customer WHERE c_id in ( "; $Delete_Customer_Order = "DELETE FROM Customer_Order WHERE co_c_id in ( "; $Delete_Customer .= "$Delete_Match 0)"; $Delete_Customer_Order .= "$Delete_Match 0)"; mysql_query($Delete_Customer, $dbh); mysql_query($Delete_Customer_Order, $dbh); } //PROCESS RECORDS if(isset($Process_Match)) { $Process_Customer = "UPDATE Customer SET c_processed = '1', c_card_number = '' WHERE c_id in ("; $Process_Customer .= "$Process_Match 0)"; mysql_query($Process_Customer, $dbh); } $Get_Data = "SELECT Customer.c_id, DATE_FORMAT(Customer.c_date_created, '%m/%d/%Y at %h:%m%p') 'c_date_created', Customer.c_processed, Customer.c_first_name, Customer.c_last_name, Customer.c_street_address, Customer.c_city, Customer.c_state, Customer.c_zip, Customer.c_phone, Customer.c_email, Customer.c_card_type, Customer.c_card_number, Customer.c_expiration, Customer.c_item_ordered, Customer_Order.co_id, Customer_Order.co_date_created, Customer_Order.co_date_modified, Customer_Order.co_first_name, Customer_Order.co_last_name, Customer_Order.co_street_address, Customer_Order.co_city, Customer_Order.co_state, Customer_Order.co_zip, Customer_Order.co_phone, Customer_Order.co_email, Customer_Order.co_comments FROM Customer, Customer_Order WHERE Customer.c_id = Customer_Order.co_c_id"; if(!$_POST['FV_Action_Select'] || $_POST['FV_Action_Select'] == 1) { $Get_Data .= " AND Customer.c_processed is NULL"; } elseif($_POST['FV_Action_Select'] == 2) { $Get_Data .= " AND Customer.c_processed IS NOT NULL"; } $Get_Data_Result = mysql_query($Get_Data, $dbh); ?> <body> <table width="700" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="700" height="100" valign="top"> <form name="Interface_frm" id="Interface_frm" method="post" action="secure_data.php"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td height="50" colspan="2" align="center">Threepenny Review Secure Data Retrieval</td> </tr> <tr> <td width="350" height="50" align="center"> <select name="FV_Action_Select" id="FV_Action_Select"> <option value="1" <?php if(!$_POST['FV_Action_Select'] || $_POST['FV_Action_Select'] == 1) {echo 'selected="selected"';} ?> >Show New Records</option> <option value="2" <?php if($_POST['FV_Action_Select'] == 2) {echo 'selected="selected"';} ?> >Show Processed Records</option> <option value="3" <?php if($_POST['FV_Action_Select'] == 3) {echo 'selected="selected"';} ?> >Show All Records</option> </select> </td> <td width="350" align="center"> <input type="submit" name="Go" value="Go" /> </td> </tr> </table> </td> </tr> <tr> <td height="223" valign="top"> <?php while($Row = mysql_fetch_assoc($Get_Data_Result)) { foreach($Row as $Field_Name => $Field_Value) { $$Field_Name = $Field_Value; } $Delete_Name = 'FV_Delete_Me_'; $Delete_Name .= $c_id; $Process_Name = 'FV_Process_Me_'; $Process_Name .= $c_id; if($c_processed == 1) { $Processed = 'checked="checked"'; } else { $Processed = ''; } print <<< END <table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="700" colspan="4" bgcolor="#FFFF00">$c_item_ordered</td> </tr> <tr> <td height="21" colspan="2" align="center" bgcolor="#00CCFF">Billing Information</td> <td colspan="2" align="center" bgcolor="#66CC99">Shipping Information</td> </tr> <tr> <td height="5" colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> <td colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td width="56" height="21" valign="top">Name:</td> <td width="292" valign="top">$c_first_name $c_last_name</td> <td width="56" valign="top">Name:</td> <td width="296" valign="top">$co_first_name $co_last_name</td> </tr> <tr> <td height="21" valign="top">Address:</td> <td valign="top"> $c_street_address<br /> $c_city, $c_state $c_zip<br /> </td> <td valign="top">Address:</td> <td valign="top"> $co_street_address<br /> $co_city, $co_state $co_zip<br /> </td> </tr> <tr> <td height="21" valign="top">Phone:</td> <td valign="top">$c_phone</td> <td valign="top">Phone:</td> <td valign="top">$co_phone</td> </tr> <tr> <td height="21" valign="top">Email:</td> <td valign="top">$c_email</td> <td valign="top">Email:</td> <td valign="top">$co_email</td> </tr> <tr> <td height="5" colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> <td colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td height="21" colspan="2" align="center" valign="top" bgcolor="#FF0000">Credit Card Information</td> <td colspan="2" align="center" valign="top">Comments</td> </tr> <tr> <td height="5" colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> <td colspan="2" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td height="21" valign="top">Type:</td> <td valign="top">$c_card_type</td> <td colspan="2" rowspan="3" valign="top">$co_comments</td> </tr> <tr> <td height="21" valign="top">Number:</td> <td valign="top">$c_card_number</td> </tr> <tr> <td height="21" valign="top">Exp:</td> <td valign="top">$c_expiration</td> </tr> <tr> <td height="19" colspan="2" valign="top"> Processed: <input type="checkbox" name="$Process_Name" id="$Process_Name" value="$c_id" $Processed/> Delete: <input type="checkbox" name="$Delete_Name" id="$Delete_Name"; value="$c_id"/> </td> <td valign="top">Date:</td> <td valign="top">$c_date_created</td> </tr> <tr> <td height="10" colspan="4" valign="top"><img src="../images/spacer.gif" width="1" height="1" /></td> </tr> </table> END; } mysql_close($dbh); ?> </form> </td> </tr> </table> </body> </html>[/code]