[PHP-DB] MySQL Connection Lost....
Ok I've finally gotten MySQL 3.23.37 installed and operating. Thanks to all that helped! The problem I'm now experiencing is when I try to interface with MySQL via PHP. MySQL seems to work fine by logging into MySQL directly and through a MySQL GUI Client. I get the following error... Warning: MySQL Connection Failed: Lost connection to MySQL server during query... I'm assuming this is a MySQL issue since everything worked fine before the upgrade from MySQL 3.32.22 to MySQL 3.23.37. But for all I know it could be PHP I guess. I'm doing very simple query to see if it works and no success. Even code that worked before I upgraded doesn't work anymore. Here's the test query I made... (BTW, the below query works fine via MySQL/MySQL GUI Client) $szQuery = "SELECT * FROM People WHERE First_Name='adouglas'"; $dbconnection = mysql_connect("207.195.58.33","webuser","adamacc226"); mysql_select_db("venmar", $dbConnection) or die("could not connect to venmar for security authentication."); $saResults = mysql_query($szQuery, $dbConnection) or die ("2could not query venmar for security authentication."); $obResults = mysql_fetch_row($saResults) echo "$obResults[0], $obResults[1], $obResults[2], $obResults[3], $obResults[4], $obResults[5]"; The MySQL Database has it's own dedicated machine running on OpenBSD 2.9. The web server accessing the MySQL Database is on it's own machine with Apache 1.3.12 and OpenBSD 2.9. Any other details needed let me know. +--+---+ | Variable_name| Value | +--+---+ | Aborted_clients | 0 | | Aborted_connects | 6 | | Bytes_received | 4125 | | Bytes_sent | 45247 | | Connections | 15| | Created_tmp_disk_tables | 0 | | Created_tmp_tables | 0 | | Created_tmp_files| 0 | | Delayed_insert_threads | 0 | | Delayed_writes | 0 | | Delayed_errors | 0 | | Flush_commands | 1 | | Handler_delete | 4 | | Handler_read_first | 7 | | Handler_read_key | 16| | Handler_read_next| 2 | | Handler_read_prev| 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next| 2597 | | Handler_update | 1 | | Handler_write| 4 | | Key_blocks_used | 4 | | Key_read_requests| 28| | Key_reads| 4 | | Key_write_requests | 18| | Key_writes | 12| | Max_used_connections | 1 | | Not_flushed_key_blocks | 0 | | Not_flushed_delayed_rows | 0 | | Open_tables | 22| | Open_files | 44| | Open_streams | 0 | | Opened_tables| 38| | Questions| 135 | | Select_full_join | 0 | | Select_full_range_join | 0 | | Select_range | 0 | | Select_range_check | 0 | | Select_scan | 15| | Slave_running| OFF | | Slave_open_temp_tables | 0 | | Slow_launch_threads | 0 | | Slow_queries | 0 | | Sort_merge_passes| 0 | | Sort_range | 0 | | Sort_rows| 0 | | Sort_scan| 0 | | Table_locks_immediate| 52| | Table_locks_waited | 0 | | Threads_cached | 0 | | Threads_created | 14| | Threads_connected| 1 | | Threads_running | 1 | | Uptime | 7235 | +--+---+ +-+---+ | Variable_name | Value | +-+---+ | ansi_mode | OFF | | back_log| 50 | | basedir | /usr/local/ | | binlog_cache_size | 32768 | | character_set | latin1 | | character_sets | latin1 dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257 latin5 | | concurrent_insert | ON | | connect_timeout | 5 | | datadir |
RE: [PHP-DB] Using A Query Results Multiple Times
Yes, I had the right code just was missing the mysql_data_seek. Thanks for the help. > -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 23, 2001 1:09 PM > To: 'Adam Douglas'; PHP-DB (mailing list) (E-mail) > Subject: RE: [PHP-DB] Using A Query Results Multiple Times > > > You're on the right track. Did you try?: > > while( $row[] = mysql_fetch_array($result) ); > > This should load each result row into a row of a > multi-dimensional array. > > You would then access it with: > > $row[0]['colname'] > > -Original Message- > From: Adam Douglas [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 23, 2001 1:48 PM > To: PHP-DB (mailing list) (E-mail); PHP-General (mailing > list) (E-mail) > Subject: [PHP-DB] Using A Query Results Multiple Times > > > I have an instance where I have to query my MySQL > database and then > use the multiple row results to create multiple pull down > menus on a web > page. My problem is how can I take the results of the query > and use them > more the once to create pull down menus? I've always used a > while look to > fetch each row of the results and have it create the pull > down menu as it > goes through each row. But doing it this way only stores one > row of results > in a variable. Is there a way I can grab all the results from > a query that > would go into an array so I could use it multiple times? I've looking > briefly for a function to MySQL that would allow me to do > this but haven't > found anything unless I misunderstand mysql_fetch_array > function. At first I > thought I could loop through my while loop and have it put > the results from > the query of each row in to a multidimensional array. But > then how would I > add to the array after the initial row? > > BTW, I'm using PHP 3.0.16 so I can't use the added array > functions that > PHP 4 has. I do plan on upgrading soon. > > > -- > 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 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]
RE: [PHP-DB] Using A Query Results Multiple Times
Thanks for the help. I had all the code right just had to add the mysql_data_seek. Wasn't aware it operated in this manner. > -Original Message- > From: Peter Lovatt [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 23, 2001 3:41 PM > To: Adam Douglas; PHP-DB (mailing list) (E-mail); PHP-General (mailing > list) (E-mail) > Subject: RE: [PHP-DB] Using A Query Results Multiple Times > > > Hi > > while(...) > { > do whatever > } > > mysql_data_seek ($mysqlresultid, 0) > > while(...) > { > do whatever > } > > mysql_data_seek ($mysqlresultid, 0) > etc > > will set the pointer back to the beginning of the result set, > so you can > scan through it as many times as you need to, without needing > to repeat the > query. > > > HTH > > Peter > > > -Original Message- > > From: Adam Douglas [mailto:[EMAIL PROTECTED]] > > Sent: 23 October 2001 19:48 > > To: PHP-DB (mailing list) (E-mail); PHP-General (mailing > list) (E-mail) > > Subject: [PHP-DB] Using A Query Results Multiple Times > > > > > > I have an instance where I have to query my MySQL > database and then > > use the multiple row results to create multiple pull down > menus on a web > > page. My problem is how can I take the results of the query > and use them > > more the once to create pull down menus? I've always used a > while look to > > fetch each row of the results and have it create the pull > down menu as it > > goes through each row. But doing it this way only stores one row > > of results > > in a variable. Is there a way I can grab all the results > from a query that > > would go into an array so I could use it multiple times? > I've looking > > briefly for a function to MySQL that would allow me to do > this but haven't > > found anything unless I misunderstand mysql_fetch_array function. > > At first I > > thought I could loop through my while loop and have it put the > > results from > > the query of each row in to a multidimensional array. But > then how would I > > add to the array after the initial row? > > > > BTW, I'm using PHP 3.0.16 so I can't use the added array > > functions that > > PHP 4 has. I do plan on upgrading soon. > > > > > > -- > > 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 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] Using A Query Results Multiple Times
I have an instance where I have to query my MySQL database and then use the multiple row results to create multiple pull down menus on a web page. My problem is how can I take the results of the query and use them more the once to create pull down menus? I've always used a while look to fetch each row of the results and have it create the pull down menu as it goes through each row. But doing it this way only stores one row of results in a variable. Is there a way I can grab all the results from a query that would go into an array so I could use it multiple times? I've looking briefly for a function to MySQL that would allow me to do this but haven't found anything unless I misunderstand mysql_fetch_array function. At first I thought I could loop through my while loop and have it put the results from the query of each row in to a multidimensional array. But then how would I add to the array after the initial row? BTW, I'm using PHP 3.0.16 so I can't use the added array functions that PHP 4 has. I do plan on upgrading soon. -- 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: MySql Help needed
Are you sure you give access to this user from the machine to the database server? Check IP address permissions and if the user has access to the specific table and/or database in MySQL. Also check to make sure the database server is setup to allow you access from your machine.. check the MySQL and System log files they usually help to determine what went wrong. > -Original Message- > From: Sparky Kopetzky [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 29, 2003 9:12 PM > To: [EMAIL PROTECTED] > Subject: MySql Help needed > > > Greetings! > > I am building an application in PHP and am creating a global > $connect_id for MySql. I have MySql on a separate machine and > am using the connect like this: > > $server = "development.myservermachine.net"; > $username = "myname"; > $password = "mypassword"; > $connect_id = mysql_connect($server, $username, $password); > > All I get is 'Access denied for user '[EMAIL PROTECTED]' (Using > password:YES) > > Now, I know I'm in the DNS server for my system, and the > username and password are correct as I checked the User table. > > Any thoughts, ideas, etc. toward fixing this problem?? > > I'd appreciate any help provided. > > Robin Kopetzky > Black Mesa Computer/Internet Services > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php