0

Hi,
I don't have any idea on this error:


Object of class variant could not be converted to string.

I am facing the error in this block.Please have a look on this:


IF($g!="P")
       {
          mssql_close($dbhandle);
	 //*** Close & Quit ***//  
	 $excel_app->Application->Quit();  
	 $excel_app = null;  
         $Workbook = null;  
         $Worksheet = null; 
         
         if (file_exists("$uploadedfilepath"))
         {
             #delete
             unlink($uploadedfilepath) or die ("Could not delete file"); 
         }
          [I]exit("error in uploading"."  ".$idno)	                   
[/I]
       }


I don't have idea in this error. Please help me out.Thanks in advance

2
Contributors
8
Replies
10
Views
6 Years
Discussion Span
Last Post by twiss
0

What is $g? Probably an object ("object of class variant"). You'll need to think of what you actually want to know. Also, don't die if you can't delete a file. You die anyway, and you already know your file exists.

0

Hi,

$g is a variable. (ie $g="P" ). If this condition is satisfied...i am trying to close db connection and at the same time "deleting my files".

I am facing this error, mainly from EXIT FUNCTION. I don't why?
1. Closing db connection
2. deleting my files from a directory
3. using EXIT FUNCTION - to stop script. (problem here only)

and i tried this also, if i am using only EXIT FUNCTION (Without using Closing db connection and deleting my files from a directory)means, i am not facing this error..

and i too tried this also, if i replace EXIT FUNCTION as my first step and then remaining two follows this. Then also, i am facing this error.

0

Yes, but what's in it? Obviously, php isn't happy with it. Or is the problem the $idno variable? In what line is the error anyway?

0

hi,

the error line is in the exit() function.How you telling the error is due to $idno variable. May be due to this also, what u told ? But i did not tried this.

0

I think so, not due to $idno. If i place, as the first statement in the IF LOOP and then remaining two things are following(db close and file deletion) and then also i am facing this same error.help me out

0

Can you try to replace $idno with any number (2, or 3, ..) and try if you get an error? Also, place var_dump($idno); before that line and post what it gives you?

0

Hi,

IF($g!="P")[/B]
       {
          mssql_close($dbhandle);
	 //*** Close & Quit ***//  
	 $excel_app->Application->Quit();  
	 $excel_app = null;  
         $Workbook = null;  
         $Worksheet = null; 
         
         if (file_exists("$uploadedfilepath"))
         {
             #delete
             unlink($uploadedfilepath) or die ("Could not delete file"); 
         }
          exit("error in uploading"."  ".$idno)	                   

       }

while printing:
echo var_dump($g)


my output is
object(variant)#7

But my $g is a string.
How to make it to string variable. My IF FUCNCTION also gets failed.help me out

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.