php-windows Digest 27 Jan 2008 06:04:03 -0000 Issue 3414
Topics (messages 28757 through 28759):
help needed
28757 by: Peter D
28758 by: Stut
Re: How Do I Display a table description (PHP/MySQL question)
28759 by: Aaron Schiff
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi everyone!
I hope my request can be answered by someone. I'm new to PHP and whole
server issue!
I'm trying to test my PHP scripts locally on my PC. It seems
Apache/PHP/MySql and PhpMyAdmin are working correctly when I test simple php
files. Here's the problem :
I have two files:
"display_scores.php" and "db.php".
Here's the "display_scores.php"
----------------------------------------------------
<?php
include("db.php");
$table = 'high_score';
mysql_connect ($host, $user, $pass);
mysql_select_db ($database);
$result = mysql_query ( "SELECT * FROM 'high_score' ORDER BY score DESC
LIMIT 10");
$row = mysql_fetch_array($result);
extract($row);
echo "$player : $score ";
?>
----------------------------------------------------
and here's the "db.php" file:
------------------------------------------------------
<?php
$host = '127.0.0.1.:3306';
$user = 'root';
$pass = '1234';
$database = 'cartoon_smart_courses';
$table = 'high_score';
-----------------------------------------------------
When I test the "display_scores.php" on my browser, following messages show:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in
D:\SERVER\Cartoon_smart_series\flash_php_mysql_part1\display_scores.php on
line 12
Warning: extract() [function.extract]: First argument should be an array in
D:\SERVER\Cartoon_smart_series\flash_php_mysql_part1\display_scores.php on
line 13
---------------------------------
Where is the problem? Can someone help? Please?
--- End Message ---
--- Begin Message ---
Peter D wrote:
$result = mysql_query ( "SELECT * FROM 'high_score' ORDER BY score DESC
LIMIT 10");
Single quotes are invalid around entity names, you should be using
backticks to surround high_score.
You really should be checking the return value from mysql_query. It
tells you if an error occurred, and you can then use mysql_error to get
more details.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Didn't even realize I sent it to you directly...I'm sending it to the list
to archive it.
Here's what I said:
For displaying table comments:
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =
'your-table-name'
For displaying column comments:
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA =
'your-table-name'
On Jan 6, 2008 6:35 PM, none <[EMAIL PROTECTED]> wrote:
> Thanks for all the responses sent directly to me. I have it working now.
>
> ""none"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > How do you display a table description that is part of a MySQL (v. 5.0)
> > database via PHP (v. 5.2) web page?
> >
> > Thanks
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
ts2do
--- End Message ---