How to connection string into a dictionary in php code and vice versa

Reply

Join Date: Oct 2008
Posts: 18
Reputation: r_sathya is an unknown quantity at this point 
Solved Threads: 0
r_sathya r_sathya is offline Offline
Newbie Poster

How to connection string into a dictionary in php code and vice versa

 
0
  #1
Oct 31st, 2008
hai i am sathiya,
i had confussion about this program...................
please give suitable solution for this program............



a. Write a php function to accept server, database name, Username Password and create a Database connection string of the
"server=myserver;dbname=mydbname;username=myuser;passwd=mypasswd"

b. Write a function to convert the connection string into a dictionary

c. Write a function convert the connection dictionary into connection string.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: How to connection string into a dictionary in php code and vice versa

 
0
  #2
Oct 31st, 2008
Wow, that's kind of confusing. What do you mean by a dictionary?

No one here will write your code for you but we will point you in the right direction.

Here is a good place to start (you'll want to make sure you look at the "POST & GET" section).

As for connecting the info together when you have it, it's as simple as:
  1. $connected_string = "server=$myserver;dbname=$mydbname;username=$myuser;passwd=$mypasswd";
  2. //or alternatively:
  3. $connected_string = 'server='.$myserver.';dbname='.$mydbname.';username='.$myuser.';passwd='.$mypasswd;
  4. //where the info you want is held in the variables $myserver, $mydbname, etc.
"If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC