Jump to content
  • 0

Sprawdzenie kolumny getInstance();


herwaldi

Question

Szybkie pytanie

potrzebuje sprawdzić w PS 1.7 czy dana kolumna istnieje, jak najprościej to zrobić?

Jeżeli kolumny nie ma to sypie mi błędem: Unknown column 'mojaKolumna' in 'field list'

a chciałbym aby gdy jej nie ma to echo 'nie ma';

 

Mój kod:

$add = Db::getInstance()->getValue("SELECT mojaKolumna FROM pr_orders WHERE id_order=".$order->id);

if ($add) {

echo 'nie ma';

} else return false;

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...