Jump to content

PHP calls MySQL database "callid", doesn't read it, need help?


Rory84

Recommended Posts

MySQL 5.0

http://www.sasdonline.com/cad/deputy/login.php?do=guest

 

Above is the link to view the system to get an idea of what it does. It is a dispatch program. Members get access to buttons that create calls, close calls, go on duty/off duty, etc. The following command is a "Self Assign" key.

 

My problem is, at this point in time, when a member clicks on "Self Assign", it brings up the form to enter the call number you wish to be assigned to, and when you put in the call number, you click submit, and it just does nothing. It goes back to entering a call number, not assigning you or anything. So, I scrapped the code and tried again.

 

I'm rather new to PHP/MySQL so I know I'm missing something simple. What is the syntax I'm looking for, to check the callid given by the form, to proceed to the command that assigns the member to the correct call?

 

Here is the code:

	if($_GET['do'] == "selfassign")
	{
		$q = mysql_query("SELECT * FROM users WHERE name = '".$myid."'") or die(mysql_error());
		$row = mysql_fetch_assoc($q);
		if($row['status'] == "10-7")
		{
			echo "<br /><br />You cannot assign to a call, you are 10-7! <b><a href='index.php'>Return to Call View</a></b>";
			die();
		}
		if($row['busy'] == "1")
		{
			echo "<br /><br />You are already assigned to another call!! <b><a href='index.php'>Return to Call View</a></b>";
			die();
		}
		else
		{

			mysql_query("UPDATE responders SET response = 'EN' WHERE userid = '".$myid."' AND id = '".&callid."'")
			mysql_query("UPDATE users SET busy = '1' WHERE userid = '".$myid."'")
			echo '<script type="text/javascript">window.location = "index.php?save=98"</script>';
		}
		<form action="index.php?do=selfassign&submit=true" method="POST" name="form">
		Call Number (CALL#):<br /><input type="text" name="callid" maxlength="3"><br />
		<br /><br />
		<button type="submit" value="Submit">Next</button>
	}	

This code is copyrighted and commercial, and is not to be redistributed or any of the other material relating to this code is to be used without authorization by Andrew Harrison.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.