•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 403,367 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,336 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1422 | Replies: 7
![]() |
•
•
Join Date: Feb 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#1
Feb 29th, 2008
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#2
Feb 29th, 2008
You have an error in your query. It isn't returning a valid resource. Print out $query, execute it in phpmyadmin/mysql. Then you ll know what's the error. You can also give die(mysql_error());
ie.,
ie.,
$result=mysql_query($query,$conn) or die(mysql_error()); Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Feb 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /
#3
Feb 29th, 2008
•
•
•
•
You have an error in your query. It isn't returning a valid resource. Print out $query, execute it in phpmyadmin/mysql. Then you ll know what's the error. You can also give die(mysql_error());
ie.,$result=mysql_query($query,$conn) or die(mysql_error());
Hi, I have found that error now. i called the $conn in the included file $connection.
I feel rather daft now, but at least i have a different error to play with now :o)
Thanks for the rapid response
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#4
Feb 29th, 2008
•
•
Join Date: Mar 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /
#5
Mar 28th, 2008
Hi nav33n,
coul you please help me.. im trying to display quiz questions from database but i get an the same error as desribed above . please see my code
the error points to line 3 and 7.
1 <?php
2 include("contentdb.php");
3 $display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
4 if (!$submit) {
echo "<form method=post action=$PHP_SELF>";
echo "<table border=0>";
7 while ($row = mysql_fetch_array($display)) {
Please please please... i desperately need your help.
Thank in advance
coul you please help me.. im trying to display quiz questions from database but i get an the same error as desribed above . please see my code
the error points to line 3 and 7.
1 <?php
2 include("contentdb.php");
3 $display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
4 if (!$submit) {
echo "<form method=post action=$PHP_SELF>";
echo "<table border=0>";
7 while ($row = mysql_fetch_array($display)) {
Please please please... i desperately need your help.
Thank in advance
Last edited by regreta : Mar 28th, 2008 at 5:26 am.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#6
Mar 28th, 2008
•
•
•
•
3 $display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Mar 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#7
Mar 28th, 2008
my table is defined in config. file
<?
$database = "quiz";
$hostname = "localhost";
$table = "quiz";
?>
as you see table is called quiz and it has data in it.
Shall I recall
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
to
$display = mysql_query("SELECT * FROM $quiz ORDER BY id",$db); ???
thanks
<?
$database = "quiz";
$hostname = "localhost";
$table = "quiz";
?>
as you see table is called quiz and it has data in it.
Shall I recall
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
to
$display = mysql_query("SELECT * FROM $quiz ORDER BY id",$db); ???
thanks
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 239
Re: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home
#8
Mar 28th, 2008
Nope. Just print out the query. ie., instead of
do,
Execute your query in phpmyadmin/mysql console and see what's the problem. Or, you can also try putting die statement after mysql_query to see the error.
•
•
•
•
$display = mysql_query("SELECT * FROM $table ORDER BY id",$db);
php Syntax (Toggle Plain Text)
$query="SELECT * FROM $table ORDER BY id"; echo $query; $display = mysql_query($query,$db);
php Syntax (Toggle Plain Text)
$display = mysql_query($query,$db) or die(mysql_error());
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- mysql_query(): supplied argument is not a valid MySQL-Link (PHP)
- Same problem (PHP)
- mysql errors, from submit.php and index.php (PHP)
- Can't connect error on createuser (PHP)
- database driven link layout (MySQL)
- php coding (PHP)
Other Threads in the PHP Forum
- Previous Thread: Email Validate function (small error)
- Next Thread: another question about securing and passing variables



You are welcome!
Linear Mode