SitePoint Sponsor

User Tag List

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

    Question Need help with MySQL, i'm a complete NOOB!

    Hey Guys,

    I recently got the Build Your Own Database Driven Website with PHP and MySQL. I read all the installation instructions, installed PHP 5.0 on windows XP pro. MySQL 4.0 aswell.

    I wrote a load of code, but it either returns a blank page when I put: @$dbcnx = @mysql_connect
    or it says:

    Fatal error: Call to undefined function mysql_connect() in c:\program files\apache group\Apache\htdocs\php\jokelist.php on line 9
    when I take out the '@'.

    What should I do, should I change config settings? whats wrong? HELP!

    Thanks for your time,

    Regards, PHPMANIAC

  2. #2
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure how the book does it, but I would do it like this:

    PHP Code:
    $dbc mysql_connect("localhost""username""password")or die("Could not connect to the database: " mysql_error());
    mysql_select_db("database");
    [...]
    $Query "";
    $Result mysql_query($Query$dbc); 
    Though I usually don't even assign the connection to a var as I only have one connection open on my site.
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would you do it then? (if you don't assign to vars)

    Thanks for your help aswell I will try it out now.

    Regards, PHPManiac


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
  •