Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. They actually did pretty damn well.. raised nearly half a million dollars. Windows users are the least generous, with Linux users donating almost twice as much on average! Of course there was like three times as many donations from Windows users, but the law of averages never, ever fails.

     

    how much did the gents at humblebumble end up raising?

  2. Here is a post I made in another topic early last week.

     

    I think it depends on where your at in your coding experience, to give you an idea of where I'm coming from I'm over 50, messed around with stuff like debase II, debase III and debase III+ and paradox in the late 80's and very early 90's. Then dropped out of any kind of coding for twenty years. I think the brain changes when you use it different ways so when I started back last year to playing with code I had a very hard time.

     

    I first bought Ullman's php6mysql5 and went what? I then bought ullmans very beginner PHP book and learned from that and then went to Ullmans php6mysql5. I have several other books that I got and that come in handy for reference but time will tell. When you start building things that's when you really learn.

     

    If you can code a little I'd suggest Ullman's php6mysql5 or Welling & Thomson's Php & Mysql.  Also go to amazon and read the reviews.

     

    Now there are people that are on here that say they have never used a book to learn php, I have and idea it has to do with smarts, social environment and age(some generations just play with this more than others).

     

    I'm not a fanatic, guru or freak but these books teach the basics, are still good and you can use all of their code today.

     

    while you can find a few good books, they are getting more and more rare. Most of them are either outdated in their practices (teaching deprecated methods), or as Ignace said, they teach bad practices in general (SQL injectable strings etc.). My final word here is that the online PHP manual is your best bet to learn up to date PHP functions and practices. They have several tutorials geared towards beginner and intermediate to advanced level coders, as well as the in depth documentation.

  3. You are right Adam, and I did this on purpose. Most of the time when I write a regex for someone on here, I will either leave something out or will have something slightly off to intrigue the OP to find the issue and fix it himself. Perhaps i should add that into my signature like ManiacDan..  :P

     

    I do appreciate you spotting it and linking the OP to an informative doc on the subject. Hopefully he/she will learn from it.

     

    If you are intentionally giving out wrong answers, that makes you a troll, purposely trying to sabotage the community.  That is grounds for warning and ban.

     

    then ban me.

  4. You are right Adam, and I did this on purpose. Most of the time when I write a regex for someone on here, I will either leave something out or will have something slightly off to intrigue the OP to find the issue and fix it himself. Perhaps i should add that into my signature like ManiacDan..  :P

     

    I do appreciate you spotting it and linking the OP to an informative doc on the subject. Hopefully he/she will learn from it.

  5. you can use the AddCharset directive to set the specified extension to use the specified charset. (e.g)

     

    AddCharset UTF-8 .php

     

    basically, this will cause all the files with the targeted extension to send a Content-Type: header with the charset as whatever you specify.

     

    Note that this will change all of the .php files in all of the subdirectories stemming from the current location.

     

    You can also target one file (e.g.)

     

    <files "example.php">
    AddCharset UTF-8 .php
    </files>

  6. I have overlooked the fact (not sure how) that rewrite rules ignore query strings unless specified in a condition, as requinix pointed out. Really, his code should work for you, you will want to add a 301 redirect for google indexing:

     

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/09search_results\.php
    RewriteCond %{QUERY_STRING} ^search_KEYWORD=([a-z]+)&search_RANGE=([a-z]+)&o=([0-9]+)&search=[0-9]+$ [NC]
    RewriteRule ^/09search_results.php$ /%2/%1/%3 [R=301,NC, L]

  7. you are calling mysql_query() on a query resource.

     

    if (!mysql_query($result, $connection))
    {
    die('Error: ' . mysql_error() . "<br />" . $sql);
    }

     

    It should read something like this:

     

    $sql = "UPDATE pages SET name = '$name', content = '$content' WHERE id = $id"
    $result = mysql_query($sql);
    
    if (!$result)
    {
    die('Error: ' . mysql_error() . "<br />" . $sql);
    }

  8. there are a couple of ways that this can be done. My preferred method would be to take the full results set, and filter the values similar to the logic outline that you have laid out. Since the values are coming from a database as a few expected patterns, the regex can be a little looser.

     

     

    $str = $row['Part_No'];
    if(preg_match('~\b\d{4}-\d{3}\b~',$str))
    {
    // execute code for block 1
    }
    else if(preg_match("~\b\d{4}[A-Z](?:S|M|L|XL|XXL)\b~",$str))
    {
    //execute code for block 2
    }
    else if(preg_match("~\b\d{2}-\d{4}\b~"),$str)
    {
    //execute code for block 3
    }

     

    or you can self join using the clause REGEXP

     

    I'm sure there a several other ways, but I am not a mysql expert.

  9. from the specifics that you have given me, your pattern will look like this:

     

    $str = "3641-001 ( part & colour)";
    $pattern = "~\b\d{4}-\d{3}\b~";
    preg_match($pattern, $str, $ms);
    print_r($ms);

     

    results:

     

    3641-001

  10. Generally, if you can accomplish a task with simple string functions, then don't bother with a regex pattern.

     

    yes "livethedead" I agree with pika. While I do love regex, if there is a simple PHP functions solution to the problem, I would always go with that. Especially with large strings such as text files etc. They tend to be much more efficient than using a regular expression in most cases. It is only in special cases where the solution cannot be done with simple PHP functions or it would be way too much of an effort to do so where a regex should be used.

  11. I agree with requinix here, since this is a rather easy regular expression, I would suggest you study a little further on the subject. If you simply cannot figure this out, I will gladly help.

×
×
  • 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.