Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. The best person to ask would be the previous owner.  Are you a PHP programmer yourself?
  2. Look for [code=php:0]LIKE '$biz%'[/code] instead.  If you want case-insensitive search, use [code=php:0]ILIKE '$biz%'[/code]
  3. Yes, I think that's it.  You can't set the curl options before initializing the object.  I think it should be fine to set the post fields before setting the url.. not 100% sure on that. Your url encoding for the post fields looks good :)
  4. Can you post your entire code?  Starting from the curl_init() at least.
  5. Have you initialized the curl resource, using something like [code=php:0]$io = curl_init('http://www.domain.com/script.php');[/code] The error is complaining about $io, not about the other arguments.
  6. Here's what seems to me to be the simplest solution.. [code=php:0]$filearray = array();   while (!feof($file)) {       $temp = fgets($file, 4096);       $trimtemp = trim($temp);       if (!empty($trimtemp)) $filearray[] = $trimtemp;   }[/code] There's no need to use $y to count if you are only adding to the end of an array. Also, usually people would use $file for the filename and $fp for the file resource.  $fp is traditional to use as a return value from fopen(), since it's taken from C programming, where it would be a "file pointer".
  7. yep, that's all there is to simulating a button press (providing there's no javascript).  A submit button has a name and a value, and those are passed as variables.  A button that isn't pressed doesn't have its name and value passed. Hmm.. I think you would have to urlencode, otherwise embedded '=' and '&' characters would mess up your variables.  Not to mention newlines and other things in your variable values.
  8. The post syntax for variables is the same as get syntax, it just goes in a different location.. for example: [code=php:0]curl_setopt($ch, CURLOPT_POST, 1); $post_args = "action=transmit&Fld1=foo&Fld2=bar&submit=transmit"; curl_setopt($ch, CURLOPT_POSTFIELDS, $post_args); $content = curl_exec($ch);[/code] That's all there is to using post with curl, providing it's only variables you want to post.  $ch will need to be initialized already, which will be the same as in the code you have.  And whether you get the content as the return value from curl_exec() depends on the CURLOPT_RETURN_TRANSFER flag
  9. It looks like register_globals may have been switched off on your server.  Instead of using variables directly, like [code=php:0]$fname[/code], you can use the alternative syntax [code=php:0]$_REQUEST['fname'][/code].  That will work for variables from both POST and GET forms. Like this: [code=php:0]$sql = "INSERT INTO Students (fname, lname, address, city, state, zip, PhoneNum, email, contact) VALUES ('{$_REQUEST['fname']}', '{$_REQUEST['lname']}', ...[/code] You may also need to check [code=php:0]$_REQUEST['submit'][/code] instead of [code=php:0]$submit[/code]
  10. Can you post some of your code?  And also tell us which shopping cart you are using?  We'll need more detail to help you.
  11. What's the context of this?  Have you got some HTML in a string in php, and you want to remove every other <br/> from it?
  12. Yes, it's the configuration.  Apache decides what type a file is (usually based on the extension, but can also be based on location and other factors).  So Apache needs to be told to execute .php files using php. I can't give details because I don't know them, sorry :)
  13. Try changing the name to "value[]", and then look in $_POST['value'] for the array.. If you don't add the "[]", php will only give you the last value entered, not all of them (though you can get them all by parsing the POST data manually)
  14. According to my understanding of scope, it should give you access.. Is $db set right before you call CheckRemember()?
  15. That leaves only one possibility.. the $db object is not behaving like it's supposed to.  If the crash occurs during that query, but the $db object should return false on failure, then the $db object must be buggy (or being used incorrectly).  So.. what's in dbconfig.php? :)
  16. Some other possible solutions are: http://sg.php.net/manual/en/function.session-set-save-handler.php http://sg.php.net/manual/en/function.session-save-path.php Providing your host hasn't disabled them.
  17. Sorry, I left something out: [code=php:0]$query = "SELECT recno,disp,track,Username,date, MIN(HL_MS) AS HL_MS FROM SXHotLap GROUP BY 'Username','track'  ORDER BY 'recno' DESC  limit $eu, $limit ";[/code] The difference is adding "AS HL_MS".  Otherwise the result column will be called "min".  That'll be why you couldn't get the results out.
  18. If you list your columns in the select, you can do things like this: [code=php:0]SELECT username, min(HL_MS), ... FROM SXHotLap[/code] The min() will take effect after the GROUP BY.  You should group by whichever columns you want to do a minimum over. For example, if you want the minimum for each username and track, you should "GROUP BY Username, track"
  19. wahlau!  So many variables!  You might want to use http://sg.php.net/manual/en/function.extract.php Regarding dates, mysql has a native datetime type (I think it's called datetime.. in postgres it's called timestamp).
  20. Does the query fail?  $rCookie[0] was forced to be an integer, so I don't see how a syntax error is possible.  The only problems I can imagine is if the uid column doesn't exist, or if no rows are returned from the query.
  21. Looks like there is a bug in CheckRemember(). If possible, enable displaying of php errors. If you can't do that (or if it's not convenient), than add some print statements throughout CheckRemember(), and see how many of them are displayed before it fails.  That will help you narrow down where the problem is.  I don't notice anything wrong right now, but the symptoms you described tell me there is an error there somewhere.
  22. Aha.. I think I see the problem now. Just before the query to set online = '0', add: [code=php:0]$_email = $_SESSION['email'];[/code] That will get the email back out from the session data.
  23. Two simple steps will solve your problem. 1.  Replace your query with [code=php:0]$result = mysql_query("UPDATE users SET online = '0' WHERE email = '$_email'") or die(mysql_error());[/code] 2.  If you don't get an error, then print the value of $_email.  You will probably find it doesn't match.  If it does match, then post here again with your current code, as well as the output.  Maybe there is some subtle escaping problem with the mysql query.
  24. If I understand correctly, you can do it like this. [code=php:0]// Start first table $last_product = null; for ($i = 0; $i < $num_rows; $i++) {   if ($row['product'] !== $last_product && $last_product !== null) {     // End previous table and start new table     $last_product = $row['product'];   }   // Display row } // End final table[/code]
  25. Seraskier, that will set online = 0 for ALL users.  The problem before was that $_email was not set correctly.  Try printing out the value of $_email before running your query. Actually since you aren't checking for errors, there's a million things that could go wrong. [b]Check all your mysql_query() calls for errors[/b]
×
×
  • 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.