Php/Mysql problem - undiefined method mysql_connect()
Hello everyone, I've installed mysql server on my fedora box and it works great when i use the console =) But, i want my php sources to work with these bases but it doesn't work =( In fact it seems that the function mysql_connect() cannot be called, here is the error on the web page : Fatal error: Call to undefined function: mysql_connect() in /var/www/html/TechUnix/include/connexion.php on line 10 So i checked google and found out that a special rpm was needed .. so i've looked for it and when i try to install it, it tells me that : [EMAIL PROTECTED] dl]# rpm -ivh php-mysql-4.3.12-alt0.cvs20050406.i586.rpm warning: php-mysql-4.3.12-alt0.cvs20050406.i586.rpm: V3 DSA signature: NOKEY, key ID 68e31e54 error: Failed dependencies: libMySQL is needed by php-mysql-4.3.12-alt0.cvs20050406.i586 php-libs = 1:4.3.12-alt0.cvs20050406 is needed by php-mysql-4.3.12-alt0.cvs20050406.i586 libmysqlclient.so.12 is needed by php-mysql-4.3.12-alt0.cvs20050406.i586 So i tried : [EMAIL PROTECTED] dl]# rpm -ivh libMySQL-3.23.55-alt1.i586.rpm warning: libMySQL-3.23.55-alt1.i586.rpm: V3 DSA signature: NOKEY, key ID eac91ca0 error: Failed dependencies: /sbin/postun_ldconfig is needed by libMySQL-3.23.55-alt1.i586 :( the only thing i know is [EMAIL PROTECTED] dl]# rpm -qa |grep mysql mysql-3.23.58-13 libdbi-dbd-mysql-0.6.5-9 mysql-devel-3.23.58-13 mysql-server-3.23.58-16.FC3.1 [EMAIL PROTECTED] dl]# I'm quite a newby and do not really understand how i can install this pakage if someone could help ...^^ (I run a fedora Core 3)
Re: PHP/MySQL Problem
Are you running the 2 queries at the same time? they should be run 1 at a time. What does mysql_error() say? use it when you are checking the result set (if (!$result) { echo Error: . mysql_error();}Are the result sets being sent to 2 different identifiers? Just a few possibilities. Respectfully, Ligaya Turmelle Yahoo Default User wrote: Hi Guys, I have a problem with MySQL in conjunction with PHP so I also decided to post here: I have a PHP script that contains two consecutive MySQL queries, something like this: Query 1: Delete some rows from Table A Query 2: Insert some rows into Table A The problem is, only Query 2 seems to be executed. Query 1 is not executed at all. I tried running the script with only Query 1 and it worked. However, when I put back Query 2, then the problem comes back. What can be causing this problem? How do I solve this problem? Any help would be appreciated. Thanks! __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
PHP/MySQL Problem
Hi Guys, I have a problem with MySQL in conjunction with PHP so I also decided to post here: I have a PHP script that contains two consecutive MySQL queries, something like this: Query 1: Delete some rows from Table A Query 2: Insert some rows into Table A The problem is, only Query 2 seems to be executed. Query 1 is not executed at all. I tried running the script with only Query 1 and it worked. However, when I put back Query 2, then the problem comes back. What can be causing this problem? How do I solve this problem? Any help would be appreciated. Thanks! __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PHP/MySQL Problem
when asking a question, it always helpful to post you code/queries so we can see what is happening. but tbh, this sounds like it's a php code problem. you have established that both queries work, on there own I'm don't know anything about php, but it sounds like you are not executing the first query you might have more luck if you post your php code to a php group chris -Original Message- From: Yahoo Default User [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 08:52 To: [EMAIL PROTECTED] Subject: PHP/MySQL Problem Hi Guys, I have a problem with MySQL in conjunction with PHP so I also decided to post here: I have a PHP script that contains two consecutive MySQL queries, something like this: Query 1: Delete some rows from Table A Query 2: Insert some rows into Table A The problem is, only Query 2 seems to be executed. Query 1 is not executed at all. I tried running the script with only Query 1 and it worked. However, when I put back Query 2, then the problem comes back. What can be causing this problem? How do I solve this problem? Any help would be appreciated. Thanks! __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP/MySQL Problem
Hi. How did you check that Query 2 has been executed? You may add to your php.ini file mysql.trace_mode = On to see some warnings and errors. Yahoo Default User [EMAIL PROTECTED] wrote: Hi Guys, I have a problem with MySQL in conjunction with PHP so I also decided to post here: I have a PHP script that contains two consecutive MySQL queries, something like this: Query 1: Delete some rows from Table A Query 2: Insert some rows into Table A The problem is, only Query 2 seems to be executed. Query 1 is not executed at all. I tried running the script with only Query 1 and it worked. However, when I put back Query 2, then the problem comes back. What can be causing this problem? How do I solve this problem? Any help would be appreciated. Thanks! __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
php mysql problem
I have redhat 9.0 and Server version: Apache/2.0.40. i have installed rpms php-4.2.2-17.2.i386.rpm php-mysql-4.2.2-17.2.i386.rpm After i create a database called mydb and serveral tables in mysql, I tried to run following testdb.php script -- html body ?php $db = mysql_connect(localhost, root,xx); mysql_select_db(mydb,$db); $result = mysql_query(SELECT * FROM employees,$db); printf(First Name: %sbr\n, mysql_result($result,0,first)); printf(Last Name: %sbr\n, mysql_result($result,0,last)); printf(Address: %sbr\n, mysql_result($result,0,address)); printf(Position: %sbr\n, mysql_result($result,0,position)); ? /body /html --- but i got error message with: http://coopunit.forestry.uga.edu:8080/testdb.php the error is: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/testdb.php on line 13 How can Fix this problem? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php mysql problem
From: Jianping Zhu [mailto:[EMAIL PROTECTED] but i got error message with: http://coopunit.forestry.uga.edu:8080/testdb.php the error is: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/testdb.php on line 13 How can Fix this problem? Thanks Sounds as though PHP was installed without the MySQL library. I haven't done it myself in a while, but I believe it requires the --with-mysql flag. HTH -- Mike Johnson Web Developer Smarter Living, Inc. phone (617) 886-5539 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP + MySQL problem (strange behavior)
I've had a few queries that worked strangely worked in Mysql monitor, but did not work from PHP. I was able to solve every one of them by ensure that the query in PHP did not have any line breaks in it. It normally doesn't matter if there are line breaks in the code, but on occassion, a line break can cause strange results. Hope this helps. Mike On Wed, 5 Dec 2001, Javier Muniz wrote: Hello, I'm having trouble determining what's going wrong with a MySQL query that I'm doing from PHP. I have a table with the following columns: id (int) name (varchar 20) starttime (int) duration (int) now, i have a row that has a starttime of 60, when i attempt to do the following update with PHP, it sets it to 0: UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname' but when I run it from the MySQL command line, copy/pasted from the code, it sets the value of starttime to 30 as expected. Any thoughts on where this problem originates from? PHP or MySQL? They're pretty commonly used in unison so I'd imagine something like this should work fairly smoothly. I've also posted this to the PHP list in case there's someone there that's encountered this before. Javier Muniz Chief Technology Officer Granicus, LTD. Tel: (415) 522-5216 Fax: (415) 522-5215 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Michael J. Ridinger Lead Web Developer - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
PHP + MySQL problem (strange behavior)
Hello, I'm having trouble determining what's going wrong with a MySQL query that I'm doing from PHP. I have a table with the following columns: id (int) name (varchar 20) starttime (int) duration (int) now, i have a row that has a starttime of 60, when i attempt to do the following update with PHP, it sets it to 0: UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname' but when I run it from the MySQL command line, copy/pasted from the code, it sets the value of starttime to 30 as expected. Any thoughts on where this problem originates from? PHP or MySQL? They're pretty commonly used in unison so I'd imagine something like this should work fairly smoothly. I've also posted this to the PHP list in case there's someone there that's encountered this before. Javier Muniz Chief Technology Officer Granicus, LTD. Tel: (415) 522-5216 Fax: (415) 522-5215 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
PHP/MySQL Problem
Does anyone see anything wrong with the following code/query syntax? I'm using the PEAR DB class for PHP. When this runs, it correctly inserts the row to the table, but is failing to retrieve the last_insert_id(). function StartOrder() { global $dbhandle; global $OrderID; global $CustomerID; if (!($OrderID)) { $query = INSERT INTO Orders (CustomerID) VALUES(; if ($CustomerID) { $query .= \ . $CustomerID . \; } else { $query .= \ . \; } $query .= ); $dbhandle-query(LOCK TABLES Orders WRITE); $dbhandle-query($query); $res = $dbhandle-query(select last_insert_id()); $dbhandle-query(UNLOCK TABLES); $result = $res-fetchRow(); return $OrderID = $result[0]; } else { return $OrderID; } } // end func -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 10/9/2001 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP/MySQL Problem
That won't work. The connection is being made through the PEAR DB class, so the standard PHP functions won't work. (And yes, I did just test it.) -Original Message- From: rc [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 1:58 PM To: Matthew Walker Cc: [EMAIL PROTECTED] Subject: Re: PHP/MySQL Problem Mysql_Insert_ID($dbhandle-connection); gets the last id of the last insert statement - if you do any db activity after the insert, this won't work. On Tue, 30 Oct 2001, Matthew Walker wrote: Does anyone see anything wrong with the following code/query syntax? I'm using the PEAR DB class for PHP. When this runs, it correctly inserts the row to the table, but is failing to retrieve the last_insert_id(). function StartOrder() { global $dbhandle; global $OrderID; global $CustomerID; if (!($OrderID)) { $query = INSERT INTO Orders (CustomerID) VALUES(; if ($CustomerID) { $query .= \ . $CustomerID . \; } else { $query .= \ . \; } $query .= ); $dbhandle-query(LOCK TABLES Orders WRITE); $dbhandle-query($query); $res = $dbhandle-query(select last_insert_id()); $dbhandle-query(UNLOCK TABLES); $result = $res-fetchRow(); return $OrderID = $result[0]; } else { return $OrderID; } } // end func -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 10/9/2001 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 10/9/2001 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP/MySQL Problem
here's my code that is working perfectly $Conn is the connection object $sql = INSERT INTO dp_survey_question (survey_id,question_type_id,question_text) VALUES ( . $s_id . , . $qt_id . , . $Conn-quote($q_text) . ); $result = $Conn-query($sql); if (DB::isError($result)) { die( $result-getMessage().br.$sql ); } $q_id = Mysql_Insert_ID($Conn-connection); On Tue, 30 Oct 2001, Matthew Walker wrote: That won't work. The connection is being made through the PEAR DB class, so the standard PHP functions won't work. (And yes, I did just test it.) -Original Message- From: rc [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 1:58 PM To: Matthew Walker Cc: [EMAIL PROTECTED] Subject: Re: PHP/MySQL Problem Mysql_Insert_ID($dbhandle-connection); gets the last id of the last insert statement - if you do any db activity after the insert, this won't work. On Tue, 30 Oct 2001, Matthew Walker wrote: Does anyone see anything wrong with the following code/query syntax? I'm using the PEAR DB class for PHP. When this runs, it correctly inserts the row to the table, but is failing to retrieve the last_insert_id(). function StartOrder() { global $dbhandle; global $OrderID; global $CustomerID; if (!($OrderID)) { $query = INSERT INTO Orders (CustomerID) VALUES(; if ($CustomerID) { $query .= \ . $CustomerID . \; } else { $query .= \ . \; } $query .= ); $dbhandle-query(LOCK TABLES Orders WRITE); $dbhandle-query($query); $res = $dbhandle-query(select last_insert_id()); $dbhandle-query(UNLOCK TABLES); $result = $res-fetchRow(); return $OrderID = $result[0]; } else { return $OrderID; } } // end func -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- -- Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 10/9/2001 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 10/9/2001 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP/MySQL Problem
On 30-Oct-2001 Matthew Walker wrote: Does anyone see anything wrong with the following code/query syntax? I'm using the PEAR DB class for PHP. When this runs, it correctly inserts the row to the table, but is failing to retrieve the last_insert_id(). function StartOrder() { global $dbhandle; global $OrderID; global $CustomerID; if (!($OrderID)) { $query = INSERT INTO Orders (CustomerID) VALUES(; if ($CustomerID) { $query .= \ . $CustomerID . \; } else { $query .= \ . \; } $query .= ); $dbhandle-query(LOCK TABLES Orders WRITE); $dbhandle-query($query); $res = $dbhandle-query(select last_insert_id()); $dbhandle-query(UNLOCK TABLES); $result = $res-fetchRow(); UNLOCK TABLES is prolly trashing the result set; try swaping these two lines. return $OrderID = $result[0]; } else { return $OrderID; } } // end func Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php