Jump to content

DB Update page was working and now appears blank but no idea why


fj1200
 Share

Recommended Posts

Anyone got any ideas why this just gives me a blank page?

 

Admittedly I took some of it from an example in a book, but the example worked and when I transfered the function to this is fails but I need to verify that they enter numbers ONLY - knowing the people involved on the client end they'll try it on...

 

It may not b the function at all.  I've checked all me syntax, semicolons, braketing, etc.  All looks fine.  All it needs to do is enter a typed in final count, a timestamp and change a status flag in a SQL Server database.  It did work fine,  but I don't know what stopped it working.

 

<!DOCTYPE HTML PUBLIC "-//W3C//Ddiv id=\"td\"  HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta content="MSHTML 6.00.2900.2180" name="GENERATOR">


    <head><link rel="stylesheet" href="http://mrserver/css/mr.css" type="text/css" media="screen">
<META HTTP-EQUIV="Refresh" Content="30;URL=http://mrserver/mr/mr_status.php">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Status v1 - End Job</title>
    </head>
<body>
	<?php

                    //Validate count to numbers only and max of 6 digits
                        function validateCount($count)
                        {
                            $regexp='/^([0-9]){1,6}$/';

                            if (eregi($regexp,$count)) return 1;
                                else return 0;
                        }

                     //Check form has been submitted...

                        if (isset($_POST['submit']))
                            {
                            $count=htmlentities($_POST['count']);
                            
                            if(validateCount($count))
                               // printf("%s ok", $count);

                        //Split POSTed job data into component parts
                            $job_end = explode("+", $_REQUEST[change_status]);

		//UPDATES Start data after theyhave ended the job
			$con2 = mssql_connect('dbserver', 'UID', 'PWD');
			if (!$con2 || !mssql_select_db('DB', $con2))
			{
			    die('**** Unable to connect or select database! ****');
			}
		   	mssql_query("UPDATE JOB_MR 
                                             SET STATUS = '2', MR_END = GETDATE(), MR_COUNT = '$count'
                                             WHERE ID='$job_end[5]'",$con2)or die;
			mssql_close($con2);
                             else
                                printf("%s invalid", $count);
                            }
	?>
<div style="font: 16px Verdana;" id="header">End Running Job</div><br>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
            <input type="text" id="count" name="count" maxlength="6">
            <input type="submit" name="submit" id="submit" value="Submit Final Count">
        </form>
</body>
</html>

 

As a seperate question - what's the best IDE for PHP?  For the last 2 years I've used Notepad++ and I really like it, and am very comfortable with it but I've started using NetBeans and Eclipse - really so I don't get dependant on one system and also to see what else is available.  Sadly - it needs to be a freebe as the company won't buy anything like this.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.