Jump to content
  • 0

Sprawdzenie kolumny getInstance();


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;


Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Spróbuj w ten sposób: SHOW COLUMNS FROM `nazwaTabeli` LIKE 'nazwaPola'

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More