Re: PHP/MySQL Problem

2004-11-07 Thread Ligaya Turmelle
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]

RE: PHP/MySQL Problem

2004-11-05 Thread Chris Blackwell
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

2004-11-05 Thread Gleb Paharenko
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]



RE: php mysql problem

2004-05-13 Thread Mike Johnson
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)

2001-12-06 Thread mjriding

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




RE: PHP/MySQL Problem

2001-10-30 Thread Matthew Walker

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

2001-10-30 Thread rc

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

2001-10-30 Thread Don Read


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