Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Using a series of pages named question1.php, question2.php, question3.php,... would be the hardest way of doing this because you are not making use of what php was designed for - letting php dynamically produce the web pages instead of you creating the web pages by hand. You should be using a GET parameter on the end of the URL that indicates what action your single page of code does - index.php?question=1 index.php?question=2 index.php?question=x $_GET['question'] would have the value x when the page is requested. As to your 404 error for the question3.php page, obviously you don't have a page in the current location by that exact name. Did you look at the file, checking for things like spelling errors and if you created your file using a Windows supplied editor, are you sure your file does not have a hidden .txt extension?
  2. There are very few incompatible changes between php4 and php5 (they are listed in the php.net documentation) and most of them are fairly obscure and most people's code won't be affected by them and will work as is under php5, assuming that you were using the current recommend php.ini settings. It is likely that your code was always producing most of the errors you are now seeing, but they were hidden due to the error_reporting/display_errors settings on your old server setup. You should find and fix the cause of each error message, because some of them are probably due to php.ini settings that are now off because the feature is scheduled to be removed from php in an upcoming version. If you want help with any particular error message, post the whole message and the relevant code.
  3. You are not executing the query in your code, so it will be a little hard for there to be any matching results.
  4. If you get the Apache binaries from apache.org, they are compiled with the VC6 compiler and the correct php binary would be the VC6 flavors. However, you are attempting to use php as an apache module and you would need to use the thread-safe php binary (nts = not thread safe.) The latest php5.3 binaries only come complied with the VC9 compiler and are not compatible with the apache binary from apache.org. However, you can get apache compiled with the VC9 compiler from this link - http://www.apachelounge.com/
  5. Where did you get the php binaries from and what complier (VC6 or VC9) flavor did you get? Where did you get that Apache binary from as well? Also, the php5.2 branch is dead. Why not use the latest php5.3?
  6. Your code really should have used page numbers, 1,2,3,4... rather than using the actual range in the links. This would have allowed you to have a variable that holds the number of items per page and simply calculate the values when you need them and you could have changed the number of items you display by simply changing one variable. The only looping you should be doing is to produce the bars and since you only want three, you should only loop three times. Based on what I think you want as the result - <?php $num_per_page = 20; $start = (isset($_GET['start']) && (int)$_GET['start'] > 0) ? (int)$_GET['start'] : 1; // start should only be 1, 21, 41, 61 Test for valid start values - if((($start - 1) % $num_per_page) != 0){ // not valid $start = 1; } $rank = $start; // is $rank really used, since it is the same as $start? $limit_by = 'LIMIT ' . ($start - 1) . ', ' . ($start + $num_per_page - 1); $bars = ''; // loop three times for($i = 1; $i <= 41; $i += $num_per_page){ $active = ($i == $start) ? ' active' : ''; $from = $i - 1; $to = $i + $num_per_page - 1; $bars .= "<div id='from_{$from}' class='rPosButton{$active}' style='height: 185px;' onclick=\"getNextParticipants(this);this.blur();\" onmouseover=\"Tip( get_value('$i - $to'), TEXTALIGN, 'justify', ABOVE,'true', TEXTALIGN, 'justify', PADDING,10, TEXTALIGN, 'justify', OPACITY,90, TEXTALIGN, 'justify', FIX,[300,450], TEXTALIGN, 'justify', DELAY,1, TEXTALIGN, 'justify' );\" onmouseout=\"UnTip();\"> </div>\n"; } ?>
  7. $num is probably not > 0. Have you echoed it or better yet used var_dump() to see what it actually is? Given that you were likely getting php errors on the mysql_query() and mysql_num_rows() statements, so you added the @ to hide the errors, I would guess that your query is failing with to an error of some kind and using mysql_error like you are doing on the insert query would probably tell you why the select query is failing.
  8. Your function isn't returning the result of your query ($result), it is returning a non-existent variable ($pageSet), so of course your mysql_fetch_array statement will fail.
  9. As to the series of $active_1_20, $active_21_40, ... variables. You wouldn't ever create a series of separately named variables like that, where you set one of them to indicate which VALUE is active. That implies that you have a series of conditional tests somewhere else in your code to find which one of those separate variables is active. You would have ONE variable ($active) that you set to a VALUE that indicates which range is active.
  10. A logical AND requires all the conditions to be TRUE at the same time, which they cannot be for one field. You actually need to use an OR (the field is one value OR another value OR another value.) mysql has an IN() conditional test that will let you easily match a field against a list of values - WHERE product_id IN(1,2)
  11. From the php.net documentation - If you are still using php4, be aware that the end of life of php4 was over 4 years ago and everyone should have already upgraded to the latest php5 version.
  12. The end of life of php4 was over 4 years ago. Your web host should have provided a way of upgrading your account to the latest php5 version, either through a control panel choice, a setting in a .htaccess file, through the use of a specific file extension, or by emailing them and asking that your account be upgraded/moved to a php5 server.
  13. For the specific case of a form, you would use isset() to detect if the form was submitted by testing if the submit button name or a hidden field name is set - if(isset($_POST['submit'])){ // the form was submitted, put all the code to validate and process the form data here... } However, after you know the form was submitted, you would not use isset() on all the rest of the form fields, because text, password, hidden, and textarea fields are set even if they are empty. You would only use isset() on checkbox and radio fields as they are not set when they are not selected in the form.
  14. error_reporting determines what errors are reported (kind of why they named it that.) display_errors determines if the errors that are reported will be output to the browser. You should always have error_reporting set to at least E_ALL or even better a -1. You want all errors to be reported and code should not normally produce any errors during its execution. You should only get errors for abnormal things that your code did not take into account. On a development system, display_errors should be ON (you want to see the errors so that you can find an fix what is causing them.) On a live server display_errors should be OFF and log_errors should be ON (you don't want to display any php detected errors but you do want to log them so that you have a record of any problems so that you can find an fix them.) Even if you have error_reporting set to zero, php must still detect and handle each error as it occurs. The reporting and display/logging of the error is just the last step in the error handling code.
  15. String data must be enclosed in single-quotes.
  16. The only parse error in the posted code is in this line - $readername = ['user']; (missing the array variable in front of the ['user'] ) I would say your development system/editor has a bug/virus that is corrupting the files.
  17. Once you have an array that defines the form fields and labels, you can dynamically produce and output the form like so - $form = "<form method='get' action=''>\n"; foreach($fields as $key => $label){ $form .= "<label for='$key'>$label:</label>\n<input type='text' id='$key' name='$key' value=''><br />\n"; } $form .= "<input type='submit'>\n</form>"; echo $form;
  18. <?php $fields = array(); $fields["Id_From"] = "some label to use with this field..."; $fields["ID"] = "some label to use with this field..."; $fields["CUT"] = "some label to use with this field..."; $fields["MAKE"] = "some label to use with this field..."; $fields["CARAT"] = "some label to use with this field..."; $fields["PRICE_PC"] = "some label to use with this field..."; $fields["CLARITY"] = "some label to use with this field..."; $fields["LOCATION"] = "some label to use with this field..."; $fields["CERTIFICATE"] = "some label to use with this field..."; $fields["SUP_STOCK_REF"] = "some label to use with this field..."; $fields["Measurements"] = "some label to use with this field..."; $fields["Total_Depth"] = "some label to use with this field..."; $fields["Polish"] = "some label to use with this field..."; $fields["Table_Width"] = "some label to use with this field..."; $fields["Symmetry"] = "some label to use with this field..."; $fields["Crown_Height"] = "some label to use with this field..."; $fields["Culet"] = "some label to use with this field..."; $fields["Parillion_Depth"] = "some label to use with this field..."; $fields["Graining"] = "some label to use with this field..."; $fields["Girdle"] = "some label to use with this field..."; $fields["Remarks"] = "some label to use with this field..."; $fields["TotalPrice"] = "some label to use with this field..."; // form processing code, detect if the first (expected) get parameter is present if(isset($_GET["Id_From"])){ $errors = array(); // array to hold any validation errors // validate all the expected data here ... // process the data if no validation errors if(empty($errors)){ // loop over the expected fields and form the mail message $message = ''; // define variable/empty message foreach($fields as $key => $label){ $message .= "$label: $_GET[$key]\n"; } $message = wordwrap($message, 70); if(mail('gary.impact@gmail.com', 'HIGH PRIORITY DIAMOND ORDER!', $message)){ echo "Sending Mail server accepted the email to send!"; } else { echo "Sending Main server rejected the email!"; } } } ?>
  19. When validating or processing a number of forms fields, it is usually a good idea to have an array of the expected from field names (and labels). You can also use this array to produce the form using php code instead of hard-coding it. This would let you loop through the expected field names (lets you ignore any fields not part of your form that a spammer has submitted) and form a message dynamically, rather then hard-code each line in the message. If you need to add/subtract any form fields, you would simply alter the array that is defining the list of fields.
  20. Syntax errors are usually reported on a line after where the actual problem is at (i.e. the parser doesn't know that you didn't intend to leave out that punctuation that made all the following lines part of a statement x lines before where it found something it could not understand in your code.) A) Post the exact error message (xxxxx out any information you don't want to show). B) Post at least 10 lines before and including the line where the error is reported.
  21. You are missing a double-quote on the end of your DELETE query statement. You should be using a programming editor with color highlighting (that's how I pinpointed where the problem was - the colors stopped changing because everything after the missing quote was treated as part of that string.)
  22. No one can possibly help you with what your code is doing without seeing your code. I'll guess you have an error in your logic that is replacing the value rather than testing the value.
  23. I write programs (queries) to do what they need to do, not find them...
  24. Assuming that the default for the column could be either a NULL or an empty string - UPDATE thatsact_tag_clan.tag_user SET membergroupids=CONCAT(IFNULL(membergroupids,''),IF(LENGTH(IFNULL(membergroupids,''))>0,',',''),'11') WHERE username='$vbid'
  25. This is likely a caching problem, either on the web server or on a proxy located between where the web server is and where you are.
×
×
  • 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.