Re: Alter Table newbie help needed ...

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

 



Jason & David,

Thanks so much for your help....

BTW: to reiterate the problem: I guess it was not knowing to use the 'try1'
connection ( try1.ztest) - and used 'connect2' connection instead...

Error said : Table 'connect2.ztest' doesn't exist
(connect2 was some other one I set up for something else)

Q: Is there a way to insure that it uses the right connection ( try1 - not
connect2 )?


----------



On 4/20/2008 1:41 PM, "Jason Norwood-Young" <jason@xxxxxxxxxxxxxxxxxxx>
wrote:

> revDave - can we see a bit more of the code in one block and not broken
> up? Makes it a bit easier to see what you're doing.

Will do - check below...



On 4/20/2008 11:08 AM, "David Giragosian" <dgiragosian@xxxxxxxxx> wrote:

> Is try1 the name of a database? The SQL syntax is
> databasename.tablename.fieldname.
Hmmm - looking below, maybe this is the DB name?

$database_try1

As you see below - I tried this, but it gave me errors

$result = mysql_query($sql,***$database_try1*** )

This also failed...

$sql = 'ALTER TABLE `test.ztest` ADD `new4` VARCHAR(50) NOT NULL;';
$result = mysql_query($sql)

>  
> When you issue a query using mysql_query() you can explicitly indicate the
> connection (returned by mysql_connect()) to use as the second parameter, e.g.,
> mysql_query($sql_Statement, $returnedConnectionObject);
>  
> HTH,
>  
> David



Here's the orig post with some mods:


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);
?>



=========


<?php

$sql = 'ALTER TABLE `ztest` ADD `newfield3` VARCHAR(50) NOT NULL;';

$result = mysql_query($sql) or die("no good dB $sql" . mysql_error());

?>

maybe it needs something like:?

$result = mysql_query($sql,***$database_try1*** ) - hmmm?

I get errors like this: Warning: mysql_query(): supplied argument is not a
valid MySQL-Link resource

--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




-- 
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