Re: Alter Table newbie help needed ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux