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 694797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:53:36+00:00 2026-05-14T02:53:36+00:00

I am running a sql in PHP query that is dieing with the mysql_error()

  • 0

I am running a sql in PHP query that is dieing with the mysql_error() of

Unknown column '' in 'field list'

The query:

SELECT `standard` AS fee FROM `corporation_state_fee`  WHERE `stateid` = '8' LIMIT 1

when I run the query in PHPmyadmin, it return the information without flagging the error

EDIT:
I apologize for not posting enough information; the following is the entire code block where the problem is

    switch($lid){
        case '460':
            $tbl = $corporation_state_fee_tbl;
            break;
        case '535':
            $tbl = $llc_state_fee_tbl;
            break;
        default:
            return 0;
            break;
    }
    var_dump("SELECT `".$processing."` AS fee FROM `".$tbl."` WHERE `stateid` = '".$state."' LIMIT 1");
    $sql = mysql_query("SELECT `".$processing."` AS fee FROM `".$tbl."` WHERE `stateid` = '".$state."' LIMIT 1") or die(mysql_error());
    $row = mysql_fetch_array($sql);
    $fee = $row['fee'];
    include(CONN_DIR."disconnect.php"); 

and the output is :

string(83) “SELECT standard AS fee FROM corporation_state_fee WHERE stateid = ‘8’ LIMIT 1″
Unknown column ” in ‘field list’

  • 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-05-14T02:53:37+00:00Added an answer on May 14, 2026 at 2:53 am

    Let’s put some more tests and debug output in there…

    switch($lid){
      case '460':
        $tbl = $corporation_state_fee_tbl;
        break;
      case '535':
        $tbl = $llc_state_fee_tbl;
        break;
      default:
        return 0;
        break;
    }
    
    if ( !isset($processing, $tbl, $state) ) {
      die("something's missing");
    }
    // hopefully _all_ those variable parts are "safe"?
    
    // use multiple lines so the error location is a bit more expressive
    // ... and I find it easier to read this way
    $query = "
      SELECT
        `".$processing."` AS fee
      FROM
        `".$tbl."`
      WHERE
        `stateid` = '".$state."'
      LIMIT
        1
    ";
    
    // please copy&paste the output of the next line
    echo '<pre>Debug: query=', htmlspecialchars($query), '</pre>';
    $sql = mysql_query($query) or die(mysql_error());
    $row = mysql_fetch_array($sql);
    if ( false===$row ) {
      // no such record
      return 0;
    }
    $fee = $row['fee'];
    include(CONN_DIR."disconnect.php");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am running a sql query with php to retrieve some data from mysql database.
I'm running a php script from the command line against SQL server 2005 using
I have a SQL update statement I am running from inside a PHP program.
I'm running into a weird situation with a PHP execution of a SQL query
Why is that the SQL Server PHP Driver has problms with long running queries?
I'm having trouble running a multi-argument search query in MySQL: SELECT item.* from item,
Running SQL Server 2008 (not R2). I have a few reports that have URLs
I'm running SQL that needs rounding up the value to the nearest whole number.
I'm running SQL query for MySQL server with ... where name in (term1,term2,term3) I
i am using php and running sql queries on a mysql server. in order

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.