944,204 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 114990
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 7th, 2007
0

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

php Syntax (Toggle Plain Text)
  1. $user_id=$_POST['UserID'];
  2. $password=$_POST['Password'];
  3. $query="select * from Customer where
  4. UserID = '$user_id' and Password = '$password'";
  5. echo $query;
  6. $result=mysql_query($query) or die(mysql_error());

Check what $query prints. Execute the same in phpmyadmin.

oh, and please, next time you post your code, put it in [code] tags.
Last edited by nav33n; Dec 7th, 2007 at 8:54 am.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
May 13th, 2009
0

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

y need some help pls
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\xxxxxxxxx\index.php on line 7
No Template Selected


php Syntax (Toggle Plain Text)
  1. require("dbconfig.php");
  2. $con =mysql_connect ($db_host,$db_user,$db_pass) or die("Error connecting");
  3. mysql_select_db($db_name,$con);
  4. $tem="select dir from template where active='1'";
  5. $temr=mysql_query($tem,$con);
  6. $temn=mysql_num_rows($temr); line 7
  7. if($temn==0)
Last edited by peter_budo; May 15th, 2009 at 7:14 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
luqyan is offline Offline
1 posts
since May 2009
May 13th, 2009
0

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

Click to Expand / Collapse  Quote originally posted by luqyan ...
y need some help pls
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\xxxxxxxxx\index.php on line 7
No Template Selected


require("dbconfig.php");
$con =mysql_connect ($db_host,$db_user,$db_pass) or die("Error connecting");
mysql_select_db($db_name,$con);
$tem="select dir from template where active='1'";
$temr=mysql_query($tem,$con);
$temn=mysql_num_rows($temr); line 7
if($temn==0)
Excuse me. Did you not see the GIANT GLARING STICKIED POST that said "FAQ: Supplied argument not valid resource"? How about you go back and take a look at that.
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Oct 27th, 2009
-2
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
$rsEmpresa = mysql_query($SQLEmpresa,$conexion) or die(mysql_error());
//add the text shown in BOLD, this will atleast display what error you are having
Click to Expand / Collapse  Quote originally posted by janzaldo ...
when im test in my local machine i dont have any error but when im trying to test in web i have this error, the same DB, the same tables, the same data in both structures any idea????

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site244/fst/var/www/html/categoria.php on line 107


PHP Syntax (Toggle Plain Text)
  1. <?php
  2. require('conexion2.php');
  3. $SQLEmpresa= "SELECT empresa.cve_Empresa, Nombre, Direccion, pagina, telefono
  4. FROM empresa, empresa_Categoria
  5. WHERE ".$_GET['cve_Categoria']." = empresa_Categoria.cve_Categoria
  6. AND empresa_Categoria.cve_Empresa = empresa.cve_Empresa";
  7. $rsEmpresa = mysql_query($SQLEmpresa,$conexion);
  8. $reg = array();
  9. -->line 107 while ($reg = mysql_fetch_array($rsEmpresa))
  10. {
  11. $nombre = $reg["Nombre"];
  12. $direccion = $reg["Direccion"];
  13. $telefono = $reg["telefono"];
  14. $pagina = $reg["pagina"];
  15. $cve_Empresa = $reg["cve_Empresa"];
  16. ?>
Reputation Points: 8
Solved Threads: 0
Newbie Poster
chirag87 is offline Offline
1 posts
since Oct 2009
Oct 27th, 2009
-1
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
your query is failing for sure, echo the query and post it here.
or else execute the query directly inside the mysql and post ,if any error you got there
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 6th, 2009
-1
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
please help me...even i m getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\admin_loggedin_search_admin.php on line 35

[code=php]
<?php
$con = mysql_connect("localhost","root","");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("polling",$con);
$result = mysql_query("SELECT * FROM administrator WHERE $_POST[searchby] like '%$_POST[query]%'");
$found=0;
[LINE 35]while($sri=mysql_fetch_array($result))
{
if($sri['name']!="")
{
$found++;
echo "&nbsp;&nbsp;&nbsp;&nbsp; ".$sri['name']."->".$sri['username']."<br />";
}
}
if($found!=0)
{echo "Found ".$found." results!";}
mysql_close($con)
?>
[code/]
Reputation Points: 10
Solved Threads: 0
Light Poster
srinivasjinde is offline Offline
29 posts
since Nov 2009
Nov 7th, 2009
0
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
your query doesnt seems right to me... try this
PHP Syntax (Toggle Plain Text)
  1. $query = "SELECT * FROM administrator WHERE".$_POST[searchby]."like '%".$_POST[query]."%'";
  2. $result = mysql_query($query);

always try to create n store ur query in a separate variable.. helps in debugging.
Hope this helps... cheers!!

please help me...even i m getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\admin_loggedin_search_admin.php on line 35

PHP Syntax (Toggle Plain Text)
  1. <?php
  2. $con = mysql_connect("localhost","root","");
  3. if(!$con)
  4. {
  5. die('Could not connect: ' . mysql_error());
  6. }
  7. mysql_select_db("polling",$con);
  8. $result = mysql_query("SELECT * FROM administrator WHERE $_POST[searchby] like '%$_POST[query]%'");
  9. $found=0;
  10. [LINE 35]while($sri=mysql_fetch_array($result))
  11. {
  12. if($sri['name']!="")
  13. {
  14. $found++;
  15. echo "&nbsp;&nbsp;&nbsp;&nbsp; ".$sri['name']."->".$sri['username']."<br />";
  16. }
  17. }
  18. if($found!=0)
  19. {echo "Found ".$found." results!";}
  20. mysql_close($con)
  21. ?>
Last edited by venkat0904; Nov 7th, 2009 at 1:48 am.
Reputation Points: 13
Solved Threads: 21
Junior Poster
venkat0904 is offline Offline
186 posts
since Oct 2009
Nov 7th, 2009
0
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
@venkat
doesnt help...now i am getting an parse error in the line select * .......

are you sure of the syntax in the sql query??
one more thing....$_post[query] ... returns the string entered in a search box named query.....
Reputation Points: 10
Solved Threads: 0
Light Poster
srinivasjinde is offline Offline
29 posts
since Nov 2009
Nov 7th, 2009
0
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
ohhh m so sorry... didn't include the spaces.. my bad.
just add a space after "where" clause and before "like".
should be--
PHP Syntax (Toggle Plain Text)
  1. $query = "SELECT * FROM administrator WHERE ".$_POST[searchby]." like '%".$_POST[query]."%'";

n do make sure that ur "searchby" parameter feeds the column name exactly as in ur table..(upper n lower case are considered different)

try this n lemme know..
cheers!!

@venkat
doesnt help...now i am getting an parse error in the line select * .......

are you sure of the syntax in the sql query??
one more thing....$_post[query] ... returns the string entered in a search box named query.....
Last edited by venkat0904; Nov 7th, 2009 at 3:29 am.
Reputation Points: 13
Solved Threads: 21
Junior Poster
venkat0904 is offline Offline
186 posts
since Oct 2009
Nov 7th, 2009
0
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
The prob. is still there....anyway the search functionality is working well....the only thing is that the warning msg doesnt look good....and when i do the first search by entering a query....i get the search results and the error msg disappears...
Reputation Points: 10
Solved Threads: 0
Light Poster
srinivasjinde is offline Offline
29 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: SMTP limitation?
Next Thread in PHP Forum Timeline: Please Help...New to MySQL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC