+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
Coding Thread, PHP and MSSQL in Coding and Web Development; Okay. I am now having trouble on the coding part now! This is the code that i have got: Code: ...
  1. #16

    Join Date
    Jan 2009
    Location
    Weston Super Mare
    Posts
    66
    Thank Post
    2
    Thanked 2 Times in 2 Posts
    Rep Power
    13
    Okay. I am now having trouble on the coding part now! This is the code that i have got:
    Code:
    <?php
    $serverName = "01itserver\SQLEXPRESS"; //serverName\instanceName
    $connectionInfo = array( "Database"=>"lansweeperdb", "UID"=>"networktest", "PWD"=>"password");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);
    
    $result = sqlsrv_query( $conn, 'select * from dbo.tblcomputers where computer = (PPS4)')
    $row = sqlsrv_fetch_assoc($result);
                        echo($row['Computer']);
    
    ?>
    And i am getting the following error message:

    Parse error: parse error in C:\DFSRoots\NewVis\Network\test.php on line 7

    Any ideas??

  2. #17

    Join Date
    Dec 2008
    Location
    Nottingham
    Posts
    572
    Thank Post
    38
    Thanked 114 Times in 104 Posts
    Rep Power
    46
    Missing a ; at the end of the $result line I think

    I'd also stick a conditional check to ensure you're getting a result back before trying to fetch_assoc, just incase there's nothing there at some point and you get an error instead.
    Last edited by Willott; 31st May 2012 at 01:47 PM.

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [PHP] PHP and MySQL
    By MK-2 in forum Web Development
    Replies: 4
    Last Post: 28th June 2011, 12:21 PM
  2. PHP and LDAP on IIS
    By srochford in forum Windows
    Replies: 2
    Last Post: 31st October 2007, 09:05 AM
  3. Office 2007 file format support in Apache, PHP and Moodle
    By Geoff in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 8th July 2007, 12:12 AM
  4. PHP and IP Address lookup
    By plexer in forum Web Development
    Replies: 0
    Last Post: 27th March 2007, 11:17 AM
  5. Creating a new database in php and mysql
    By StewartKnight in forum Web Development
    Replies: 18
    Last Post: 21st February 2007, 08:53 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •