Advertisement

08.22.2008 at 06:37AM PDT, ID: 23670145
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

PHP MySQL syntax insert command

Asked by pda4me in PHP and Databases, MySQL Server, SQL Query Syntax

I am using the following snip in code to insert a record from a standard PHP form.  It works fine except when we use a & in the company name ex. ABC & Associates.  When a & is used it cuts off the Company name at the &. How do I modify this area to allow for &?  Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
<?
	include("adminsessionvalidate.php");
	
	$clientid	=$_REQUEST['clientid'];
	$Fname		=$_REQUEST['Fname'];
	$Lname		=$_REQUEST['Lname'];
	$Company	=$_REQUEST['Company'];
	$Contact	=$_REQUEST['Contact'];
	$Adress		=$_REQUEST['Adress'];
	$City		=$_REQUEST['City'];
	$State		=$_REQUEST['State'];
	$Zip		=$_REQUEST['Zip'];
	$Phone		=$_REQUEST['Phone'];
	$Fax		=$_REQUEST['Fax'];
	$Email		=$_REQUEST['Email'];
	$Legaladvisor= $_REQUEST['Legaladvisor'];
	$Taxadvisor = $_REQUEST['Taxadvisor'];
	$Renter=$_REQUEST['Renter'];
	$Plane=$_REQUEST['Plane'];
	$Nnumber=$_REQUEST['Nnumber'];
	$Hangered=$_REQUEST['Hangered'];
	$Password	=$_REQUEST['Password'];
	
	if($clientid!=-1)
	{
		$sql = "";
		$sql = "UPDATE tbl_clients SET 
					firstname='$Fname', lastname='$Lname', company='" . str_replace("'", "&", "''", $Company) . "', contact='$Contact',
					address='$Adress', city='$City', state='$State', zip='$Zip',
					phone='$Phone', fax='$Fax', email='$Email', assigned_atty='$Legaladvisor',
					secondary_consultant='$Taxadvisor', lessee_entity ='$Renter', n_number='$Nnumber',
					hangared='$Hangered', passwords='$Password'
				 WHERE clientid='".$clientid."'";
	
		$res = mysql_query($sql);
		if($res){
			header('Content-Type: text/xml');
			echo ("<?xml version=\"1.0\"?><root><msgcode>0</msgcode><clientid>".$clientid."</clientid></root>");
		}else{
			header('Content-Type: text/xml');
			echo("<?xml version=\"1.0\"?><root><msgcode>-1</msgcode><clientid>-1</clientid></root>");
		}
	}
	elseif($clientid==-1)
	{
		$sql = "";
		$sql = "INSERT INTO tbl_clients  
					(firstname, lastname, company, contact,
					address, city, state, zip,
					phone, fax, email, assigned_atty,
					secondary_consultant, lessee_entity, plane, n_number,
					hangared, passwords)
				VALUES
					('$Fname', '$Lname', '" . str_replace("'", "&", "''", $Company) . "', '$Contact',
					'$Adress', '$City', '$State', '$Zip',
					'$Phone', '$Fax', '$Email', '$Legaladvisor',
					'$Taxadvisor', '$Renter', '$Plane', '$Nnumber',
					'$Hangered', '$Password')
				";
		$res = mysql_query($sql);
		if($res){
			$clientid = mysql_insert_id();
			header('Content-Type: text/xml');
			echo ("<?xml version=\"1.0\"?><root><msgcode>0</msgcode><clientid>".$clientid."</clientid></root>");
		}else{
			header('Content-Type: text/xml');
			echo("<?xml version=\"1.0\"?><root><msgcode>-1</msgcode><clientid>-1</clientid></root>");
		}
	}
	else{
		header('Content-Type: text/xml');
		echo("<?xml version=\"1.0\"?><root><msgcode>-2</msgcode><clientid>-1</clientid></root>");
		exit;
	}
[+][-]08.22.2008 at 06:42AM PDT, ID: 22289801

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 06:43AM PDT, ID: 22289831

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 06:47AM PDT, ID: 22289865

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:13AM PDT, ID: 22290179

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:17AM PDT, ID: 22290237

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:19AM PDT, ID: 22290264

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:25AM PDT, ID: 22290339

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:31AM PDT, ID: 22290393

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:36AM PDT, ID: 22290452

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:38AM PDT, ID: 22290483

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 07:51AM PDT, ID: 22290657

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 07:16AM PDT, ID: 22335090

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, MySQL Server, SQL Query Syntax
Sign Up Now!
Solution Provided By: CCongdon
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628