www.webdeveloper.com

Search:

Type: Posts; User: gvre

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    1,997

    You should loop through the matches[0] or...

    You should loop through the matches[0] or matches[1] array and print whatever you need.
  2. Replies
    8
    Views
    1,997

    $pattern = '#(.+?)#si';...

    $pattern = '#<span class="jcn">(.+?)</span>#si';
    if (preg_match_all($pattern, $content, $matches))
    {
    print_r($matches);
    }
  3. Not necessarily. Some ISP's use round-robin...

    Not necessarily. Some ISP's use round-robin proxies for their clients. Furthermore, users may use load balancing on multiple internet connections, so their IP might change often.
  4. I would not suggest using the IP for tracking...

    I would not suggest using the IP for tracking purposes, because a single user can use a different IP address for each request (the request might come from a different proxy). Also, multiple users...
  5. Replies
    6
    Views
    4,555

    You must cast the 'from' value to int. ...

    You must cast the 'from' value to int.

    $s->bindValue(':start_with', (int)$_POST['from'], PDO::PARAM_INT);

    ps. You could replace the foreach with the more efficient fetchAll(PDO::FETCH_ASSOC)
  6. Replies
    6
    Views
    4,555

    You could use the PDO::FETCH_ASSOC...

    You could use the PDO::FETCH_ASSOC fetch style.

    Try putting the following after the $s->execute();


    $result = $s->fetchAll(PDO::FETCH_ASSOC);
  7. Replies
    3
    Views
    1,677

    The ungreedy modifier is the upper case U...

    The ungreedy modifier is the upper case U character.
  8. Replies
    5
    Views
    3,496

    I think that the error message is pretty clear....

    I think that the error message is pretty clear. There is no id field in table users.
  9. You are right but it is not difficult to...

    You are right but it is not difficult to implement some words' exceptions/fixes to the code.
  10. You could use preg_replace_callback to replace...

    You could use preg_replace_callback to replace only the wholly uppercase words.

    $string = preg_replace_callback('#\b([A-Z]+)\b#s', function($m) { return ucwords(strtolower($m[1])); }, $string);
  11. Replies
    2
    Views
    2,464

    Use swiftmailer. It is a very well-written...

    Use swiftmailer. It is a very well-written library with many features and great documentation.
  12. Thread: good code or bad

    by gvre
    Replies
    15
    Views
    2,735

    As I can see, your html and php code are in the...

    As I can see, your html and php code are in the same file. You should move all classes to their own files (e.g. user.php for class User).

    Globals are the easy way, but not the right way. Each...
  13. Thread: good code or bad

    by gvre
    Replies
    15
    Views
    2,735

    Actually, this code is not good for many reasons...

    Actually, this code is not good for many reasons (some of them are the following):

    - No html-php separation
    - You rely on globals for db connection
    - Echo usage inside the class methods
    - You...
  14. Replies
    15
    Views
    5,098

    Try this (not very well-tested) code. ...

    Try this (not very well-tested) code.


    function GetImages($dir, $basedir = null, array $extensions, $recursive = true)
    {
    $dir = rtrim($dir, '/') . '/';
    $images = array();

    ...
  15. Replies
    15
    Views
    5,098

    You should check the log files for error...

    You should check the log files for error messages.

    Btw, I made some small changes to the code.


    function GetImages($dir, array $extensions, $prefix = '')
    {
    $images = array();
    ...
  16. Replies
    15
    Views
    5,098

    RecursiveDirectoryIterator throws an...

    RecursiveDirectoryIterator throws an UnexpectedValueException if the path cannot be found or is not a directory. I suppose that the dir was not found when you added /trophy. Try this


    function...
  17. Replies
    15
    Views
    5,098

    Did you wrap the code in tags?

    Did you wrap the code in <?php ?> tags?
  18. Replies
    15
    Views
    5,098

    You don't need to change the $dir and $prefix if...

    You don't need to change the $dir and $prefix if the script is inside the wordpress root dir. The $images contains an array with all images' paths. You should add a foreach construct to iterate over...
  19. Replies
    15
    Views
    5,098

    function GetImages($dir, array $extensions,...

    function GetImages($dir, array $extensions, $prefix = "")
    {
    $images = array();
    $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir,...
  20. Replies
    15
    Views
    5,098

    Could you post your code and the path of the...

    Could you post your code and the path of the script?
  21. Replies
    6
    Views
    1,813

    Why don't you use NogDog's answer?

    Why don't you use NogDog's answer?
  22. Replies
    3
    Views
    1,010

    One query is better. You should always try to...

    One query is better. You should always try to reduce the number of SQL queries.
  23. Replies
    5
    Views
    3,216

    I don't now. I use the oldschool technique :) You...

    I don't now. I use the oldschool technique :) You may find a solution in one of the following pages.

    http://nicolasgallagher.com/micro-clearfix-hack/...
  24. Replies
    5
    Views
    3,216

    You should uncomment the clearfix div.

    You should uncomment the clearfix div.
  25. Thread: Arrays

    by gvre
    Replies
    2
    Views
    922

    $array1 = array(1, 2); $array2 = array(3, 4, 5);...

    $array1 = array(1, 2);
    $array2 = array(3, 4, 5);
    $final = array();
    foreach($array1 as $a1)
    foreach($array2 as $a2)
    $final[] = $a1 . $a2;
    print_r($final);
Results 1 to 25 of 88
Page 1 of 4 1 2 3 4
HTML5 Development Center



Recent Articles