So Im editing a page on my site, and I tried to edit a code, because I got an error... cant remember what it is right now, but anyways, I changed it and got another error, something about unexpected T_DNUMBER? Well I decided to change it back, and now I'm getting a new error... which doesnt make sence, how can the error just change without changing a file? (I basically copied and pasted the original file back into that file)

Parse error: syntax error, unexpected '.', expecting ')' in /home/otakua/public_html/index.php on line 26

lines 25-27 are...
include('config.php');
$link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
if (!$link) die('Could not connect to MSSQL database.');

Could somebody please help me?

try taking out the full stop in this message
'Could not connect to MSSQL database.'

then see if the same error comes up

Could it be the "." at the end of the 'Could Not Connect' sentence?

dont you think that the error could be in the include file itself ?
Well, judging from the numbering, line 26 would be in the include file itself ?!?
I think it's worth a check !

I would check the include file. Make sure to look for invisible characters such as a space or an indent after the closing

?>

tag. If there is an invisible character just delete it.

So you guys are telling me there is a possible issue with config.php? If so what would I be looking for... apart from what tiger86 said (thanks).
@dottomm: no it cant be, thats line 27, it says the problem is in line 26.
@noelthefish: Ill try that after I check the config.php file.

I don't think it is the config file, as the error messages states the error is on index.php, but... I've been wrong before.
Have you tried noelthefish's suggestion?
Keep us posted.

Im not sure what I did, I think I may have just changed the ip adress and then it worked fine. But also the game server that this site is for wasnt up, and now it is. But now Im getting this error

Fatal error: Call to undefined function mssql_connect() in /home/otakua/public_html/index.php on line 26

I keep getting this message in almost all my .php files, what does this mean? Im doing this directly on the internet, not on the computer. Im not sure what programs I would need to do this directly on the computer, I only have notepad. But also, could the site work properly without hosting it (just for testing). As in, could I create the pages on my computer, specifically a registration page for the game server which is NOT on my computer, and if it worked properly, be able to create accounts on that server?

Fatal error: Call to undefined function mssql_connect() in /home/otakua/public_html/index.php on line 26

Usually that means that the module for that function has not been installed or been corrupted. So if you have uploaded to another server make sure the extension mssql is installed or if you believe it's already installed then make sure it is configured properly.

uhh... module? what module? -total newb-
uh... could this just mean that my host (using x10hosting) does not support mssql?

uhh... module? what module? -total newb-
uh...

A module is a like a addon for php that allows certain functionality. And there are dozens of these that can be downloaded or pre-installed and it looks like your host hasn't added the module/addon for mssql.

could this just mean that my host (using x10hosting) does not support mssql?

Yes but I would suggest submitting a support ticket asking "is the php module mssql is installed" to make sure.

okay thank you. Im going to try to get it working on my localhost (going to use wamp) first, before getting it to work online. I tried to upload the files to the www file, and it still doesnt work. Here is my config.php file
<?php

// General options for both reg page and cash shop

// Title shown at the top of pages
define('PAGE_TITLE','Neko Cabal');

// Link to website or patch
define('LINK_WSITE','http://www.nekogaming.exofire.net');

// Text to display for link
define('NAME_WSITE','Neko Gaming');

// Link to forums
define('LINK_FORUM','http://www.nekogaming.forumbo.net');

// Text to display for link
define('NAME_FORUM','NG Forums');


// MSSQL server connection details
// Database server
define('DB_ADDR','99.xx.xx.xx');
// Database login
define('DB_USER','sa');
// Database password
define('DB_PASS','mypass');

// In case you have a different db names
define('DB_ACC','ACCOUNT');
define('DB_GAM','GAMEDB');
define('DB_CCA','Cabalcash');
define('DB_CSH','CASHSHOP');

// ServerIdx MUST match the one in WorldSvr_XX_YY.ini or cash items
// Will not get delivered correctly.
define('SVR_IDX','8');

// Category names for cash shop admin panel
$cats=array(1=>'Costumes',2=>'Gear',3=>'Pets',4=>'Consumables',5=>'Items');

// Print debug info at the top of the cash shop pages
define('TESTMODE',false);

// Maintenance mode, open to GMs only.
define('MAINTMODE',false);

// Uses LastIp validation as well as UserNum and AuthKey
// Can cause problems
define('IPVALIDATION',false);

// Allow transfer of Alz from warehoue to the bank
// Set to false if you don't want to use Alz for cash items
define('ALLOW_BANK',true);

?>

Reg.php

<?php

$num_acc=0;
$num_cha=0;
$num_onl=0;
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table');
$num_acc=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where Login=1');
$num_onl=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_GAM.'.dbo.cabal_character_table');
$num_cha=mssql_result($r,0,0);

echo '<p>There are currently <span style="font-size:16px;font-weight:bold">'.$num_onl.'</span> people online right now.</p>';
echo '<p>Registered accounts: <span style="font-size:16px;font-weight:bold">'.$num_acc.'</span> | Characters created: <span style="font-size:16px;font-weight:bold">'.$num_cha.'</span></p>';

echo '<p style="font-size:24px;font-weight:bold">Account registration</p>';

echo '<p>Username and password must be minimum 6 chars, letters and numbers only.</p>';

echo '<form method="post" action="'.$_PHP['self'].'">';
echo '<table cellspacing="4" cellpadding="0" border="0">';
echo '<tr><td align="right">Login:&nbsp;</td><td><input type="text" name="uname" class="editbox"></td></tr>';
echo '<tr><td align="right">Pass:&nbsp;</td><td><input type="password" name="pass" class="editbox"></td></tr>';
echo '<tr><td align="right">Confirm pass:&nbsp;</td><td><input type="password" name="pass2" class="editbox"></td></tr>';
echo '<tr><td colspan="2" align="right"><input type="submit" value="Register account" class="button"></td></tr>';
echo '</table>';
echo '</form>';

echo '<br /><span style="font-weight:bold">Website:</span>&nbsp;<a href="'.LINK_WSITE.'">'.NAME_WSITE.'</a><br />';
echo '<span style="font-weight:bold">Forums:</span>&nbsp;<a href="'.LINK_FORUM.'">'.NAME_FORUM.'</a><br />';

$uid='';
$pass='';
$failed=false;

if (isset($_POST['uname'])) {
  if (!ctype_alnum($_POST['uname']) || strlen($_POST['uname'])<6) {
	  $failed=true;
	  echo '<p class="errortext">Invalid username. Minimum 6 characters, letters and numbers only.</p> ';
  } else {
	$uid=$_POST['uname'];	
  }
}

if (isset($_POST['pass'])) {
  if (!ctype_alnum($_POST['pass']) || strlen($_POST['pass'])<6) {
	  $failed=true;
	  echo '<p class="errortext">Invalid password. Minimum 6 characters, letters and numbers only.</p> ';
  } else {
	$pass=$_POST['pass'];	
  }
}

if (isset($_POST['pass2'])) {
  if (!ctype_alnum($_POST['pass2'])) {
	  $failed=true;
  } else {
    if ($_POST['pass2']!=$_POST['pass']) {
	    $failed=true;
	    echo '<p class="errortext">The entered passwords do not match.</p> ';
    }
  }
}

if ($failed==true) {
  echo '<p class="errortext">Failed.</p> ';	
} else {
	
	if ($uid!='' && $pass!='') {
      $r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where ID="'.$uid.'"');
      if (mssql_result($r,0,0)==0) {
        $r=mssql_query('exec '.DB_ACC.'.dbo.cabal_tool_registerAccount "'.$uid.'","'.$pass.'"');
        if ($r==false) {
  	      echo '<p class="errortext">Something went wrong :( </p>';
        } else {
  	      echo '<p class="goodtext">Account created successfully!</p>';
        }
        mssql_free_result($r);
        mssql_close($link);	
      } else {
	      echo '<p class="errortext">Logon name already used.</p> ';
      }
    }
}

?>

Im getting the same error in the reg.php file, but on line 6 instead of 26
Is it possible that I am not editing things right? This is a premade code, and its possible that I have not configured my own info.

okay thank you. Im going to try to get it working on my localhost (going to use wamp) first, before getting it to work online. I tried to upload the files to the www file, and it still doesnt work.

I believe wamp and xampp do not come with mssql installed. Also I did a search and mssql is not free. It's full name is Microsoft SQL server and you can download a trial of the database system at http://www.microsoft.com/sqlserver/2008/en/us/try-it.aspx
After installing that trial package then you will need to edit your php.ini and uncomment the line with ;extension=mssql.dll
If you want something that is free then I would suggest using mysql instead. Also mysql is claimed to be better.

sorry I cannot use mysql for the game database, besides, my friend already created it. um... I already learned about the uncommenting thingy. I did that and it STILL doesnt work. Is it because the database is on a separate computer?

sorry I cannot use mysql for the game database, besides, my friend already created it.

A php database converter perhaps. I do a lot of that sort of coding to save years of my life. But from my understanding you will need to run the script from the same server which has your database and mssql installed unless there is a security exception in which cause you would use your server ip address instead of localhost as one of the inputs. But other than that I would suggest trying it purely on your server with mssql working/installed and if that doesn't work then contact your web host.

well i contacted my webhost, and it is not supported. And I've asked people, and they have said that it should work fine on another computer. Besides, onces it's uploaded to a website, wouldnt the fact of where the database is not matter, as long as the ip is correct? Does anybody know a host that supports MSSQL?

There is a long list of hosts located at http://www.webhostingchoice.com.au/ and I would suggest checking each one to see which one with mssql suits your needs best. Note that the table doesn't reviel if the host supports mssql but you will need to go to their website via link to check if the ones you like do have mssql.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.