Website by Leandro-Iron

Page 3 of 9 FirstFirst 123456789 LastLast
Results 31 to 45 of 122
  1. #31
    <NULL> Acnathon is offline
    MemberRank
    Apr 2007 Join Date
    RaGEZONELocation
    463Posts

    Re: Website by Leandro-Iron

    Quote Originally Posted by SheenBR View Post
    no. the mssql_connection will be executed always.

    I remembered here, you can always use the persitent database connection methods =p

    mysql_pconnect()
    mssql_pconnect()
    odbc_pconnect()

    MORE INFO HERE

    Code:
    <?
    
    class database
    {
        public static $connected = false;
        
        static function connect_db()
        {
            if(!self::$connected)
            {
                $link = odbc_pconnect("DRIVER={SQL Server}; SERVER=.\SQLEXPRESS; DATABASE=PTEmu;", "sa","123456");
                if($link)
                    self::$connected = true;
            }
            echo self::$connected;
        }
    }
    class use_db extends database
    {
        function __construct()
        {
            if(!parent::$connected)
            {
                echo "database not connected, connecting...";
                parent::connect_db();
                echo "database methods";
            }
            else
            {
                echo "database connected, methods here";
            }
        }
    }
    
    $v = new use_db;
    
    ?>
    This class isnot very fancy, I made it now, but its good for you to learn inheritance in php, which is very important.

    its been a while that I stopped with PHP, $connected will always be false everytime you refresh the page, so it'll always show the "database not connected" message.

    My goal is force you to learn PHP or whichever language. I will not provide a "ready to go code".

    With non-static methods I have to create a class instance like:
    $instance = new myClass;
    $instance->myNonStaticFunc();

    With static methods the need to create a class instance is gone.
    myClass::myStaticMethod();
    Maybe silly question but it matters if i use ajax to load in pages instead of using iframes?
    I mean it will affect somehow the connection?

  2. #32
    Account Upgraded | Title Enabled! xXxAxXx is offline
    MemberRank
    Apr 2011 Join Date
    UndergroudLocation
    420Posts

    Re: Website by Leandro-Iron

    yes i will learn but cant we all make this now to work better and i will learn on something else :P

  3. #33
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: Website by Leandro-Iron

    @Acnathon

    not sure. but ajax is prettier tho =p

  4. #34
    <NULL> Acnathon is offline
    MemberRank
    Apr 2007 Join Date
    RaGEZONELocation
    463Posts

    Re: Website by Leandro-Iron

    Okay thx ;) ill try it and post if i get it work ^^

    Edit:

    Just tryed with this method:

    1. Made the class with your example changed to connect via mssql_pconnect.
    PHP Code:
    class database
    {
        public static 
    $connected false;
        
        static function 
    connect_db()
        {
            if(!
    self::$connected)
            {
                
    $link mssql_pconnect('127.0.0.1''sa','mypassword');
                if(
    $link)
                    
    self::$connected true;
            }
            echo 
    self::$connected;
        }
    }
    class 
    use_db extends database
    {
        function 
    __construct()
        {
            if(!
    parent::$connected)
            {
                echo 
    "database not connected, connecting...";
                
    parent::connect_db();
                echo 
    "database methods";
            }
            else
            {
                echo 
    "database connected, methods here";
            }
        }

    2. Included the file in my index.php and caled the class by:

    PHP Code:
    $connect = new use_db
    It works on the index but if i call in another page with ajax it cant connect. so i need to include the file (with the class) in all my subpages (that needs sql connection).

    Correct me if im wrong or missing something. ><
    Last edited by Acnathon; 20-11-11 at 02:45 AM.

  5. #35
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: Website by Leandro-Iron

    just include the class database and inherit it in your the class that will execute sql queries. you can actually remove the if case, since everytime it will be triggered.
    I was mixing C# with PHP when I did this.
    Every time your script ends, its like everything is flushered, if you execute your page again, it'll be like you're executing it for the very first time.
    Just the persistent connection will solve your problem of connecting everytime to the database.
    this example I gave about inheritance is for those who want to start programmimg with php.
    Class inheritance and POO are very cool feature which will make database connections very easy with a friendly interface.
    This class example I gave, its not to be used with this site. Its just an example of how I would make a script to connect to the database.

  6. #36
    <NULL> Acnathon is offline
    MemberRank
    Apr 2007 Join Date
    RaGEZONELocation
    463Posts

    Re: Website by Leandro-Iron

    Okay. got it :) and yesss! me i want to learn php so thanks for the info.

  7. #37
    Account Upgraded | Title Enabled! xXxAxXx is offline
    MemberRank
    Apr 2011 Join Date
    UndergroudLocation
    420Posts

    Re: Website by Leandro-Iron

    I have a quick question.How can we make when adding an banner and we insert no link for the banner make it unclickable?

  8. #38
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: Website by Leandro-Iron

    Quick answer for quick question: (although I didnt understand what you want)
    Let me google that for you

    I'm not liking your behavior here. I suggest you to start doing thins on your own.
    using google will not kill you. I've seen here that you like things ready in your hands.. You wont get'em from me.

  9. #39
    Account Upgraded | Title Enabled! xXxAxXx is offline
    MemberRank
    Apr 2011 Join Date
    UndergroudLocation
    420Posts

    Re: Website by Leandro-Iron

    Quote Originally Posted by SheenBR View Post
    Quick answer for quick question: (although I didnt understand what you want)
    Let me google that for you

    I'm not liking your behavior here. I suggest you to start doing thins on your own.
    using google will not kill you. I've seen here that you like things ready in your hands.. You wont get'em from me.
    Ye i know i am a lazy ars :P/I was talking about the thing that when you add a banner and you dont give him a link when you click the banner in the site it opens the site again.I want to make the banner unclickable if i dont add a link when i add the banner.What you shown me on google its easy.That i would had done if it was.
    Thanks for the palmface :)

  10. #40
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: Website by Leandro-Iron

    an image is only clickable if you put it inside a <a href> tag.

    It could be easily done setting the onclick event to execute a void(0); command.

  11. #41
    <NULL> Acnathon is offline
    MemberRank
    Apr 2007 Join Date
    RaGEZONELocation
    463Posts

    Re: Website by Leandro-Iron

    Search in index.php this:
    PHP Code:
    <div class="jqb_slides">
                    <
    div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
                     <
    a href="'.$rbanner['LinkBan'].'" target="_blank">
                      <
    img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
                     </
    a>
                    </
    div
    and change it to this:
    PHP Code:
    <div class="jqb_slides">
                    <
    div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
                      <
    img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
                    </
    div
    This will completely remove link function from the slider.

  12. #42
    Account Upgraded | Title Enabled! xXxAxXx is offline
    MemberRank
    Apr 2011 Join Date
    UndergroudLocation
    420Posts

    Re: Website by Leandro-Iron

    Quote Originally Posted by Acnathon View Post
    Search in index.php this:
    PHP Code:
    <div class="jqb_slides">
                    <
    div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
                     <
    a href="'.$rbanner['LinkBan'].'" target="_blank">
                      <
    img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
                     </
    a>
                    </
    div
    and change it to this:
    PHP Code:
    <div class="jqb_slides">
                    <
    div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
                      <
    img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
                    </
    div
    This will completely remove link function from the slider.
    Thanks that is good.Now i will try to seach and se how to give it a value like in php with "else" so when it has a link to work and when not to work.

  13. #43
    Enthusiast Windows7 is offline
    MemberRank
    Oct 2011 Join Date
    39Posts

    Re: Website by Leandro-Iron

    i have more 3 errors in usercp.
    Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'CabalCash.dbo.Bank'. (severity 16) in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123

    Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123

    Warning: mssql_fetch_row(): supplied argument is not a valid MS SQL-result resource in C:\xampp\htdocs\cabalonline\sisGeral.php on line 124
    i will try to fix them asap ,but sure if some1 solved already them ill be glad to hear how ?ty
    Last edited by Yamachi; 21-11-11 at 10:23 PM.

  14. #44
    <NULL> Acnathon is offline
    MemberRank
    Apr 2007 Join Date
    RaGEZONELocation
    463Posts

    Re: Website by Leandro-Iron

    Edit: I didnt checked enough close for first time. So theres a missconfiguration in your config file.
    That db should be CashShop.

    PHP Code:
    define('DB_CCA','CABALCASH');
    define('DB_CSH','CASHSHOP'); 
    I think on your config the DB_CSH is defined as CabalCash instead of CashShop.
    Last edited by Yamachi; 24-11-11 at 06:16 PM.

  15. #45
    Enthusiast Windows7 is offline
    MemberRank
    Oct 2011 Join Date
    39Posts

    Re: Website by Leandro-Iron

    Quote Originally Posted by Acnathon View Post
    Edit: I didnt checked enough close for first time. So theres a missconfiguration in your config file.
    That db should be CashShop.

    PHP Code:
    define('DB_CCA','CABALCASH');
    define('DB_CSH','CASHSHOP'); 
    I think on your config the DB_CSH is defined as CabalCash instead of CashShop.
    $ck_cash = mssql_query("SELECT Alz FROM ".DB_csh.".dbo.Bank WHERE UserNum='".$IdxAcc."'");

    to replace DB_CSH with ?
    thanks in advice

    EDIT : I CHANGED AS YOU SAID AND STILL THE SAME ERROR ,look :


    W
    arning: mssql_query() [function.mssql-query]: message: Invalid object name 'CASHSHOP.dbo.Bank'. (severity 16) in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123



Advertisement