Re: How to check for an existing column in an table?
Posted by Bob Stearns on 06/19/06 17:47
yonthebeach@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>
}