help needed

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?

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Peter D [ Fr, 25 Januar 2008 15:59 ] [ ID #1916513 ]

Re: help needed

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/

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stut [ Fr, 25 Januar 2008 16:20 ] [ ID #1916514 ]
PHP » gmane.comp.php.windows » help needed

Vorheriges Thema: How Do I Display a table description (PHP/MySQL question)
Nächstes Thema: Erreor message in Apache when using PHP 5.2.5