Re: [PHP] Alter Table newbie help needed ...
- Date: Sat, 19 Apr 2008 23:37:45 +0200
- From: Jason Norwood-Young <jason@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [PHP] Alter Table newbie help needed ...
On Sat, 2008-04-19 at 14:23 -0700, revDAVE wrote:
> Newbie - MAC - MAMP on port 8889
>
> I have this connection to Mysql database called 'test'
>
>
> Other Php stuff works ok but now I'm trying to alter the table (never did
> that before...)
>
>
>
> Connection called 'try1'...
>
> <?php
> # FileName="Connection_php_mysql.htm"
> # Type="MYSQL"
> # HTTP="true"
> $hostname_try1 = "127.0.0.1:8889";
> $database_try1 = "test";
> $username_try1 = "test";
> $password_try1 = "test";
> $try1 = mysql_pconnect($hostname_try1, $username_try1, $password_try1) or
> trigger_error(mysql_error(),E_USER_ERROR);
> ?>
>
> The lines below don't error but also don't do anything....
>
> I must be missing something here.... Right? Maybe it doesn't know to use
> try1 connection? How do I add that?
>
> <?php
> $sql = 'ALTER TABLE `ztest` ADD `myfield2` VARCHAR(10) NOT NULL;';
> ---or---
> $sql = 'ALTER TABLE `ztest` RENAME TO `ztest2`;';
>
> ?>
Might be obvious but you are doing "mysql_query($sql);", right?
Also add a try catch around your mysql_query to check what's happening.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php