RE: [PHP-DB] sybase_query()

2001-07-05 Thread jong jong

Ryan,

Thank you for your reply.
I tried this, but it still didn't work. Any insert,
update or delete statement will cause failure even
it's the only query in my program. select is always
fine. Anyone have any idea about this?   

Wen

--- Ryan [EMAIL PROTECTED] wrote:
 Here's a rundown of some things you can try
 changing, I don't know if it
 will help, but we'll give it a shot.
 
 Basically, I removed all the $conn strings from
 everything but the
 sybase_select_db statement.  I know with MSSQL and
 MySQL you only need
 to specifiy the connect string once, and it will
 stay constant until the
 script dies.  I have a feeling that may be the
 problem because you're
 re-specifying the connect statement but not the
 sybase_select_db
 statement.  Give that a shot and see what it does
 for you.
 
 Ryan
 
 ?
 $conn=sybase_connect(xxx,xxx,);
 sybase_select_db(pubs,$conn);
 
 $result=sybase_query(select * from authors)
 or die(query1 failed);
 sybase_free_result($result);
 
 $result=sybase_query(insert into pub_info
 values(0001,null,'test')) or
 die(query2 failed);
 sybase_free_result($result);
 
 $result=sybase_query(select * from pub_info);
 sybase_free_result($result);
 ?
 
 
 
 
 -Original Message-
 From: jong jong [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, July 03, 2001 5:44 PM
 To: Ryan Marrs
 Subject: RE: [PHP-DB] sybase_query()
 
 I tried it again without '@', but it didn't post me
 any error message. 
 Here is some values from php_info():
  Configuration
PHP Core
   Directive  Local value  Master value
 display_errors   On On 
 display_startup_errors
  Off   Off 
 doc_root   no value  no value 
 enable_dlOn On 
 error_append_string  Off   Off 
 error_log no value   no value 
 error_prepend_string
  OffOff 
 error_reporting  2039   2039 
 
 Are they enough to display the error messages?  But
 I
 see nothing except Query2 failed on my browser.
 
 BTW, sybase_xxx() and mssql_xxx() work same on my
 code.
 
 Thanks,
 Wen
 
 --- Ryan Marrs [EMAIL PROTECTED] wrote:
  Get rid of the error suppression (@) before the
  Sybase query sets, and it
  should post you an error message as to why it's
  failing.  And another
  question, why are you running Sybase for MSSQL?
  
  Ryan Marrs
  
  
  -Original Message-
  From: jong jong [mailto:[EMAIL PROTECTED]] 
  Sent: Tuesday, July 03, 2001 4:29 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] sybase_query()
  
  Please take a look into my simple php code.  Why
  does
  this program die on query2 failed but a new
 record
  acturally is inserted into table pub_info?
  
  I asked this question last week, but didn't get
 any
  answer so far. If you don't see any problem in
  there,
  please let me know. This is my last try!
  
  Please help me!
  
  ?
  $conn=sybase_connect(xxx,xxx,);
  sybase_select_db(pubs,$conn);
  
  $result=@sybase_query(select * from
 authors,$conn)
  or die(query1 failed);
  sybase_free_result($result);
  
  $result=@sybase_query(insert into pub_info
  values(0001,null,'test'),$conn) or die(query2
  failed);
  sybase_free_result($result);
  
  $result=@sybase_query(select * from
  pub_info,$conn);
  sybase_free_result($result);
  ?
  
  working environment: SunOS5.8, php4, freetds,
 MSSQL
  Server
  
  Thanks,
  jongjong
  
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail
  http://personal.mail.yahoo.com/
  
  -- 
  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]
 
 
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/
 



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] how to get ERROR message

2001-07-05 Thread jong jong

Hi,

How can I see the error message from browser? My code
is like this:
htmlbody
?
$conn=mssql_connect(xxx,,);
mssql_select_db(xxx,$conn);
$result=mssql_query(exec x) or die(query
failed);
mssql_free_result($result);
?
/body/html

I got query failed on the browser screen and nothing
else. Here is some value I got from phpinfo():
  Configuration
PHP Core
   Directive  Local value  Master value
display_errors   On On 
display_startup_errors
  Off   Off 
doc_root   no value  no value 
enable_dlOn On 
error_append_string  Off   Off 
error_log no value   no value 
error_prepend_string
 OffOff 
error_reporting  2039   2039 

Are they enough to display the error messages? 
Please help! I really do need to trace the errors.

Thanks,
jongjong

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] What does these error message mean?

2001-07-05 Thread jong jong

I got the error messages with your help. Unfortunatly,
I didn't see any problem in these message. Here is the
messages on my browser by loading the php file:
  Changed database context to 'pubs'.
  Changed database context to 'pubs'.query2 failed!
  Changed database context to 'pubs'.query3 failed! 

It didn't tell me anything about why query failed. My
code is like this:
?
  $conn=mssql_connect(xxx,xxx,);
  mssql_select_db(pubs,$conn);

  $result=mssql_query(select * from authors);
  echo mssql_get_last_message();
  if (!$result)
echo query1 failed!;
  mssql_free_result($result);

  $result=mssql_query(insert into pub_info values
   (0001,null,'test1')); 

  echo p.mssql_get_last_message();
  if (!$result)
echo query2 failed!;
  else
mssql_free_result($result);

  $result=mssql_query(insert into pub_info values 
   (0002,null,'test2'));
  echo p.mssql_get_last_message();
  if (!$result)
echo query3 failed!;
  else
mssql_free_result($result);
?

When I look into the table on MSSQL Server, Record
0001,null,test1 was inserted.
But no record 0002,null,test2. This makes me feel
that query2 and query3 failed on different reasons! 
Any one see why query2 failed and query3 failed?

Thanks,
jongjong

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] Re: What does these error message mean?

2001-07-05 Thread jong jong

Your suggestion sounds interesting. But how to close
the link? Do you mean mssql_close()? What I know is
that we can do multiple querys during one database
connection. 

I guess I didn't explain my problem clear enough.
Sorry about that. 

My point is why query works always well until the
first update query(insert,update,delete). It
doesn't matter how many select query before that.
It could be 10 select or none. But once update query
appears, I get query failed. The interesting thing
is, this query is acturally executed in my database
but return false. Then all the other querys follow
this one are failed and no affect to my database.
This table might help:
returnaffect db
---   

connect...   true 

repeat 0 or n:
  query(select...) true
done

query(insert...)
or query(update...) 
or query(delete...)false   Yes

repeat 1 or n:
 query(select...)
 or query(update...)
 or query(delete...)
 or query(insert...)   falseNo 
done  

close... true

Did anyone try this on your machine? What did you get?

jongjong

--- Kelvin [EMAIL PROTECTED] wrote:
 Hi Jong,
 
 The problem is your Query is in looping
 situation. Because you didn't
 close the link after your first inserted.
  It doesn't matter that you use (mssql_free),
 you still need to close
 the link first.
 The function of mssql_free is just free up the
 content of that variable,
 but it won't close the link for U.
 
 Kelvin.
 
 jong jong [EMAIL PROTECTED] wrote in message

[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I got the error messages with your help.
 Unfortunatly,
  I didn't see any problem in these message. Here is
 the
  messages on my browser by loading the php file:
Changed database context to 'pubs'.
Changed database context to 'pubs'.query2
 failed!
Changed database context to 'pubs'.query3
 failed!
 
  It didn't tell me anything about why query failed.
 My
  code is like this:
  ?
$conn=mssql_connect(xxx,xxx,);
mssql_select_db(pubs,$conn);
 
$result=mssql_query(select * from authors);
echo mssql_get_last_message();
if (!$result)
  echo query1 failed!;
mssql_free_result($result);
 
$result=mssql_query(insert into pub_info values
 (0001,null,'test1'));
 
echo p.mssql_get_last_message();
if (!$result)
  echo query2 failed!;
else
  mssql_free_result($result);
 
$result=mssql_query(insert into pub_info values
 (0002,null,'test2'));
echo p.mssql_get_last_message();
if (!$result)
  echo query3 failed!;
else
  mssql_free_result($result);
  ?
 
  When I look into the table on MSSQL Server, Record
  0001,null,test1 was inserted.
  But no record 0002,null,test2. This makes me
 feel
  that query2 and query3 failed on different
 reasons!
  Any one see why query2 failed and query3 failed?
 
  Thanks,
  jongjong
 
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail
  http://personal.mail.yahoo.com/
 
 
 
 -- 
 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]
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] sybase_query()

2001-07-03 Thread jong jong

Please take a look into my simple php code.  Why does
this program die on query2 failed but a new record
acturally is inserted into table pub_info?

I asked this question last week, but didn't get any
answer so far. If you don't see any problem in there,
please let me know. This is my last try!

Please help me!

?
$conn=sybase_connect(xxx,xxx,);
sybase_select_db(pubs,$conn);

$result=@sybase_query(select * from authors,$conn)
or die(query1 failed);
sybase_free_result($result);

$result=@sybase_query(insert into pub_info
values(0001,null,'test'),$conn) or die(query2
failed);
sybase_free_result($result);

$result=@sybase_query(select * from pub_info,$conn);
sybase_free_result($result);
?

working environment: SunOS5.8, php4, freetds, MSSQL
Server

Thanks,
jongjong

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] correct on sybase function for MS-SQL Server

2001-06-30 Thread jong jong

I have to correct this:

The following stored procedure did add 2 records into
mytable after I called sybase_query(exec
SP,$conn). But it just returned false like what I
said yesterday. Anyway, 2 records went to my database.
That's better than 1. So I don't care this false.
SP:
CREATE PROCEDURE SP AS
insert into mytable values(...)
insert into mytable values(...)

Now, I find that sybase_query() can not work with the
stored procedure which has more than 1 select ...
statement. What is the problem here?

Thanks,
Wen
 

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] sybase function for MS-SQL Server

2001-06-30 Thread jong jong

I am almost crazy now after playing with these codes
over 10 hours. 
I don't expect to call sybase_query() one by one for
executing sql batch. It just doesn't work for me like
what I said yesterday. Now I try to make a stored
procedure for these sql batch. So I can call
sybase_query() only once. But sometimes it works and
sometimes not, it depends on what is in the stored
procedure. And I am sure that every stored procedure I
put into sybase_query() can be run on SQL Server
Query Analyzer perfectly. 
e.g. 
SP1:  (works)  
CREATE PROCEDURE SP1 AS
insert into mytable values(...)
select * from mytable

SP2:  (doesn't work)
CREATE PROCEDURE SP2 AS
select * from mytable
select * from mytable

SP3:  (doesn't work)
CREATE PROCEDURE SP3 AS
insert into mytable values(...)
insert into mytable values(...)

It looks that the sybase_query() is not stable. I am
not the person doing freetds setup on this Unix
machine. Do you think this is a freetds related
problem?

--- olinux o [EMAIL PROTECTED] wrote:
 test
 
 --- jong jong [EMAIL PROTECTED] wrote:
  Hi,
  
  I am working on Unix(Solaris 2.8) with Apache 1.3
  and 
  php4. I need to connect MS-SQL Server without
 ODBC.
  Someone told me that sybase functions can work
 with
  MS-SQL Server. So I called sybase_xxx()
  instead of mssql_xxx(). I was surprised that most
 of
  them really work! But the problem is that
  sybase_query() seems only work for select ...
  statement. When I tried to pass
  insert...,update... or delete..., this
  function
  returned false, but the database was actually
  updated. And the following sybase_query() would
  always
  return false even it is for select
  
  Here is an example:
  $conn=sybase_connect(MS-SQL
  Server,login,password);  //successful
  sybase_select_db(db,$conn);  //return true
  $result=@sybase_query(select ...,$conn); 
 //Great!
  That's what I want.
  sybase_free_result($result);  //no problem so far
  $result=@sybase_query(insert ...,$conn); 
 //return
  false, but I did insert a new record into SQL
  Server.
  sybase_free_result($result);  //successful
  $result=@sybase_query(select...,$conn); //return
  false, can't work with select... any more.
  ...
  
  Anybody had same experience before? I will
  appriecate
  any information from you.
  
  Wen
  
  
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail
  http://personal.mail.yahoo.com/
  
  -- 
  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]
  
 
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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] sybase function for MS-SQL Server

2001-06-29 Thread jong jong

Hi,

I am working on Unix(Solaris 2.8) with Apache 1.3 and
php4. I need to connect MS-SQL Server without ODBC. I
know there is an option that using freetds but I
haven't tried it yet. 
Someone told me that sybase functions can work with
MS-SQL Server directly. So I called sybase_xxx()
instead of mssql_xxx(). I was surprised that most of
them really work! But the problem is that
sybase_query() seems only work for select ...
statement. When I tried to pass
insert...,update... or delete..., this function
returned false, but the database was actually
updated. And the following sybase_query() would always
return false even it is for select

Here is an example:
$conn=mssql_connect(MS-SQL
Server,login,password);  //successful
sybase_select_db(db,$conn);  //return true
$result=@sybase_query(select ...,$conn);  //Great!
That's what I want.
sybase_free_result($result);  //no problem so far
$result=@sybase_query(insert ...,$conn);  //return
false, but I did insert a new record into SQL Server.
sybase_free_result($result);  //successful
$result=@sybase_query(select...,$conn); //return
false, can't work with select... any more.
...

Anybody had same experience before? I will appriecate
any information from you.

Wen


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

-- 
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]