Solved

Parse error: syntax error, unexpected T_STRING

Posted on 2011-09-11
5
761 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 142

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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now