Hey, i am trying to code a simple change character function, to learn a little about php and SQL combined with it.
Now, i coded it but i dont get whats wrong heres my code :
the error is : Fatal error: Call to undefined function mssql_query() in C:\AppServ\www\testpanel\main.php on line 26PHP Code:<?php
session_start();
class config
{
private $DB = 'GunzDB';
private $serv = 'GUNZ/SQLEXPRESS';
private $username = 'sa';
private $password = 'Azzakl123';
public function __construct()
{
$con = mssql_connect($this->serv, $this->username, $this->password) or die("<center><font color='red'>Failed to connect to the database!</font></center>");
mssql_select_db($this->DB, $con) or die("<center><font color='red'>Failed to select the database!</font></center>");
}
}
$oldcharname = $_POST['oldname'];
$newcharname = $_POST['newname'];
function alert($msg){
echo '<script language="javascript">alert("'.$msg.'");</script>';
}
if(isset($_POST['changename']))
{
$q = mssql_query("SELECT * FROM Character WHERE Name = '".$oldname."' AND SET Name = '".$newname."'");
$row = mssql_fetch_row($q);
if($row = mssql_fetch_row($q) == 1)
{
echo 'Character '.$oldcharname.' has been changed to '.$newcharname.' .';
}else{
echo 'Please Enter BOTH Fields !';
}
}
?>
and i have no idea how to fix, and yes abviously its the query problem but what in there is wrong ?! i dont get it, thanks anyway![]()


Reply With Quote![[PHP]Change Character function.](http://ragezone.com/hyper728.png)


