By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

How to check for an existing column in an table?

P: n/a
Hi,

how can i check with php a table for a column. if it doesn't exist i
want to create it.

thanks
yavuz

Jun 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
yo*********@googlemail.com wrote:
Hi,

how can i check with php a table for a column. if it doesn't exist i
want to create it.

thanks
yavuz

Easy:
$res = odbc_exec($dbconnection,"SELECT * FROM table");
$x = odbc_fetch_array)$res;
if(!array_key_exists($x,"columnname") {
<create columnnname in table>
}
Jun 19 '06 #2

P: n/a
thank you very much bob!

greetz yavuz

Bob Stearns wrote:
yo*********@googlemail.com wrote:
Hi,

how can i check with php a table for a column. if it doesn't exist i
want to create it.

thanks
yavuz

Easy:
$res = odbc_exec($dbconnection,"SELECT * FROM table");
$x = odbc_fetch_array)$res;
if(!array_key_exists($x,"columnname") {
<create columnnname in table>
}


Jun 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.