SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Troublesome connection string

    Hi
    I have created a user named bob with password bob
    Using this $conn = mysql_connect("localhost", "bob", "bob"); I can
    connect and create a table but if I construct a string from a form on html page
    $connstr which is "localhost", "bob", "bob"
    and use $conn = mysql_connect($connstr) I get this error

    Could not connect: Unknown MySQL server host '"localhost", "bob", "bob"'
    What's going on?

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the function mysql_connect() expects 3 parameters

    mysql_connect(param1, param2, param3)

    your only sending it 1 paramter
    mysql_connect(param1)

    i see what your trying to do, but php doesnt work that way.
    theres ways you could do it like that, but it sounds like your new to php, in which case i would just recomend you do it the normal way, to keep it simple.


    just have your html form send 3 diff fields, and place them in individually, seperated by commas.

  3. #3
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Hi You are right about me being a php novice but I am learning fast.Your solution worked and I am much indebted.
    Regards


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •