Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. I have two seperate expiration dates. ( Date_expired and Expiration ) I want to select only the rows that are not expired and have not hit either one of these dates. Here is my query: $result = mysql_query("SELECT * FROM dog_listing WHERE `Breed` = '$breed' ORDER BY Date_created ASC ", $db) or die(mysql_error()); How could I add Date_expired and Expiration into my query to where I am selecting only the rows that are not expired?
  2. thank you!
  3. how could I make it break off the policy number from the file name and search for .pdf's according to that using the function below? It would be the number in front of the first period. (Ex. 485743.documentname.pdf) function browsepdf(){ $pdffile=glob("printable/*.pdf"); rsort($pdffile); foreach($pdffile as $filename){ $filename=ltrim($filename, "printable/"); $filename=rtrim($filename, ".pdf"); $file=$filename; $datetime=strtotime($filename); $newdate=strtotime("+3 days",$datetime); $filenamedate=date("F d", $datetime); $filenamedate.=" - ".date("F d, Y", $newdate); echo "<option value='$file'>$filenamedate</option>"; } }
  4. How could I have php pull pdf's with a certain name? Ex. If their policy number is 68402. And I have "58692.12-23-2007.documentname.pdf" , "68402.11-12-2007.documentname.pdf", etc... It would only pull the 68402.11-12-2007.documentname.pdf. I wanted it to seperate the policy number and date from the .pdf name then only display links to the .pdf's associated with their policy number. Thanks, Jake
  5. Does anyone know how to update data from one column to another in the same table where there are duplicate rows?
  6. I didn't get any errors but the page tried to load forever and it returned this: CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process. Do I have what I am trying to do setup correctly? Where I am trying to update info from one column into another where my items repeat?
  7. 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 '\'PIONEER CONDENSER\' and `isbn` = 0060700C \'' at line 1 for query UPDATE `books` SET `isbn` = `isbn2` where `description` = \'PIONEER CONDENSER\' and `isbn` = 0060700C \' $sSQL = "SELECT DISTINCT isbn FROM books"; // Select Unique values $recUnique = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $row = MySQL_Fetch_array( $recUnique ) ) { $isbn=$row["isbn"]; $sSQL = "SELECT * FROM books WHERE `isbn`='$isbn'"; $recDuplicate = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $duplicates = MySQL_Fetch_Array( $recDuplicate ) ) { $updatedescription=$duplicates["description"]; //$updatedescription=mysql_real_escape_string($updatedescription); $updateisbn=$duplicates["isbn"]; //$updateisbn=mysql_real_escape_string($updateisbn); // print( "Duplicate found: " . $duplicates["isbn"] . "<BR>\n" ); $query = "UPDATE `books` SET `isbn` = `isbn2` where `description` = '$updatedescription' and `isbn` = $updateisbn'"; $query = mysql_real_escape_string($query); //print($query); mysql_query($query) or die(mysql_error() . " for query $query"); } MySQL_Free_Result( $recDuplicate ); } MySQL_Free_Result( $recUnique ); MySQL_Close( $dbConn );
  8. now i'm getting this error: Error executing query: 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 '06'' at line 1 $sSQL = "SELECT DISTINCT isbn FROM books"; // Select Unique values $recUnique = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $row = MySQL_Fetch_array( $recUnique ) ) { $isbn=$row["isbn"]; $sSQL = "SELECT * FROM books WHERE `isbn`='$isbn'"; $recDuplicate = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $duplicates = MySQL_Fetch_Array( $recDuplicate ) ) { $updatedescription=$duplicates["description"]; $updatedescription=mysql_real_escape_string($updatedescription); $updateisbn=$duplicates["isbn"]; $updateisbn=mysql_real_escape_string($updateisbn); // print( "Duplicate found: " . $duplicates["isbn"] . "<BR>\n" ); $query = "UPDATE `books` SET `isbn` = `isbn2` where `description` = '$updatedescription' and `isbn` = '$updateisbn'"; //print($query); mysql_query($query) or die(mysql_error() . " for query $query"); } MySQL_Free_Result( $recDuplicate ); } MySQL_Free_Result( $recUnique ); MySQL_Close( $dbConn ); `Jake
  9. 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 'HANDLE' and `isbn` = '06100 '' at line 1 for query UPDATE `books` SET `isbn` = isbn2 where `description` = 'CANT HOOK/2-1/4"X2' HANDLE' and `isbn` = '06100 '
  10. Here's my problem. I have a database with about 50,000 items. Three hundred of these items have identical part numbers because I am using the manufacturers part number. The column next to the manufacturers part number is my number. I cannot just up and revert to using my unique part number because Google has already indexed a lot of my pages. What I am wanting to do is to select all the items that are being repeated and update my unique part number from the isbn2 column into the manufacturers part number column (isbn). Heres what I am trying, but not working: $sSQL = "SELECT DISTINCT isbn FROM books"; // Select Unique values $recUnique = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $row = MySQL_Fetch_array( $recUnique ) ) { $isbn=$row["isbn"]; $sSQL = "SELECT * FROM books WHERE `isbn`='$isbn'"; $recDuplicate = MySQL_Query( $sSQL ) or Die( "Error executing query: " . MySQL_Error() ); while ( $duplicates = MySQL_Fetch_Array( $recDuplicate ) ) { $updatedescription=$duplicates["description"]; $updateisbn=$duplicates["isbn"]; // print( "Duplicate found: " . $duplicates["isbn"] . "<BR>\n" ); $query = "UPDATE `books` SET `isbn` = isbn2 where `description` = '$updatedescription' and `isbn` = '$updateisbn'"; //print($query); mysql_query($query) or die(mysql_error()); } MySQL_Free_Result( $recDuplicate ); } MySQL_Free_Result( $recUnique ); MySQL_Close( $dbConn ); I am getting this error: 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 'HANDLE' and `isbn` = '06100 '' at line 1
  11. Does anyone know how I could update column isbn2 to column isbn where column isbn is repeated more than once using php?
  12. UPDATE books SET isbn2 = isbn WHERE isbn IN ( SELECT isbn FROM books GROUP BY isbn HAVING count( isbn ) >1 ) MySQL said: Documentation #1093 - You can't specify target table 'books' for update in FROM clause
  13. Here's my problem. I have a database with about 50,000 items. Three hundred of these items have identical part numbers because I am using the manufacturers part number. The column next to the manufacturers part number is my number. I cannot just up and revert to using my unique part number because Google has already indexed a lot of my pages. What I am wanting to do is to select all the items that are being repeated and update my unique part number from the isbn2 column into the manufacturers part number column (isbn). How could I go about doing this? Thanks, Jake
  14. How do I select all the rows from my mysql database where my product column is repeated more than once?
  15. This fixed it: $tmp .= $testingsamicans.' | <b>SSC='.$sscpartnumber.'</b> | '; $tmp .= $testingsamicans2.'<br />'; Thank you, Jake
  16. Hey I have a loop where I am retrieving my items and quantities for my orders. In the middle of this loop I am trying to select a sub part number from a different table specific to the part number from the order. You will see where I tried to do this with the $resultlinda variable. $tmp is now spitting back 864 for some reason. I am doing something wrong. $result = mysql_query("SELECT * FROM order_items WHERE orderid = '$coolid'", $db); echo"<table align=center width=650 border=1>"; echo"<tr>"; echo"<td width=160 bordercolor=#0066FF bgcolor=#FF0000><div align=center><span class=style1><strong>Order ID</strong></span></div></td>"; echo" <td width=160 bordercolor=#0066FF bgcolor=#FF0000><div align=center><span class=style1><strong>Part Number</strong></span></div></td>"; echo"<td width=160 bordercolor=#0066FF bgcolor=#FF0000><div align=center><span class=style1><strong>Price</strong></span></div></td>"; echo"<td width=160 bordercolor=#0066FF bgcolor=#FF0000><div align=center><span class=style1><strong>Quanity</strong></span></div></td>"; echo"</tr>"; echo"</table>"; echo "<TABLE align=center width=650 BORDER=1 CELLSPACING=0 CELLPADDING=5>"; while ($myrow = mysql_fetch_array($result)) { echo"<tr><TD WIDTH=160 align=center>"; echo$myrow["orderid"]; echo"</td><TD WIDTH=160 align=center>"; echo$myrow["isbn"]; echo"</td><TD WIDTH=160 align=center>"; echo$myrow["item_price"]; echo"</td><TD WIDTH=160 align=center>"; echo$myrow["quantity"]; $testingsamicans = $myrow['isbn']; $testingsamicans2 = $myrow['quantity']; $resultlinda = mysql_query("SELECT isbn2 FROM books WHERE isbn = '$testingsamicans'", $db); while ($myrow1 = mysql_fetch_array($resultlinda)) { $sscpartnumber = $myrow1["isbn2"]; } $tmp .= $testingsamicans.' | '.SSC- $sscpartnumber |'.'; $tmp .= $testingsamicans2.'<br />'; echo"</td>"; echo"</tr>"; } echo "</table>";
  17. Here is the code for this: What could be causing my error? $query = "insert into order_items values ('$orderid', '$isbn', ".$detail['price'].", $quantity)"; $result = $conn->query($query);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.