Re: Warning: mysql_fetch_assoc(): supplied argument is not a
Posted: Tue Aug 04, 2009 11:05 am
No, in the first script. I can't see it being set anywhere.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
SidewinderX wrote:$_GET is an array, $_GET["pfno"] is some value. What value are you expecting it to have? I was trying to make sense of your SQL query. You are selecting pfno your database where pfno=$_GET["pfno"], thus $user['pfno'] equals $_GET["pfno"] rendering your query quite useless.
So what do I do to correct these errors and get what is needed?jackpf wrote:Also, you're selecting where pfno=$pfno, but I don't see where $pfno has been set. Don't you mean $username?
And exactly - you're assing $_SESSION['pfno'] to 'pfno' what's the point?
I think you need to go back and read your own code.
Are u giving up already Sir Jack?tobimichigan wrote:SidewinderX wrote:$_GET is an array, $_GET["pfno"] is some value. What value are you expecting it to have? I was trying to make sense of your SQL query. You are selecting pfno your database where pfno=$_GET["pfno"], thus $user['pfno'] equals $_GET["pfno"] rendering your query quite useless.So what do I do to correct these errors and get what is needed?jackpf wrote:Also, you're selecting where pfno=$pfno, but I don't see where $pfno has been set. Don't you mean $username?
And exactly - you're assing $_SESSION['pfno'] to 'pfno' what's the point?
I think you need to go back and read your own code.
What question? And yes, I may not have an idea of what I'm doing but at least I'm open to learning and discovering new ideas.SidewinderX wrote:The real question is, have you given up? It is pretty apparent you have no idea what you are doing, so while you waiting for someone to hand you an answer (which doesn't happen very often) it may be beneficial to read up on MySQL. I would try to help, but you still have yet to answer my question.
And I think that's the question SidewinderX was referring to.What in the world is $_GET["pfno"]?
tobimichigan wrote:Hi there code gurus,
Please Chief McInfo, Sir Jack and other honorable code gurus, I need a sharp pointer as to why this error keeps coming up:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\www\Members.Arena\actions\Members_Area.php on line 24
I am actually trying to retrieve unique members information from multiple tables say table_a and perhaps table_b as well.Code: Select all
<?php session_start(); if (!$_SESSION["pfno"]) { //user not logged in, redirect to login page header("Location:Login.php"); } include("cn.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <a href="Members_Area.php">Members Area</a> | <a href="Edit_Profile.php">Edit Profile</a> | <a href="Reports.php">Reports</a> | <a href="Logout.php">Logout</a> <?php $pfno=$_GET["pfno"]; $user=mysql_query("Select * From user_table where pfno='$pfno'"); //$result=mysql_query($query,$link); $user = mysql_fetch_assoc($pfno); //Display Member Information echo ("<p>Welcome PFNO: ".$_SESSION["pfno"]); echo ("<p>Logged in: " .date("m/d/Y", $_SESSION["valid_time"])); ?> </body> </html>
Please kindly point to where "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\www\Members.Arena\actions\Members_Area.php on line 24" is coming from.
line 24=$user = mysql_fetch_assoc($pfno);
where $pfno is $_GET['pfno']. If this is what he wants, he can save himself a query and simply use $_GET['pfno'] or is it $_SESSION['pfno']? I doubt that is what he wants, which is why I was trying to determine the value of $_GET['pfno'] as jackpf pointed out.SELECT `pfno` FROM `user_table` WHERE` pfno`='$pfno'