[PHP-DB] SQL unexpected T_CONSTANT_ENCAPSED_STRING Error

2007-03-22 Thread Lasitha Alawatta
Hi All,
   
  I have a sql script unable to execute. Because I need to insert double-coats 
(  ) also to one field(SPParams field).
   
  Ones I execuit this using mysql_query($sql), it gives Parse error: parse 
error, unexpected T_CONSTANT_ENCAPSED_STRING  error message.
   
   
 $strSql = ;
   $strSql = $strSql.UPDATE Masters.tblBranches SET FHeadMail= '[EMAIL 
PROTECTED];', ;
   $strSql = $strSql.BranchDBConnection='Server=SLBC05; Database=BackOffice; 
UID=b0;pwd=sSLap.+05);', ;
   $strSql = $strSql.SPParams='pliplp id=spCustomersAddSLBC 
t=VarCharCustomerName/pp id=spCustomersAddSLBC 
t=TinyIntCustomerType/p' ;   
   $strSql = $strSql.WHERE BranchCode=101;
   
  How can I be able to solve this issue..?
   
   
  Thank you very much,
  Lasitha


-
 What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship.

Re: [PHP-DB] SQL unexpected T_CONSTANT_ENCAPSED_STRING Error

2007-03-22 Thread Jean-Marc Guillermin

Hi Laitha,

And with backslashes before them ??

jm

- Original Message - 
From: Lasitha Alawatta [EMAIL PROTECTED]

To: php-db@lists.php.net
Sent: Thursday, March 22, 2007 2:06 PM
Subject: [PHP-DB] SQL unexpected T_CONSTANT_ENCAPSED_STRING Error



Hi All,

 I have a sql script unable to execute. Because I need to insert 
double-coats (  ) also to one field(SPParams field).


 Ones I execuit this using mysql_query($sql), it gives Parse error: parse 
error, unexpected T_CONSTANT_ENCAPSED_STRING  error message.



$strSql = ;
  $strSql = $strSql.UPDATE Masters.tblBranches SET FHeadMail= 
'[EMAIL PROTECTED];', ;
  $strSql = $strSql.BranchDBConnection='Server=SLBC05; 
Database=BackOffice; UID=b0;pwd=sSLap.+05);', ;
  $strSql = $strSql.SPParams='pliplp id=spCustomersAddSLBC 
t=VarCharCustomerName/pp id=spCustomersAddSLBC 
t=TinyIntCustomerType/p' ;

  $strSql = $strSql.WHERE BranchCode=101;

 How can I be able to solve this issue..?


 Thank you very much,
 Lasitha


-
What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship. 


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] How do I use chunks for nText fields?

2007-03-22 Thread David Balch
Hi,

I've got a PHP 5 based website, talking to a MS SQL server database, using
odbc_exec() and related methods.

Some of the database fields are type nText, and return only part of the field
value plus a pointer to the next part.

My database guy pointed to a Microsoft example of how to deal with in VB using
the GetChunk method within a while loop:
http://msdn2.microsoft.com/en-us/library/aa905922(SQL.80).aspx

I have two problems with this approach:
 1) It seems a rather awkward way to do it
 2) I can't find any documentation describing how to do it in PHP

Can anyone tell me what I need in order to get the whole value of the field out?

(I haven't been able to subscribe to php-db, so please CC me.)

Cheers,
Dave.

-- 
David Balch.  | Señor web developer.
T: +44 (0)1865 280979 | Technology-Assisted Lifelong Learning.
F: +44 (0)1865 280982 | University of Oxford.
E: [EMAIL PROTECTED] 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How do I use chunks for nText fields?

2007-03-22 Thread Frank M. Kromann
Keep calling odbc_resilt() untill everything is returned:

$str = ;
while ($tmp = odbc_result($rs, $column)) {
$str .= $tmp;
}

You can also use odbc_longreadlen() to set the number of bytes returned by
each call to odbc_result().

- Frank

 Hi,
 
 I've got a PHP 5 based website, talking to a MS SQL server database,
using
 odbc_exec() and related methods.
 
 Some of the database fields are type nText, and return only part of the
field
 value plus a pointer to the next part.
 
 My database guy pointed to a Microsoft example of how to deal with in VB
using
 the GetChunk method within a while loop:
 http://msdn2.microsoft.com/en-us/library/aa905922(SQL.80).aspx
 
 I have two problems with this approach:
  1) It seems a rather awkward way to do it
  2) I can't find any documentation describing how to do it in PHP
 
 Can anyone tell me what I need in order to get the whole value of the
field out?
 
 (I haven't been able to subscribe to php-db, so please CC me.)
 
 Cheers,
 Dave.
 
 -- 
 David Balch.  | Señor web developer.
 T: +44 (0)1865 280979 | Technology-Assisted Lifelong Learning.
 F: +44 (0)1865 280982 | University of Oxford.
 E: [EMAIL PROTECTED] 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Embedded php in javascript

2007-03-22 Thread Onochie Anyanetu

Hi, I am trying to create a pop up alert warning for deleting an entry in my
database. What I have is:

form name=myform
input type=button value=Delete Venue onClick=if(confirm('Are you sure
you want to delete ID # ? echo $UID; ?? There is no undo.'))
{alert('Value deleted? mysql_query(DELETE from table where ID = '$UID');
?')}
else
{alert('no changes')}
/form

The problem here is that the embedded php is run regardless of if the user
clicks no, for example if i put php in both the if and the else they will
both be executed. So does anyone have and idea how to make this work or
another workaround?


Re: [PHP-DB] Embedded php in javascript

2007-03-22 Thread Chris

Onochie Anyanetu wrote:
Hi, I am trying to create a pop up alert warning for deleting an entry 
in my

database. What I have is:

form name=myform
input type=button value=Delete Venue onClick=if(confirm('Are you sure
you want to delete ID # ? echo $UID; ?? There is no undo.'))
{alert('Value deleted? mysql_query(DELETE from table where ID = '$UID');
?')}
else
{alert('no changes')}
/form

The problem here is that the embedded php is run regardless of if the user
clicks no, for example if i put php in both the if and the else they will
both be executed. So does anyone have and idea how to make this work or
another workaround?


Have the confirm take you to another page where you execute the query.

PHP knows nothing of javascript and vice versa - if you include php 
inside a javscript if it means nothing.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Embedded php in javascript

2007-03-22 Thread Charles Morris

Chris is right, you also must understand that javascript runs
client-side, (In the browser),
and PHP is server-side (runs on the server).

You can generate javascript with PHP, but hardly the other way around ;).

--
Charles Morris
  [EMAIL PROTECTED]

Network Administrator, Software Developer

iSTART Research Assistant,
X-CS Systems GroupOld Dominion University
http://15037760514/~cmorris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php