User Profile

Collapse

Profile Sidebar

Collapse
moazam
moazam
Last Activity: Mar 4 '09, 09:20 PM
Joined: Oct 5 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • moazam
    replied to PHP Regular Expression
    in PHP
    pwfisher you are great.. this worked excellent..
    Code:
    $text = preg_replace('#(?<![">])((http|ftp)s?://[^<>\s]+)#i', '<a href="\\0" target="_blank">\\0</a>', $text );
    Btw: There is no need of strip_tags :)

    Thanks
    See more | Go to post

    Leave a comment:


  • moazam
    replied to PHP Regular Expression
    in PHP
    I think you are not getting it.. these urls are in a document where I allow HTML however some users do not use html because they do not so they put 2 types URL mentioned above as well as email which i convert by using make_clickable_ urls() this function works 100% except it fails on this condition if following text found in a document

    This is long paragraph http://www.url.com, this is HTML url <a href="http://www.url.com">ht tp://www.url.com</a>...
    See more | Go to post

    Leave a comment:


  • moazam
    replied to PHP Regular Expression
    in PHP
    to convert following types of URLs

    http://www.url.com
    www.url.com
    bytme@bytes.com...
    See more | Go to post

    Leave a comment:


  • moazam
    started a topic PHP Regular Expression
    in PHP

    PHP Regular Expression

    Hello,
    I have clickable url function which convert text into clickable urls. All works fine except it fails in one condition. Here is the code

    Code:
    function make_clickable_urls($text) {
      $text = preg_replace("/(?<!<a href=\")((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\" target=\"_blank\">\\0</a>", $text );
      $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
    ...
    See more | Go to post

  • moazam
    replied to Sort categories in A-Z order
    in PHP
    here is the updated code.

    [PHP]
    include("connec t.php");
    $a = mysql_query("SE LECT S.subcat_name, S.subcat_id, count(F.id) AS total FROM files F RIGHT JOIN subcategory S USING(subcat_id ) WHERE S.cat_id=3 GROUP BY S.subcat_id");
    if($a) {
    if(mysql_num_ro ws($a)== 0 ) {
    echo 'No Result';
    }
    while($b = mysql_fetch_ass oc($a)) {
    echo "$b[subcat_id] - "....
    See more | Go to post

    Leave a comment:


  • moazam
    replied to Sort categories in A-Z order
    in PHP
    No one here to answer :(
    See more | Go to post

    Leave a comment:


  • moazam
    replied to Sort categories in A-Z order
    in PHP
    its very simple.. i just don't know to put category names under A-Z
    [PHP]
    $a = $mydb->query("SELEC T S.subcat_name, count(S.subcat_ id) AS total FROM subcategory S LEFT OUTER JOIN files F ON F.subcat_id=S.s ubcat_id GROUP BY F.subcat_id ORDER BY S.subcat_name ASC");

    while($b = mysql_fetch_ass oc($a)) {
    echo $b['subcat_name'] . ' (' . $b['total'] . ')<br />';
    }
    [/PHP]
    See more | Go to post

    Leave a comment:


  • moazam
    started a topic Sort categories in A-Z order
    in PHP

    Sort categories in A-Z order

    Hi,
    I am having a problem in sorting category, here is what i am doing..

    SELECT S.subcat_name, count(S.subcat_ id) AS total FROM subcategory S LEFT OUTER JOIN files F ON F.subcat_id=S.s ubcat_id GROUP BY F.subcat_id ORDER BY S.subcat_name ASC

    this SQL query will result like this

    Arts (1) (this is empty but still showing 1)
    Celebrity(5)

    I want to display result like this h...
    See more | Go to post

  • moazam
    replied to Mysql table crash
    in PHP
    thats what I am doing all the time
    See more | Go to post

    Leave a comment:


  • moazam
    replied to Mysql table crash
    in PHP
    Sorry for creating confusion.. here is the actual code
    Code:
    <?php
    function fill_online() {
    global $USER, GET_CONFIG;
    $query = "SELECT * FROM online WHERE `session_id` = '" . session_id() . "'";
    $result = mysql_query( $query );
    
    $ip = $_SERVER['REMOTE_ADDR'];
    $page = $_SERVER['REQUEST_URI'];
    $browser = $_SERVER['HTTP_USER_AGENT'];
    
    if( $result &&
    ...
    See more | Go to post

    Leave a comment:


  • moazam
    started a topic Mysql table crash
    in PHP

    Mysql table crash

    Hi,
    I am experiencing table crash problem in my sql.. I have insert code that cause the table crash.. see this code

    Code:
    $a = mysql_query("INSERT INTO online(session_id,odate) VALUES('$sess','NOW()')");
    @mysql_free_result($a);
    whats wrong with this? before this code I was simply executing mysql_query(... ) .. I thought this could be due to not releasing resultset.

    Any help will...
    See more | Go to post
No activity results to display
Show More
Working...