Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Chris

Stan wrote:

So ... if I enter "mysql -h mysqlServer -u stan -p" and then enter the 
password, I get connected without a problem ... I get the mysql client prompt.


You haven't selected a db.

Inside mysql:

use database_name;


And the mysql_connect() statement in my code does not "die".

But the mysql_select_db() statement in my code does "die".


What error?

echo mysql_error();


--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Micah Stevens
Okay, on the command line, then connect, and then select your database, 
what's the error message it gives?


-Micah

On 10/21/2008 11:06 AM, Stan wrote:

So ... if I enter "mysql -h mysqlServer -u stan -p" and then enter the 
password, I get connected without a problem ... I get the mysql client prompt.

And the mysql_connect() statement in my code does not "die".

But the mysql_select_db() statement in my code does "die".

"Micah Stevens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
  

Try it on the command line from the webserver:

mysql -h hostname -u Stan -p Password

See if that connect works.

-Micah

On 10/21/2008 04:26 AM, Stan wrote:


Nope ... that wasn't it.

The mysql_connect() works.

It's the mysql_select_db() that's failing.




  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Stan
So ... if I enter "mysql -h mysqlServer -u stan -p" and then enter the 
password, I get connected without a problem ... I get the mysql client prompt.

And the mysql_connect() statement in my code does not "die".

But the mysql_select_db() statement in my code does "die".

"Micah Stevens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Try it on the command line from the webserver:
> 
> mysql -h hostname -u Stan -p Password
> 
> See if that connect works.
> 
> -Micah
> 
> On 10/21/2008 04:26 AM, Stan wrote:
> > Nope ... that wasn't it.
> >
> > The mysql_connect() works.
> >
> > It's the mysql_select_db() that's failing.
> >
> >
> >
> >

Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Micah Stevens

Try it on the command line from the webserver:

mysql -h hostname -u Stan -p Password

See if that connect works.

-Micah

On 10/21/2008 04:26 AM, Stan wrote:

Nope ... that wasn't it.

The mysql_connect() works.

It's the mysql_select_db() that's failing.



  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Stan
Nope ... that wasn't it.

The mysql_connect() works.

It's the mysql_select_db() that's failing.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Stan
My include, navigationDB.inc, contains:

CODE:

END CODE:

(no change) and I added an instance of that user with that password at the
new IP address on the MySQL server before testing.

Hmmm ...

but what I didn't do was restart MySQL.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_select_db

2008-10-20 Thread Stut

On 20 Oct 2008, at 13:03, Stan wrote:

UBUNTU Server v8.04
On a web page:

CODE:
require_once 'frames_includes/navigationDB.inc';
$navigation_connection = mysql_connect($navigation_hostName,
  $navigation_userName,
  $navigation_passWord)
 or
die("Failed to connect to MySQL on the nasServer ... call Stan");
mysql_select_db($navigation_databaseName,$navigation_connection)
 or
die("Selection of 'navigation' database failed ... call Stan");
$navigation_data = mysql_query("SELECT * FROM " .
   $navigation_databaseName . ".navigate " .
   "ORDER BY navigateHandle",
   $navigation_connection)
 or
die("SELECT * FROM navigate table failed ... call Stan");
END CODE:

works when the UBUNTU server is attached to the same subnet as the  
MySQL

server.

If I move the UBUNTU server to a different subnet (through an ipCop
machine), making appropriate adjustments to network configuration,  
including
punching a hole in the firewall for port 3306 from the UBUNTU server  
to the

MySQL server and authorizing the user at the new IP to MySQL, the
mysql_connect works but the mysql_select_db fails.

I need help debugging this, please?


MySQL permissions are tied to IP or hostname as well as username and  
password. Sounds like the user you're connecting as has different  
permissions when it comes from a different subnet. Check the MySQL  
manual for detailed info on permissions.


-Stut

--
http://stut.net/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] mysql_select_db() and mysql_query()

2002-11-30 Thread John W. Holmes
> A friendly error message advised me that "mysql_db_query" is
deprecated
> and
> to use "mysql_select_db() and
> 
> mysql_query()". but I can't seem to get past this return in the
Browser:
> "Parse error: parse error in c:\program files\apache
> 
> group\apache\htdocs\crup_hs_local\result.php on line 58". I think I
don't
> understand the basic syntax.
> 
> /*$result = mysql_db_query($dbname,$sql);*/
> /*mysql_db_query is deprecated; use mysql_select_db() and
mysql_query()*/
> $result = mysql_select_db($dbname) or die(mysql_error();

You're missing a closing parenthesis on the above line.

---John Holmes... 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_select_db() and mysql_query()

2002-11-29 Thread Beth Gore
Hi Dan,

Dan Martin wrote:


group\apache\htdocs\crup_hs_local\result.php on line 58". I think I don't
understand the basic syntax.

/*$result = mysql_db_query($dbname,$sql);*/
/*mysql_db_query is deprecated; use mysql_select_db() and mysql_query()*/
$result = mysql_select_db($dbname) or die(mysql_error();
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
 

A valid database connection, open and query is as follows:

/* connect to the server, and assign the connection to $Conn */
$conn = mysql_connect("mysqlserver","myusername","mypassword") or 
die("Could not connect");

/* select a database using $conn as the connection */
mysql_select_db($conn) or  die("Unable to Connect");

/* a SQL query we'd like to make */
$SQL = "SELECT * FROM foobar";

/* get a record set from the mySQL database using the SQL query, and put 
the data in $rs */
$rs = mysql_query($SQL);

/* get a row of data from $rs, and assign it to $foo_row */
$foo_row = mysql_fetch_array($rs);

/* print out some of the stuff from $foo_row */
echo foo_row['foo'];
echo foo_row['bar'];


The parse error you got comes from the 'or die(mysql_error();' bit.. you 
forgot the final closing bracket, i.e. it should have been:

die( mysql_error() );

Have another go! It's one of those things you only ever write once, and 
just cut and paste it for everything you ever do ever again!

Beth Gore


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php