By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

PHP Error message: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20

P: n/a
Error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/jplane/certcent/phpweb/quiz/index.php on line
21

PHP CODE:

session_start();
require_once('inc/db_config.inc.php');
$conn = db_connect();

if (isset($HTTP_SESSION_VARS['scoreboard'])) {
echo '<p id="hornav"><a href="results.php">View Results Sheet</a></
p>';
}
?>
<h2>Welcome to the Test Zone</h2>
<h3>Please select a subject area and the number of questions you wish
to answer.</h3>
<ol id="numbered">
<?php
$sqlsu = "SELECT * FROM subjects ORDER BY ID";
line 20 $ressu = mysql_query($sqlsu, $conn);
line 21 if (mysql_num_rows($ressu)) {

Jun 15 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jun 15, 7:27 pm, "techjoh...@gmail.com" <techjoh...@gmail.com>
wrote:
Error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/jplane/certcent/phpweb/quiz/index.php on line
21

PHP CODE:

session_start();
require_once('inc/db_config.inc.php');
$conn = db_connect();

if (isset($HTTP_SESSION_VARS['scoreboard'])) {
echo '<p id="hornav"><a href="results.php">View Results Sheet</a></
p>';}

?>
<h2>Welcome to the Test Zone</h2>
<h3>Please select a subject area and the number of questions you wish
to answer.</h3>
<ol id="numbered">
<?php
$sqlsu = "SELECT * FROM subjects ORDER BY ID";
line 20 $ressu = mysql_query($sqlsu, $conn);
line 21 if (mysql_num_rows($ressu)) {
The message means you aren't connected to the database -- or, more
specifically, that $conn is not a valid connection resource.

What's in inc/db_config.db.php ?

Jun 16 '07 #2

P: n/a
te********@gmail.com wrote:
Error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/jplane/certcent/phpweb/quiz/index.php on line
21

PHP CODE:

session_start();
require_once('inc/db_config.inc.php');
$conn = db_connect();

if (isset($HTTP_SESSION_VARS['scoreboard'])) {
echo '<p id="hornav"><a href="results.php">View Results Sheet</a></
p>';
}
?>
<h2>Welcome to the Test Zone</h2>
<h3>Please select a subject area and the number of questions you wish
to answer.</h3>
<ol id="numbered">
<?php
$sqlsu = "SELECT * FROM subjects ORDER BY ID";
line 20 $ressu = mysql_query($sqlsu, $conn);
line 21 if (mysql_num_rows($ressu)) {
Check the result from mysql_query. You'll find it returned false,
probably because of a proboem with the select statement.

Also see mysql_error() in the doc to help you diagnose your error.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.