jkewlo Posted March 18, 2008 Share Posted March 18, 2008 Hey everyone, Ok i am working with a database with the fields Big and Small the field(s) have Art1_Big.jpg and Art1.jpg i have connection to the database and i am trying to call Art1_Big.jpg or Art1.jpg Art1_Big.jpg and Art1.jpg are just text entered into the database being i dont under stand the OLE object thing. well im not sure on what to do i keep getting Catchable fatal error: Object of class variant could not be converted to string in C:\wamp\www\pro\project\viewmore.php on line 157 i have tried other ways to get it to work. but cant seem to get it i keep getting the same error i have googled the error with no luck as well <? $url = $_REQUEST["id"]; $conn = new COM('ADODB.Connection') or die('Could not make conn'); $rs = new COM('ADODB.Recordset') or die('Coult not make rs'); $connstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\wamp\\www\\pro\\project\\Rainwater.mdb"; $conn->Open($connstring); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM Books WHERE Product_id = '". $url ."'"; $rs->Open($sql, $conn); ?> Line 157: <img src="Pic/<? echo "". $rs->Fields['Big'] .""?>"></td> <td width="82" valign="top" bgcolor="#C6FC48">Price: <? echo "". $rs->Fields['Price'] . "" ?><br /> Author:<? echo "". $rs->Fields['Author'] . "" ?></td> Thanks in Advance Quote Link to comment Share on other sites More sharing options...
Caberman Posted March 18, 2008 Share Posted March 18, 2008 Is it possible 'Big' is returned as NULL? That error will sometimes happen if you try to write out a NULL as a string. You should probably use empty() to check 'Big' before you try to write it out. Cheers. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 18, 2008 Author Share Posted March 18, 2008 well big has the Value Art1_Big in it. Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 18, 2008 Author Share Posted March 18, 2008 i forgot to save the database also how come it dosnt like MS Access to be open? when you are connecting to it? Quote Link to comment Share on other sites More sharing options...
jkewlo Posted March 18, 2008 Author Share Posted March 18, 2008 Topic Solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.