Jump to content

Jenk

Members
  • Posts

    778
  • Joined

  • Last visited

    Never

Everything posted by Jenk

  1. er, what? Clarify with an example in pseudo please.
  2. count up the number of } and { you have, and check you haven't got an else without an if.
  3. remove the @. It is hiding the one thing that will be most useful to you right now.. so remove it.
  4. Just a note for HuggieBear - you don't need to sub-select when searching for max(): [code]SELECT `column` FROM `table` WHERE `column` = MAX(`column`)[/code] :)
  5. fopen+fwrite+fclose www.php.net
  6. [url=http://us2.php.net/manual/en/function.number-format.php]number_format()[/url] may also be of use.
  7. Where do you start the session, and where do you check that $_SESSION['username'] has a value? Also, learn to use JOIN's and not nested mysql_query()'s.
  8. pedantic: md5 is not encryption, it is hashing.
  9. [code]<?php session_regenerate_id(true); ?>[/code][/code]
  10. [quote author=kenrbnsn link=topic=107589.msg431903#msg431903 date=1157949420] You also may want to change your code to use an array instead of many variables: [code]<?php //First we round the values to get sig figs. We don't round the first value since its the NPS $sigfig=2; //number of decimal values  for($i=2;$i<count($col);$i++)     $col[$i] = round($col[$i],$sigfig); ?>[/code] Unecessary with the use of array_walk(): [code]<?php $array = array(1.111,2.222,3.333); array_walk($array, create_function('&$a,$b,$c', '$a = round($a, $c);'), 2); var_dump($array); ?>[/code]
  11. As above, and besides creating a mySql object for all the images available surely isn't that overtly non-abstract. Instead of using a Row Data Gateway pattern, you are using a Table Data Gateway (use this instead of an array for all images)... or even Object Relational Mapping. If you still want each image to retain image specific info in it's own pattern, you should create a new object for that image upon selecting the individual image. Something like: [code]<?php $db = new DB(/* connection gubbins */); $db->exec('SELECT * FROM `images`'); /* this is the table data gateway */ $ImageData = new ImageDataGateWay($db); while ($image = $ImageData->fetchImage()) {     echo $image->name . '<br />' . chr(10); } ?>[/code]
  12. It's variable scope; have a read :) http://php.net/manual/en/language.variables.scope.php
  13. str_pad()
  14. It's possible, but will be utterly complex.
  15. [quote author=448191 link=topic=107326.msg430491#msg430491 date=1157717619] [quote author=Jenk link=topic=107326.msg430400#msg430400 date=1157706231] There will be recommendations for $_SERVER['HTTP_REFERER'] and/or $_SERVER['REMOTE_ADDR'] but they are [b]very[/b] unreliable. [/quote] No there won't, because I said 'hard to spoof' and everybody knows those are easy to spoof. [/quote]Ha, you've been here longer than I have, yet you say that.[quote] [quote author=Jenk link=topic=107326.msg430400#msg430400 date=1157706231] If it's local, don't use $_POST. [/quote] I'm sorry I wasn't very clear. I wanted something like HTTP_REFERER but more reliable. I was going to use it to verify that the sending of data was provoked by my own application, but now that I think of it there are probably better ways to do that. In short: never mind. [/quote]Still stands.. you own application is instigating the POST data.. so why use POST in the first place? Use SESSION or better yet a database table.
  16. you also have E_STRICT warnings on.
  17. you don't have to, you can 'call upon' them within the function with the global key word.. change to:[code]<?php function get_balance($the_user_id){             global $database_affiliates, $affiliates; mysql_select_db($database_affiliates, $affiliates); ?>[/code]
  18. $type === NULL give it a value.
  19. You should question why you need something to run indefiniately.
  20. It's not the (lack of) declaration of static that is the actual cause of the error, it is the use of the pseudo variable $this that is the real failing :) $this is a reference variable to the instantiated object of itself, so without instantiation, there is no object - thus there is no $this :) btw, you are using PHP5.. you should make full use of the PHP5 OO syntax, namely declarations. They are the sex.
  21. indeed, but that could involve reworking 90+% of his site, and a headache full of troubles when some hosts don't use mysqli :)
  22. http://php.net/realpath
  23. It's always worth it, and it is the exact type of design pattern Relational Databases such as MySQL are designed for. It is actually much less work to create the table and use a JOIN than it is to implode/explode an array (or serialize())
  24. need to surround the value with single quotes like so: [code]$sql="SELECT * FROM table where date <= '$date'";[/code] otherwise it thinks you are looking for 1990 (2006 - 7 - 9 = 1990) :)
×
×
  • 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.