• 0

PHP/MySQL Select difficulties...


Question

Hello,

I'm programming a small php/mysql site wich can store data and you should be able to pull it out (as an excel file). I know how I want to do that (and have found enough information on the internet to do so), but I have one little problem.

I need to SELECT all data from a database, except for the column Id. The number of collums is also variable (at least: users van add extra columns if they need them), so I can't just SELECT * FROM [table] WHERE COLUMN IN [col_name1, col_Name2]

Or I need a function that can get this information in this format, so that I can put it into a select query.

I hope I am clear enough,

Greetings and thanks for your help,

Thekk

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

First off, don't use Access syntax. It's bad and non-standard. You're query should be formatted like this:

SELECT * FROM `table` WHERE $data IN `col_name1`, `col_Name2`

Next, there's a fairly simple PHP function you can call to remove an index from an array. You'll be pulling back the data as an array (row by row), so you want to just remove that data from the array. Simple do this:

unset( $row['Id'] );

That'll remove the Id from the return row :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.