Solved

Parse error: syntax error, unexpected T_STRING

Posted on 2011-09-11
5
769 Views
Last Modified: 2013-12-13
I am trying to call a stored procedure  named spRunRefresh from php.  
The code is:
<?php
osql -E -d Iris -S Gamay-srv1 -Q "Exec spRunRefresh ;
?>

I receive the following error:
Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\CallFile2.php on line 2

the code osql -E -d Iris -S Gamay-srv1 -Q "Exec spRunRefresh ;

works from a bat file.

Any ideas
0
Comment
Question by:Scamquist
5 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 300 total points
ID: 36519199
osql is a command line tool, and not php syntax.

so, you want to run it with the system command?!
http://php.net/manual/en/function.system.php
<?php
system 'osql -E -d Iris -S Gamay-srv1 -Q "Exec spRunRefresh;" ';
?> 

Open in new window


however, you normally would not do that from php ...
you would want to connect with either the mssql extension or with odbc, ado etc ...
mssql extensions: http://php.net/manual/en/book.mssql.php
odbc: http://php.net/manual/en/book.uodbc.php
using adodb: http://phplens.com/lens/adodb/docs-adodb.htm
aka: choose your poison
0
 
LVL 27

Assisted Solution

by:Lukasz Chmielewski
Lukasz Chmielewski earned 100 total points
ID: 36519356
http://php.net/manual/en/function.exec.php

Just like angellll said - it is not the thing you want to do (not very safe)
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 100 total points
ID: 36519443
You can learn about PHP here:
http://us.php.net/tut.php
0
 
LVL 1

Author Comment

by:Scamquist
ID: 36519553
This is used on an intra net with limited access.  

i tired
<?php
system 'osql -E -d Iris -S Gamay-srv1 -Q "Exec spRunRefresh;" ';
?>  
 
and received the error

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Inetpub\wwwroot\CallFile2.php on line 2
0
 
LVL 1

Author Closing Comment

by:Scamquist
ID: 36520227
Thank you all for you help.  I will study up and see what I can do.  I may try to do this through a batch file.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question