SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Jan 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with connection to mysql database by PHP

    Hi. I'm totally new to this kind of things, but I bought a Kevin Yank Book about PHP/mysql and started to rock.

    I was doing everything on my own, but this stuff is just too hard for a beginner.
    I looked everywhere trying to solve it on my own, but sorry I must ask you.

    I have problem with connection to my sql database.

    Codes:

    Index.php :

    PHP Code:
    <?php
    $link 
    mysqli_connect('localhost''root''xxxxxx');
    if (!
    $link)
    {
       
    $output 'Nie można się połłączyć z serwerem bazy danych.';
       include 
    'output.html.php';
       exit();
    }

    if (!
    mysqli_set_charset($link'utf8'))
    {
       
    $output 'Nie można ustanowić kodowania dla połączenia z bazą danych.';
       include 
    'output.html.php';
       exit();
    }

    if (!
    mysqli_select_db($link'ijdb'))
    {
       
    $output 'Nie znaleziono bazy danych ijdb.';
       include 
    'output.html.php';
       exit();
    }

    $output 'Nawiązano połączenie z bazą danych.';
    include 
    'output.html.php';

    ?>

    and output.html.php :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
    <HEAD>
      <TITLE>Dane wynikowe PHP</TITLE>
      <meta http-equiv="content-type" content="text/html: charset=utf-8"/>
    </HEAD>
    <BODY>
    <P>
    <?php echo $output?>

    </P>
    </BODY>
    I think there are no errors in this code, but when I'm launching localhost/connect/index.php it's just nothing on the Firefox and on the IE it looks like this: Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\Index.php on line 2 ..... it's after 2 hours of thinking, first it was just error 500. Apache 2.2.16 is running, PHP 5.2.14 installed and mysql serwer on, checked it with Mysql administator.

    Can someone help me?

    //sorry for my English, I'm Polish but doing my best.
    Last edited by SpacePhoenix; Jan 7, 2011 at 01:28. Reason: placed php tags around the php code (+ edited out password)


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
  •