|
Posted by Ivan Omelchenko 608308824 on 10/16/79 11:19
21novembre@gmail.com пишет:
> Hi all,
>
> I'm working on my first php+mysql program.
> I have a mysqld running and there's a DB named "example" with a table
> "tbl". Here it is:
> --------------
> mysql> use example;
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
>
> Database changed
> mysql> select * from tbl;
> +------+----------+----------+----------------+
> | idx | UserName | LastName | FreeText |
> +------+----------+----------+----------------+
> | 2 | Rafi | Ton | Just a test |
> | 1 | li | ken | Just two tests |
> | 3 | ghjgj | jhn | Jus tests |
> +------+----------+----------+----------------+
> 3 rows in set (0.00 sec)
> ---------------
>
> When I tried to apply the following sample program, strange result came
> to me. Let me show you the script.
> ---------------
> <html>
> <head><title>Web Database Sample Index</title>
> </head>
> <body bgcolor=#ffffff>
> <h2>Data from tbl</h2>
>
> <?
> mysql_connect() or die ("Problem connecting to DataBase");
> $query = "select * from tbl";
> $result = mysql_db_query("example", $query);
> I ran this php page in IE and only to get "No data." as the result,
> while I was expecting a list of my table contents. I cannot find the
> error I made, actually I almost copied this script from some book.
> Please help me to check it.
> Any suggestion would be appreciated.
>
mysql_db_query
Send a MySQL query (PHP 3, PHP 4 , PHP 5)
resource mysql_db_query ( string database, string query [, resource
link_identifier ] )
Note:
This function has been deprecated since PHP 4.0.6. Do not use this
function. Use mysql_select_db() and mysql_query() instead.
[Back to original message]
|