Announcement

Collapse
No announcement yet.

Dude about sc_change_connection()

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dude about sc_change_connection()

    Hi, guys I want that call a connection_string since code as follow:

    $connection="host={name_host} dbname={dataset[0][6]} user={dataset[0][4]} password={dataset[0][5]}";This way is wrong, how can do it alright?

    I saved these fields because I try connect with new connection_string thus

    sc_change_connection("conn_ant",$connection);

  • #2
    Re: Dude about sc_change_connection()

    i have a same problem too.
    doy you solve this problem..?
    Please send ask information about.
    Gretting fom Colombia.

    Comment


    • #3
      Re: Dude about sc_change_connection()

      you could try to split the string in parts and use concatenation like ".{myfield}." something
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Hi gsmchristian ,
        You can change the database connection using scriptcase. Please follow these steps:

        #1 Example to execute a SQL query using other connection (ONLY for this SQL query)

        PHP Code:
        sc_lookup(rs"select field from table"'MyNewConnection'); 
        #2 Example to change connection (Applies to all your SQL querys and All Applications)

        PHP Code:
        sc_change_connection "MyOldConnection",'MyNewConnection'); 
        So if you want to switch a connection depending of the user you can use this script:

        PHP Code:
        if($user=='jonh'){
             
        sc_change_connection "MyOldConnection",'MyNewConnection');


        Note: When using sc_change_connection you need to reload the page or redir to another application to see the connection changes.
        Note 2: Your connection NAME is the name that you define in ScriptCase Database>NewConnection
        Best Regards
        Hiram BQ

        Comment

        Working...
        X