Re: Empty Page problems
| From: | CPT John W. Holmes | Date: | Thu, 19 Jun 2003 14:06:53 +0000 |
| Subject: | Re: Empty Page problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152161@lists.php.net to get a copy of this message | ||
> Can anyone tell me what is wrong with my PHP script? I am trying to add
> information to an MSSQL database from a separate HTM file. The script it
> as follows:
How about you tell us what the problem is? What is the result of this
script? What are you expecting the result to be? Take away the @ symbols so
you'll see errors if there are any. Add some debugging to track the progress
through the script....
---John Holmes...
> <?php
>
> $myEmployeeName=$_GET['name'];
> $myEmployeeDept=$_GET['department'];
> $myEmployeeNotes=$_GET['notes'];
> $myEmployeeCTP=$_GET['ctp_op'];
>
> $myServer = "192.92.0.248";
> $myUser = "repro";
> $myPass = "repro";
> $myDB = "repro";
>
> error_reporting(E_ALL);
>
> print ("<p class=\"text\"><b>Attempting To Connect To MSSQL -
> </b><br><br>");
>
> $s = @mssql_connect($myServer, $myUser, $myPass)
> or die("Couldn't Connect To SQL Server On $myServer<br>");
>
> print ("<u>Stage 2</u><br>");
>
> $d = @mssql_select_db($myDB, $s)
> or die("Couldn't Open Database $myDB<br>");
>
> #this is the create bit
> print ("Connected - Attempting To Create Employee...<br>");
>
> if ($mYEmployeeCTP == "on") {
> $query = "INSERT INTO users (name, department, notes, ctp_op)
> VALUES ('$myEmployeeName', '$myEmployeeDept', '$myEmployeeNotes',
> 'Y')";
>
> $result = mssql_query($query)
> or die("Creating Employee Failed");
>
> } else {
>
> $query = "INSERT INTO users (name, department, notes, ctp_op)
> VALUES ('$myEmployeeName', '$myEmployeeDept', '$myEmployeeNotes',
> 'N')";
>
> $result = mssql_query($query)
> or die("Creating Employee Failed");
>
> }
>
> print ("Employee Added To Database<br><br>");
>
> print ("<a href=\"index.htm\" class=\"link\">Go back to
> index</a></p>");
>
> ?>