Suppress Column Names from MySQL Select

QuestionsSuppress Column Names from MySQL Select
Tony Wolsey asked 2 weeks ago

Hello

Is there an easy way to Suppress Column Names from what is returned by the MySQL Select Statement or in general within PHP?  I am trying to do some simple math with PHP and the column name, from the mysql select statement always prefixes the value.

I know there is a command line option of mysql -N that will do it but I am not sure if I can use this within PHP.

 

thanks

Tony

2 Answers
Abu Ghufran Staff answered 7 days ago

Hi,

I am unable to understand your question completely. In PHP, we always get the fetched data as array and it’s up to us what to display from that array.

If you want to hide column names when displaying data in grid, you can use following css and place it with html code to hide columns:

<style>
.ui-jqgrid-htable { display: none; }
</style>

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Tony Wolsey answered 3 days ago

Hello Abu

When I perform simple calcs in the mysql select statement and assign them to a variable, the results from the query seem to include the value of the field and the column name from the MYSQL DB.  Is there a way that I can exclude the column name from the MYSQL field and just return the field value only?  Referring to the below, I want to retrieve only the calculated field only values from Sum(quantity * automation). Then I can create the equation $autop = $auto/$finaltotal but this is not working.

$auto = $g->execute_query(“SELECT Format(Sum(quantity * automation),0) as ” FROM tblestimate where projectnumberest = ‘$groupselectednew'”);

$autop = $g->execute_query(“SELECT Format((Sum(quantity * automation)/$finaltotal) * 100,1) as ” FROM tblestimate where projectnumberest = ‘$groupselectednew'”);

thanks

Tony

Your Answer

1 + 13 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!