Hi everyone, 

FIRST THANKX FOR ANY HELP !!
and THANKX FOR READING :)

I'm a reall newbie on PHP and i'm build a php app to connect into a mysql
database.. but i cannot select the database

i have build the database, and created a user
with :

create database mydatabase;
use mydatabase;
create tb_users ( userid varchar(20), userpassword varchar(20 );

grant select, update, insert, delete on mydatabase.* to [EMAIL PROTECTED]
IDENTIFIED BY "mypassword";

then flush priveliges...
I tested the user on mysql and it work correcly for my the pretended database


NOTES:
O.S. Linux
Mysql : compiled the most recent stable 4.0.12
Php was compiled by SuSe on SuSe 8.0
Php is connected into mysql via socks (configured on /etc/php.ini)

to test the set up i have used the php.net manual example to connect into the
mysql database i manage to connect into mysql but i cannot select the database
can this be my mistake or can it be a software problem ?

here is the php programa

<?php
    $DB_HOST = "localhost";
    $DB_USER = "myuser";
    $DB_PASSWORD = "mypassword";
    $DB_NAME = "mydatabase";


    /* Connecting, selecting database */
    $link = mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASSWORD") or   
die("Could not connect<br>");
    print "Connected successfully<br>";
    mysql_select_db("$DB_NAME", $link) or die("Could not select
database<br>");    

    /* Performing SQL query */
    $query = "SELECT * FROM tb_users";
    $result = mysql_query($query) or die("Query failed<br>");

    /* Printing results in HTML */
    print "<table>\n";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        print "\t<tr>\n";
        foreach ($line as $col_value) {
            print "\t\t<td>$col_value</td>\n";
        }
        print "\t</tr>\n";
    }
    print "</table>\n";

    /* Free resultset */
    mysql_free_result($result);

    /* Closing connection */
    mysql_close($link);
?>

Stay Happy
Miguel Angelo
------- End of Forwarded Message -------




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to