Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Parse error: syntax error, unexpected T_STRING

Posted on 2011-09-11
5
Medium Priority
?
822 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 1200 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 400 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 400 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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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 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…
Suggested Courses

618 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