473,808 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($mar k,$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 2184
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($mar k,$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*******@attgl obal.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($mar k,$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($_SESSI ON);

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('mar k','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...@a tt.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($mar k,$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($_SESSI ON);

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('mar k','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($_SESSI ON)
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_U SERNAME] =jrough [LMS_LOGGED_EMAI L] =>
jl*****@yahoo.c om [LMS_LOGGED_ACCO UNT] =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.p hp on line
60

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

function makexcldata($xc lfields,$result ){
$numrows = mysql_num_rows( $result);
$rowcount =1;
if ($result && mySQL_num_rows( $result)){
while ($row = mysql_fetch_ass oc($result)){
for($i =0; $i < sizeof($xclfiel ds);$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
2841
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 long text from the database which is about 200 characters long. Thanks for any help that is given. <?php
0
995
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 are then written to a database. My problem is that the ExchangeServer property of my service is user-configured and I wanted to have it write to the event log if this value is invalid so that it stops trying to process the users (sometimes in the thousands). Currently, my service is not able...
9
7433
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 = mysql_connect("localhost", "user", "password") or die("Grr: " . mysql_error()); mysql_select_db("my_dbf") or die("Grr");
1
2106
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 /home/jkokko/public_html/ask/test.php on line 11 ******************* <?php $dbHost = "localhost"; $dbUser = "user"; $dbPass = "pass"; $dbDatabase = "dbname";
4
7838
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 /home/themepar/public_html/changepass.php on line 20 You have not entered all the fields Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 34 Sorry You failed to enter the correct old password I was wondering if anyone could help me, I have...
7
1960
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 row from a table. After the SQL operation the user is returned to page1.php. How can I determine the success or failure of the SQL operation so I can display an appropriate response message to the user? Thank you!
3
1261
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 resource in C:\Documents and Settings\chris1\My Documents\xampp\htdocs\elp\modify_information.php on line 89 Warning: Cannot modify header information - headers already sent by (output started at C:\Documents and Settings\chris1\My Documents\xampp\htdocs\elp\modify_information.php:89) in...
9
2561
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 location clm_history.php page I get an error on this line: $result = $_POST; I need the $result on the clm_historyXL page to print a list to excel because of a header already being sent.
4
6344
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 /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59 Notice: Undefined index: args in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92 Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.