Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. First regex for matching:

     

    $pattern = '~^@[^@]+\n@~m';
    

     

    For the second search, the pattern I already gave you for it will work. Keep in mind that the regex I am writing is very loose and is meant to get you going, not as an finite answer.

  2. okay, so i decided to change the avatar on a completely new account, what i found is that 83px margin left and top is a set value, it does not appear to have anything to do with the calculations but something else :/

     

    Sorry for this slight bother

     

    I know it has nothing to do with the php calculations, I've been trying to steer you in the right direction for a couple of posts now.

  3. You have been given several answers to this issue already. Not much more anyone can do for you. Apply the advice that was given to you and if you are still having issues with the code after you have attempted to implement the logic given to you, post back with all relevant code and your issue.

  4. You still have failed to provide us with the actual problem that you are having. All we can do is assume that the issue is the picture position, in which case the problem is the "margin-top" and "margin-left" properties in the CSS.

  5. The error should be self explanatory, invalid syntax is what is causing the error. Do not wrap the entire values block in quotes. It should read:

     

    INSERT INTO `imloop` ( image1, image2, image3, image4, image5, image6) VALUES ('1352838703-1.jpg', '1352838703-2.jpg', '1352838703-4.jpg', '1352838703-5.jpg', '1352838703-6.jpg', '1352838703-5.jpg')
    

  6. either heredoc or end php parsing with a closing ?> tag and begin php parsing after the form.

    Also, instead of using so many <p> </p>, apply some CSS to the form and use a margin

     

    Edit: Also in this line:

     

    <input name="name" type="text" id="name" maxlength="30" value="<?php echo $MM_Username; ?>">
    

     

    php tags are only needed if you are not already parsing php, which in this case you are.

  7. First, as-is the apostrophe used in images's alternative will break the string and give unexpected results, escape the apostrophe with a backslash \'

    I will do a couple of the regex patterns to give you the idea.

     

    $text = 'Just for test ^ sad as dasd ^sa da da sa
    "some text":http://google.com
    "متن(UTF-8 string)":http://google.com
    
    
    *.sometext
    * sometext
    
    
    #.some text
    # some text
    
    
    some text !http://static.php.ne...es/php.gif(This is image\'s Alternative)!
    @
    String mystr = "test@example.com"
    String mystr = test@@@@::example.com;
    @
    *some text*
    _some text_
    -some text-
    
    
    Other Image !http://static.php.net/images/php.gif(This is image\'s Alternative Text)!';
    $patterns = array();
    $patterns[] = '~"([^"]+)":(http://[^\n]+)~i';
    $patterns[] = '~!(http://[^(]+)\(([a-z\' ]+)\)!~i';
    $patterns[] = '~\*(?:\.|\s)?([a-z ]+)$~im';
    $patterns[] = '~_([^_]+)_~i';
    $replace = array();
    $replace[] = '<a href=\'$2\'>$1</a>';
    $replace[] = '<img src=\'$3\' alt=\'$4\'/>';
    $replace[] = '<li>$5</li>';
    $replace[] = '<i>$6</i>';
    echo preg_replace($patterns, $replace, $text);
    

  8. Using the advice that Jesi initially gave you, and with a little cleanup added, this code should work for you:

     

    $month = array("jan" => "Jan", "feb" => "Feb", "mar" => "Mar", "apr" => "Apr", "may" => "May", "jun" => "Jun", "jul" => "Jul", "aug" => "Aug", "sep" => "Sep", "oct" => "Oct", "nov" => "Nov", "dec" => "Dec");
    $default = "jan";
    $menu = generate_menu("month", $month, $default);
    function generate_menu($name, $month, $default="")
    {
    $select = "<select name='$name'>";
    foreach($month as $value => $label)
    {
    $select .= "<option ";
    if ($value == $default)
    $select .= "selected='selected' ";
    $select .= "value='$value'>$label</option>";
    }
    $select .= "</select>";
    return $select;
    }
    echo $menu;
    

     

    Also, the function returned $select from the initial post.

  9. I understand the parameters, but are all of these sub-strings being searched for in one string or in several strings? I cannot create a regex for you unless I am given a sample string to work with. An example would be:

     

    $text = "this is a sample string with text link:http://site.com and other stuff";
    

     

    In the example you provided:

     

    $text = preg_replace("/.**{2}(.+?)\*{2}.*/", "<b>$1</b>", $text);
    

     

    What is the string value of $text initially?

  10. Most likely $webpage carries an invalid link that cannot be used. Hard to tell without seeing all of the relevant code. Also it doesn't seem like there is a point to displaying an empty string, shorten the condition to:

     

    <?php
    if ($webpage != null)
    {
     echo "<div><a href='<?php echo $webpage; ?>'>Visit Website!</a></div>";
    }
    ?>
    

  11. This topic isn't about validation, it's about dropdowns. Next you'll be expanding it into a debate about how inefficient code contributes to global warming. Now there's a thought.

     

    My first post answered his question. I was trying to help him further. Apparently that is frowned upon here.

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