472,353 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

invalid result resource from a $_SESSION

I want to save two variables in a $_SESSION for use in another page:

$_SESSION['mark'] = $mark;
$_SESSION['num'] = $num;

then on the other page I did this to get the value:

$mark =$_SESSION['mark'];
$num = $_SESSION['num'];

then I pull a query:
$result = SELECT_clm($mark,$num);

but on this line I get an invalid result resource
$numrows = mysql_num_rows($result);

how can I fix this?
tia,
Nov 14 '08 #1
3 2102
JRough wrote:
I want to save two variables in a $_SESSION for use in another page:

$_SESSION['mark'] = $mark;
$_SESSION['num'] = $num;

then on the other page I did this to get the value:

$mark =$_SESSION['mark'];
$num = $_SESSION['num'];

then I pull a query:
$result = SELECT_clm($mark,$num);

but on this line I get an invalid result resource
$numrows = mysql_num_rows($result);

how can I fix this?
tia,
Find out why your query is failing and correct that problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 14 '08 #2
JRough wrote:
I want to save two variables in a $_SESSION for use in another page:

$_SESSION['mark'] = $mark;
$_SESSION['num'] = $num;

then on the other page I did this to get the value:

$mark =$_SESSION['mark'];
$num = $_SESSION['num'];

then I pull a query:
$result = SELECT_clm($mark,$num);

but on this line I get an invalid result resource
$numrows = mysql_num_rows($result);

how can I fix this?
tia,
Debugging 101:

Did you check that your values for $mark and $num are what you expect?

print_r($_SESSION);

if you are getting expected values then test your SELECT_clm function.

Manually feed known values into your SELECT_clm function, that is more
then likely your issue.

SELECT_clm('mark','num');

This is how you draw down your problem.

Send us code of your function and it is easier, it is hard to debug a
black box function without the code.

Scotty
Nov 14 '08 #3
On Nov 13, 8:18*pm, FutureShock <futuresho...@att.netwrote:
JRough wrote:
I want to save two variables in a $_SESSION *for use in another page:
$_SESSION['mark'] = $mark;
$_SESSION['num'] = $num;
then on the other page I did this to get the value:
$mark =$_SESSION['mark'];
$num = $_SESSION['num'];
then I pull a query:
$result = SELECT_clm($mark,$num);
but on this line I get an invalid result resource
$numrows = mysql_num_rows($result);
how can I fix this?
tia,

Debugging 101:

Did you check that your values for $mark and $num are what you expect?

print_r($_SESSION);

if you are getting expected values then test your SELECT_clm function.

Manually feed known values into your SELECT_clm function, that is more
then likely your issue.

SELECT_clm('mark','num');

This is how you draw down your problem.:
>
Send us code of your function and it is easier, it is hard to debug a
black box function without the code.

Scotty
Is this right on the original page?
$_SESSION['mark'] = $mark;
$_SESSION['num'] = $num;
then excel print page it is:
$mark =$_SESSION['mark'];
$num = $_SESSION['num'];
Here is the output of a section of the print_r($_SESSION)
center [alignment] =center [17] =90 [thimbnailswidth] =90 [18]
=100 [thumb_show] =100 [19] =y [aboutus] =y [20] =Your About
us text goes here [aboutustext] =Your About us text goes here [21]
=y [terms] =y [22] =Your Terms and Conditions go here
[termstext] =Your Terms and Conditions go here [23] =United States
[defaultcountry] =United States [24] =EN [defaultlanguage] =EN
[25] =99 [pagewidth] =99 [26] =perc [pagewidthtype] =perc [27]
=17 [menuwidth] =17 [28] =sellerbuyer [accounttype] =>
sellerbuyer [29] =y [usersauth] =y [30] =3.gif [background] =>
3.gif [31] =no [brepeat] =no [32] =LMS_navy [theme] =LMS_navy
[33] =n [sitemap] =n [34] =LMS_darkgreen [theme_lessor] =>
LMS_darkgreen [35] =LMS_blue [theme_bidder] =LMS_blue [36] =>
LMS_navy [theme_normal] =LMS_navy ) [std_font] =[LMS_LOGGED_IN] =>
76 [LMS_LOGGED_IN_USERNAME] =jrough [LMS_LOGGED_EMAIL] =>
jl*****@yahoo.com [LMS_LOGGED_ACCOUNT] =internal [LMS_LOGGED_NAME]
=janis [LMS_USER_TYPE] =1 [LMS_USER_DESC] =internal [mark] =>
allx [num] =1670 )
I don't know it appears to be right. $_SESSION['mark'] = 'allx' and
$_SESSION['num] = '1670'. It did go past the select query. So I
assume there is a $result.

Now it is stopping on other lines which are 2 and 4 of my function
having to do with the $result variable not being valid:

Error Message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/allrail/public_html/clm_historyXL.php on line
60

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/allrail/public_html/clm_historyXL.php on line
62
function:

function makexcldata($xclfields,$result){
$numrows = mysql_num_rows($result);
$rowcount =1;
if ($result && mySQL_num_rows($result)){
while ($row = mysql_fetch_assoc($result)){
for($i =0; $i < sizeof($xclfields);$i++){
$value .= $row[$xclfields[$i]] ;
$value .= "\t";
}

$value .= "\n";

}
$data = $value;
return $data;
}
}

Could it be there are no rows in the $result?
thanks,
Nov 14 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: josh dismukes | last post by:
i recieve this error from this part of the code: mysql_fetch_array(): supplied argument is not a valid mysql result resource it's returning a...
0
by: jayeldee | last post by:
Hello all, I have a service that's using CDO 1.21 and Redemption to routinely iterate through a list of users to retrieve some properties which...
9
by: Petr Vileta | last post by:
Hi, I'm new here and excuse me if this question was be here earlier. I have a simple code <html><body> <?php <?php $link =...
1
by: Akhenaten | last post by:
Any suggestion as to why my fetch_array is bad? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in...
4
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in...
7
by: Big Moxy | last post by:
Can someone please advise me on how to implement this? The data entered by a user on form 1 on page1.php is posted to delete.php to remove that...
3
by: chri | last post by:
hi i get the following errors returning me folloing post to data base Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result...
9
by: JRough | last post by:
I tried to pass the $result from a mysql_query in a url like this line Header("Location:clm_historyXL.php?_result=".$result); but on the redirect...
4
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.