[PHP-DB] Cant connect to a remote mySQL database

2001-10-23 Thread Leobarod Cortes

Hi John:

Im trying to connect to a remote mysql database but it seems that this thing
is not working

This is the information that thw browser sent to me:

Warning: Access denied for user: '[EMAIL PROTECTED]' (Using password:
NO) in /usr/local/apache/htdocs/pruebamysql.php on line 5

Warning: MySQL Connection Failed: Access denied for user:
'[EMAIL PROTECTED]' (Using password: NO) in
/usr/local/apache/htdocs/pruebamysql.php on line 5
1045: Access denied for user: '[EMAIL PROTECTED]' (Using password: NO)


And here it is the php.. wher it says localhost, I should only type the remote
IP address?

HTMLHEADTITLEForm Results /TITLE
BODY

?php
$connection = mysql_connect('localhost,'root');
if ($connection == false){
  echo mysql_errno().: .mysql_error().BR;
  exit;
}
mysql_select_db ('bb50');

$query = select course_id,course_name from course_main;
$result = mysql_query ($query);

if ($result){
  echo table border=1;
  echo trtdbNumero/b/tdtdbNombre del curso/b/tdtdbClave
d
el curso/b/td/tr;

  $numOfRows = mysql_num_rows ($result);
  for ($i = 0; $i  $numOfRows; $i++){
$coursename = mysql_result ($result, $i, 0);
$courseid = mysql_result ($result, $i, 0);

echo trtd$i/tdtd$coursename/tdtd$courseid/td/tr;
  }

  echo /table;
}
else{
  echo mysql_errno().: .mysql_error().BR;
}

mysql_close ($connection);

?

/BODY
/HTML






John McKown wrote:

 On Fri, 8 Sep 2000, Kevin Xin Lin wrote:

  int mysql_connect ([string hostname [:port] [:/path/to/socket] [, string
  username [, string password]]])
  
 
  This is the syntax of mysql_connect, I don't see any db information.
  What DB is in USE when I create a connection to MySQL? What have I
  overlooked?

 Well, I overlooked it too. The sequence is mysql_connect(),
 mysql_select_db(), then mysql_query(). I overlooked the
 mysql_select_db() as well. I guess that's because I always use the
 default database which is the same as my username. Also, I tend to use
 PostgreSQL more often than MySQL, so I forget some of the MySQL
 steps. Sorry about that!

 $connect=mysql_connect(...);
 $database=mysql_select_db(foo,$connect);
 $result=mysql_query($query,$connect);

 All queries which use $connect will go against the last
 mysql_select_db() which specified $connect (or the default db if it wasn't
 called).

 I hope I made more sense this time grin!

 John

 P.S. Does anybody know if doing this is more efficient that using the
 mysql_db_query() call? I would think that it might since MySQL would be
 in the correct database already. True?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Warning: MySQL: Unable to save result set

2001-10-23 Thread Leobarod Cortes

HI there..

I ahve the following issue

Error
MySQL said:


Host 'bbtest' is not allowed to connect to this MySQL server



Do you have any idea what could go wrong???

Leo




Doug Schasteen wrote:

 Warning: MySQL: Unable to save result set in location of script on
 line ***

 I recently upgraded to php 4 from 3. I also upgraded MySQL to 3.23.43 at
 the same time and repopulated my database with a .sql file. Everything
 works fine but I get this warning message every time I do an UPDATE,
 DELETE, or an INSERT. The data still gets updated, deleted or inserted
 though. SELECTs work fine without any problems. Pretty much everything
 works, I just keep getting warning messages.

 I searched the web and found that several people have fixed the problem
 in the past by doing myisamchk -r on all the tables. This did not work
 for me.

 I also have plenty of diskspace, so I dont think I'm running out of
 room.

 These scripts were all working perfectly on another server with php 3
 and a slightly older version of mysql. Also, if I run the SQL commands
 in the commandline they run fine without any warnings.

 Any ideas?

 - Doug


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]