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,