Solved

Parse error: syntax error, unexpected T_STRING

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

776 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