Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:26:18+00:00 2026-06-18T16:26:18+00:00

so i have 4 tables in which two of them have null values which

  • 0

so i have 4 tables in which two of them have null values which i believe is the reason for “Catchable fatal error: Object of class variant could not be converted to string”.

my tables are

table1(dbo.FA_PC)  
FAID(pk)  
PCID(fk)  

table2(dbo.PC)  
PCID(PK)  
PCCPUTypeID(fk)(some values are null/empty)  

table3(dbo.PC_CPU_Type)  
PCCPUTypeID(PK)  
CPU  
BrandID(fk)(some values are null/empty)  

table4(Brand)  
BrandID(PK)  
Brand  

so my code and select statement goes like this

<?php
$faidf=$_POST['faidf'];
ini_set("display_errors","on");
$conn = new COM("ADODB.Connection");
   try {
   $myServer = "WTCPHFILESRV\WTCPHINV";
   $myUser = "sa";
   $myPass = "P@ssw0rd";
   $myDB = "wtcphitinventory";   
   $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
   $conn->open($connStr); 
         if (! $conn) {
            throw new Exception("Could not connect!");
        }
   }

   catch (Exception $e) {
      echo "Error (File:): ".$e->getMessage()."<br>";
   }
if (!$conn)
  {exit("Connection Failed: " . $conn);}
   $sql_exp = "SELECT  c.CPU, d.Brand
FROM    dbo.FA_PC a
        INNER JOIN dbo.PC b
        on a.PCID = b.PCID
        INNER JOIN dbo.PC_CPU_Type c
            ON b.PCCPUTypeID = c.PCCPUTypeID    
        INNER JOIN dbo.Brand d
            ON c.BrandID = d.BrandID
WHERE   a.FAID = $faidf AND c.PCCPUTypeID is NOT NULL and c.BrandID is NOT NULL";    
   $rs = $conn->Execute($sql_exp);  
    echo "<tr><td>".$rs->Fields("Brand")."-".$rs->Fields("CPU")."</td>";

       $rs->Close();      
?>  

is my where statement wrong or my select statement is a little off or what causes the error of “Catchable fatal error: Object of class variant could not be converted to string “

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:26:19+00:00Added an answer on June 18, 2026 at 4:26 pm

    I believe that $rs->Fields("Brand") is returning object which is not of string type and you’re trying to concatenate it as if it was string. First you have to cast this object to string or access some property of this object that holds the string data you require.

    Instead of $rs->Fields("Brand") try fetching the field data like this:

    $rs->fields["Brand"]->value
    

    Try traversing the records like this:

    while (!$rs->EOF){ 
      echo '<tr><td>'.$rs->fields["Brand"]->value.'-'.$rs->fields["CPU"]->value.'</td></tr>'; 
      $rs->movenext(); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables which have some transactional stuff stored in them. There will
I have two or more tables which hold values under the same column name.
I have a two tables. values inside them are not identical, but most of
I have two tables which looks something like this Table Queue int ID; string
I have two tables which are used to store details of different types of
I have two tables which I want to join together using a left outer
I use Hibernate with Java. I have two tables which are associated with foreign
I have two different tables from which I need to pull data blogs which
I have two tables Department Professor in which Department has an attribute called HeadID
I have a database that which contains two tables, links and tour. Tour is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.