Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. You can't use PHP like this, you'll need to use AJAX.
  2. When possible you should avoid using the regex engine as it uses a lot of resources. In this case you should use ctype_alpha.
  3. The same way I showed you above?
  4. Well I'm guessing you're not using a numerical data type to store the prices, as I don't believe MySQL has support for using a comma as the decimal separator, I'm not entirely certain but it doesn't make any mention of it here. So you should be storing the prices in a field of type FLOAT using periods as the decimal separator. Then you can do whatever math you want with the number in PHP. If you want to convert it back to using a comma as the decimal separator that is something you can have it change before it's outputted.
  5. How are you storing the prices in the database?
  6. 285,25? That's not even a number..
  7. The only line you need to insert is: $row['price'] += 10; I posted another part of you code just to show you a reference for where it should go. Right after: while ($row = mysql_fetch_assoc($result)){
  8. You won't be able to do math inside of a heredoc block. So you can either split it up or just do this: while ($row = mysql_fetch_assoc($result)){ $row['price'] += 10; ...
  9. This is called pagination. You can find a very good tutorial explaining how it works here.
  10. Your setup isn't clear. What do you mean "make JQuery work as part of an AJAX call."?
  11. In most cases it's not practical to make ajax calls that quickly, especially if you're using Apache. Maybe you should look into some push technology like long pooling, you can start here: http://en.wikipedia.org/wiki/Push_technology
  12. $serviceStatus[] = array($name => 'online');
  13. In your specific example there's no point.
  14. You should not be using session_register, as the notice states it's depreciated and has been for quite some time. Instead use the $_SESSION array. It is also important to note that you must start the session on every page (preferably at the top) to access the values in this array. session_start(); // Start the session ... $_SESSION['var'] = 'val';
  15. Create a .htaccess file and put something like this in it: RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html
  16. Perhaps this will be of use to you: http://stackoverflow.com/questions/52755/what-determines-the-monitor-my-app-runs-on
  17. If you wanted to do that you'd need to put the math inside of parenthesis: $_REQUEST['dt'] = strtotime( $year."-".($month * 1)."-".$day ); But what's the point of multiplying $month by 1 anyway?
  18. Unfortunately, you can't access members of an array returned from a function like that. $day = getdatefromcalendarformat( $_REQUEST['dt'] ); $day = $day[2];
  19. I'm not sure it's the best idea to have a bunch of people who don't know what they're talking about sharing incorrect information. Sounds like it would do more harm than good.
  20. If you have any PHP code in a file that you wish to execute you must name the file with a .php extension (or use other methods to tell the server to parse other files as PHP files). You can combine PHP and HTML in a single file.
  21. Delete: else{ die ($result); // lets see the error code } $result isn't even defined, unless it's in _include-config.php.
  22. It would be nice if you posted the error message. Your problem is that you're doing: if(...) { ... } else { ... } else { ... } if($ebcheck!="OK") { die ("Je betaalcode kan momenteel niet gecontroleerd worden, probeer het later nog eens."); }else{ mysql_query("UPDATE `[users]` SET `belcredits`=`belcredits`+'100',`cash`=`cash`+'500000' WHERE `login`='".$_SESSION['login']."' LIMIT 1"); mysql_query("INSERT INTO `[logs]`(`time`,`ip`,`forwarderfor`,`login`,`person`) values('{$data['login']}','{$data['email']}',NOW(),'{$_SERVER['REMOTE_ADDR']}','100 belcredits')'')"); mysql_query("UPDATE `[users]` SET `naam`='{$data['login']}' WHERE `login`='".$_SESSION['login']."'"); echo 'Je hebt <b>100 Belcredits</b> gekocht! Daarbij kreeg je ook nog eens <b>€500.000,-</b> Contant.'; mysql_query ( "INSERT INTO [logs] (login,time,ip) VALUES ('".$_SESSION['login']."',NOW(),'".$_SERVER['REMOTE_ADDR']."')"); }else{ die ($result); // lets see the error code }
  23. Will the backets work in previous versions? Yes, square brackets will work in previous versions. You must call session_start always, otherwise you won't be able to access the $_SESSION array. <?php session_start(); if(!isset($_SESSION['ses_id'])) { $_SESSION['ses_id'] = md5(rand()); }
  24. Single quotes don't have variable interpolation, and if you're just echoing the variable you don't need quotes at all. <?php echo $sessid; ?>
  25. Then he would fill them in. From the looks of the code I'd guess that he copied the function declaration which includes default values for those parameters.
×
×
  • 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.