Solved

Parse error: syntax error, unexpected T_STRING

Posted on 2011-09-11
5
774 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

733 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