You are here: Re: How come I can't do this query with php script? « PHP Programming Language « IT news, forums, messages
Re: How come I can't do this query with php script?

Posted by Ivan Omelchenko 608308824 on 11/13/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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация