Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You should not use mysqli_real_escape_string when using prepared statements, they are mutually exclusive.
  2. checkdate
  3. Every character that you output to the browser that is after the closing > of the <textarea> tag and before the opening < of the </textarea> tag becomes part of the data in the text area. Remove all the characters except what your php code is outputting - <textarea id="body" name="body" class="text" cols="20" rows="5" wrap="soft"><?php your php code ?></textarea>
  4. I think you need to look at the actual filename you are creating and what filename you have in the link.
  5. The upload handling section of the php.net documentation shows what you need for the <form> tag, for a form field, and for basic php code to access the uploaded file information - http://www.php.net/manual/en/features.file-upload.php
  6. It sounds like the actual problem was that there was a comma as a thousands separator in the number (the thousands separator is a human convention to make numbers easier for us to read.) Computer programs don't need and some cannot make use of things like commas in numbers (php treats the first character that is not valid for a number as a stop character.)
  7. primary is a reserved mysql keyword. You either need to rename your column to something else or you must enclose it in back-ticks `` every time you use it in a query.
  8. I would use var_dump() on the values to see what they actually contain.
  9. <?php $P = 100000; $M = 1400; $q = 12; $i = .1; $n = -log(1-($P * $i/($M * $q)))/($q * log(1+($i/$q))); echo $n; ?> 9.0821962960889
  10. Why can't you pass variables through the URL?
  11. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=341909.0
  12. See the various sticky posts in this forum section - http://www.phpfreaks.com/forums/index.php?board=43.0
  13. You would use preg_replace to directly do this - <?php $str = "This is some sample text and [[Debenhams||debenhams.com]] and this is a bit more sample text that [[sainsburys||sainsburys.com]]"; $str = preg_replace("/\[\[(.*?)\|\|(.*?)\]\]/is","<a href='http://www.$2' title='Visit the $1 website' target='_blank'>$1</a>",$str); echo $str;
  14. You would also almost never use a query inside of a loop. The following (untested) logic should work - <?php // your database connection/selection code here... $query = "SELECT * FROM tenders_temp ORDER BY subscriber"; // get the rows you want in the order that you want them if(!$result = mysql_query($query)){ // query failed, handle the error here... trigger_error("Query failed: $query, Error: " . mysql_error()); echo "A database error occurred and this page cannot be displayed!"; } else { // query worked, test if it matched any rows if(!mysql_num_rows($result)){ // no rows were matched echo "There were no matching rows"; } else { // matched at leat one row, process the data here... $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: info@tenders24.com\r\n"; $headers .= "Reply-To: info@tenders24.com\r\n"; $headers .= "Return-Path: info@tenders24.com\r\n"; $headers .= "Organization: Tenders24\r\n"; $headers .= "X-Priority: 3\r\n"; $last_subscriber = null; // remember the last subscriber's email, initialize to a value that will never exist in the data while($row = mysql_fetch_assoc($result)){ // test for a change in the subscriber if($last_subscriber != $row['email']){ // the subscriber changed (or is the first one) if($last_subscriber != null){ // not the start of the first one, close out the previous section $msg .= " </table> </body></html>"; mail($last_subscriber, "Tenders24", $msg, $headers); } // start a new section $msg = "<html><body> <table width='100%' border='0' cellspacing='0' cellpadding='10'>"; $last_subscriber = $row['email']; // remember the new subscriber } // process each row of data here... $msg .= " <tr> <td valign='top'><strong>SUBSCRIBER:</strong></td> <td colspan='3'>".$row['subscriber']."</td> </tr> <tr> <td valign='top'><strong>CATEGORY:</strong></td> <td colspan='3'>".$row['tender_interests']."</td> </tr> <tr> <td width='16%' valign='top'><strong>REFERENCE: </strong></td> <td width='34%'>".$row['reference']."</td> <td width='15%'><strong>CLOSING:</strong></td> <td width='35%'>".$row['closedate']." ".$row['closetime']."</td> </tr> <tr> <td valign='top'><strong>DESCRIPTION:</strong></td> <td colspan='3'>".$row['summary']." ".$row['description']." ".$row['detail']."</td> </tr> <tr> <td valign='top'><strong>CONTACT:</strong></td> <td colspan='3'>".$row['organization']."; ".$row['contact']."; Phone: ".$row['dial_code']." ".$row['telno']."; Email: ".$row['email']."</td> </tr> <tr> <td valign='top'><strong>DOCUMENTATION:</strong></td> <td colspan='3'>".$row['documentation']."</td> </tr> <tr> <td> </td> <td> </td> <td colspan='2'> </td> </tr> <tr> <td> </td> <td> </td> <td colspan='2'> </td> </tr>"; } // close out the last section $msg .= " </table> </body></html>"; mail($last_subscriber, "Tenders24", $msg, $headers); } }
  15. Are you actually executing the query in your php code? Do you have any error checking and error reporting logic in your php code that would tell you if and why the query is failing?
  16. Why are you doing multiple conversions on both values to compare dates? If your dates are stored in your database as either a mysql DATE, DATETIME, or TIMESTAMP data type, you can do greater-than/less-than comparisons directly on the values, as someone explained in one of your previous threads, provided both values being compared are in the same format. What exactly are you trying to accomplish by comparing dates?
  17. You still haven't posted the complete code on the page you are having a problem with so that someone could A) see if it is doing something that is causing this problem, and B) duplicate the problem or not to see if this is something to do with your code, your browser, or your server. If the number of rows varies, this is still most likely due to the page being requested multiple times and a timing/race condition. Are you doing this on a live server or on a localhost development system? I would suggest a way of detecting and filtering out the excess (wrong/empty) data, but getting as many as 3 excess pieces of data indicates something is occurring that is not normal and should be found and fixed. If every time someone on your site clicks a link, there is the original request plus up to 3 more, that will make for a lot of unnecessary requests to the server (and we still don't know if the problem is actually your code executing multiple queries, perhaps due to a missing exit; statement after a header() redirect somewhere, because you have not posted enough of your code on the offending page for someone to see and/or duplicate the problem.)
  18. The best recommendation when developing and debugging any php code is to have error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the php detected errors will be reported and displayed. If output_buffering is on, you should turn it off so that any header() redirect statements won't cause any error messages to be hidden/discarded when the redirect occurs. Confirm using a phpinfo() statement that those two settings changed in case the php.ini that you are changing is not the one that php is using.
  19. What result, error, or other symptom did you observe that leads you to believe it did not work? There's nothing technically wrong with that query.
  20. It would help if you posted the source code of the page that is being browsed to that is producing that output so that someone could see what the php code should be doing, because we don't have any idea even what version of OSC you are using or of what modifications you might have made to the source code.
  21. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=341821.0
  22. If you search the Internet for information on that error, you will find that on Windows you cannot use GDFONTPATH because the GD functions that read GDFONTPATH cannot deal with Windows drive and path separators. Just list the full path and filename in your $font variable - $font = 'C:\WINDOWS\Fonts\arial.ttf';
  23. FROM is misspelled in your query. Whatever output you got from the print_r wasn't correct because $result isn't an array.
  24. You should be developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON so that all the php detected errors will be reported and displayed. You will save a ton of time. Your query is failing due to a typo in sql syntax, you have not defined the $bar_height variable, and you are likely getting an error concerning the font filename. You will need to browse directly to the page containing that code to see the php errors that are output after you set the error_reporting/display_errors settings and if output_buffering is on, you will need to turn that off as well.
  25. You are executing your query inside the while(...) conditional statement, so it is starting over every pass through the loop. Edit: In this statement: while(mysql_fetch_row(mysql_query($query))){ You would need to execute the query once, before the start of the while(){} loop, like every php book, tutorial, and code example that has ever been written.
×
×
  • 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.