LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-01-2013, 02:59 PM   #1
phase3studios
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Rep: Reputation: Disabled
I'm having serious syntax errors and can't seem to find a friendly answer


I am having two major problems that need to be fixed by tomorrow:
1. "You have an error in your SQL syntax near "Karen' (and a couple of others) at line 7". (Code to follow)
2. The dropdown options don't show up on the webpage (form) although when clicking down arrow and blindly selecting an option and submitting the form, it shows the correct option in the error message.

PHP code form to MySql db.:

<select size="1" name="SalesPerson">
<option selected>Select One</option>
<option value="Karen"<?php if ($row["ColumnName"] == "Karen") echo " SELECTED "; ?>Karen</option>
<option value="Nanette"<?php if ($row["ColumnName"] == "Nanette") echo " SELECTED "; ?>Nanette</option>
<option value="Jenny"<?php if ($row["ColumnName"] == "Jenny") echo " SELECTED "; ?>Jenny</option>
<option value="Mary Ann"<?php if ($row["ColumnName"] == "Mary Ann") echo " SELECTED "; ?>Mary Ann</option>
<option value="Don"<?php if ($row["ColumnName"] == "Don") echo " SELECTED "; ?>Don</option>
<option value="Ira"<?php if ($row["ColumnName"] == "Ira") echo " SELECTED "; ?>Ira</option>
<option value="Stephen"<?php if ($row["ColumnName"] == "Stephen") echo " SELECTED "; ?>Stephen</option>
<option value="Ronnie"<?php if ($row["ColumnName"] == "Ronnie") echo " SELECTED "; ?>Ronnie</option></select>

end of code.

Is there ANYONE who can give me help on this? I'm in desperate need of answers. Thanks in advance.
 
Old 07-01-2013, 03:15 PM   #2
vmccord
Member
 
Registered: Jun 2012
Location: Lawrence, KS
Distribution: Mostly CentOS
Posts: 67
Blog Entries: 29

Rep: Reputation: Disabled
This snippet is not the SQL statement that your db engine is rejecting. This snippet populates what shows in the web page.
 
Old 07-01-2013, 03:19 PM   #3
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by phase3studios View Post
I am having two major problems that need to be fixed by tomorrow:
that's indeed a serious problem, especially when you have that little experience.

Quote:
Originally Posted by phase3studios View Post
1. "You have an error in your SQL syntax near "Karen' (and a couple of others) at line 7". (Code to follow)
Okay - where's that SQL code? Or at least the PHP code that generates the SQL statement?

Quote:
Originally Posted by phase3studios View Post
2. The dropdown options don't show up on the webpage (form) although when clicking down arrow and blindly selecting an option and submitting the form, it shows the correct option in the error message.
A live example (read: a link to the offending web page) would be helpful.

Code:
<select size="1" name="SalesPerson">
			<option selected>Select One</option>
<option value="Karen"<?php if ($row["ColumnName"] == "Karen") echo " SELECTED "; ?>Karen</option>
<option value="Nanette"<?php if ($row["ColumnName"] == "Nanette") echo " SELECTED "; ?>Nanette</option>
<option value="Jenny"<?php if ($row["ColumnName"] == "Jenny") echo " SELECTED "; ?>Jenny</option>
<option value="Mary Ann"<?php if ($row["ColumnName"] == "Mary Ann") echo " SELECTED "; ?>Mary Ann</option>
<option value="Don"<?php if ($row["ColumnName"] == "Don") echo " SELECTED "; ?>Don</option>
<option value="Ira"<?php if ($row["ColumnName"] == "Ira") echo " SELECTED "; ?>Ira</option>
<option value="Stephen"<?php if ($row["ColumnName"] == "Stephen") echo " SELECTED "; ?>Stephen</option>
<option value="Ronnie"<?php if ($row["ColumnName"] == "Ronnie") echo " SELECTED "; ?>Ronnie</option></select>
This is a mix of PHP and HTML code - or more to the point, HTML with embedded PHP snippets which results in a part of the form- However, I can't see anything there which is related to any of the problems you describe.

Quote:
Originally Posted by phase3studios View Post
Is there ANYONE who can give me help on this?
No, sorry, I don't think so. Not with this lack of information you offer.
Concerning the SQL syntax error, you should show the part of your PHP code that deals with the DB; concerning the usability problem, allow us to see it "live".

[X] Doc CPU
 
Old 07-01-2013, 03:23 PM   #4
vmccord
Member
 
Registered: Jun 2012
Location: Lawrence, KS
Distribution: Mostly CentOS
Posts: 67
Blog Entries: 29

Rep: Reputation: Disabled
Don't be mean. phase3studios is clearly in a panic. We all do things that are far from well thought out when panicking.
 
Old 07-01-2013, 03:55 PM   #5
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 343Reputation: 343Reputation: 343Reputation: 343
Hi there,

Quote:
Originally Posted by vmccord View Post
Don't be mean. phase3studios is clearly in a panic. We all do things that are far from well thought out when panicking.
that's why I'm trying to push him at least somewhere near where we have a chance to pick him up and begin to help.
I don't think I'm being mean - I just behave the same as my environment would behave towards me.

[X] Doc CPU


PS: Sorry about assuming "him" - it could be "her" as well.
 
Old 07-01-2013, 04:29 PM   #6
phase3studios
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Here is the info (I think) you are requesting:

Below is the query info. I am a real newbie and am trying to get this to work. I've had others to help but still get this message:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘Mary Ann', ContactName = ‘sdgsgsg', JobName = ‘gsgsg', Job_Address = ‘' at line 7"

Query:

// Connects to your Database

mysql_connect("deleted", "deleted", "deleted") or die(mysql_error());

mysql_select_db("aaaeeeiii") or die(mysql_error());





//Find if the SO Number already exists.

$sql = "SELECT COUNT(*) as Cnt ";

$sql .= " FROM workorder";

$sql .= " WHERE SONumber = '$SONumber'";



$result = mysql_query($sql) or die(mysql_error());

while ($row = mysql_fetch_array($result)) {

$Cnt = $row["Cnt"];

}



if ($Cnt == 0) {

//we don't have SO Number -- create it!

$sql = "INSERT INTO workorder (SONumber) VALUES ('$SONumber')";

mysql_query($sql) or die(mysql_error());

}



//service order found or created

$sql = "UPDATE workorder SET

PO = '$PO',

ServiceDate = '$ServiceDate',

SalesPerson = ‘$SalesPerson',

ContactName = ‘$ContactName',

JobName = ‘$JobName',

Job_Address = ‘$Job_Address',

ContactPhone = ‘$ContactPhone',

TechName = ‘$TechName',

Customer = ‘$Customer',

Customer_Address = ‘$Customer_Address',

Bill_City = ‘$Bill_City',

Customer_State = ‘$Customer_State',

Zip = ‘$Zip',

CustomerEmail = ‘$CustomerEmail',

AP_Phone = ‘$AP_Phone',

AP_Fax = ‘$AP_Fax',

APEmail = ‘$APEmail',

Exempt = ‘$Exempt',

Resale = ‘$Resale',

Expire_Date = ‘$Expire_Date',

WO_Cancelled = ‘$WO_Cancelled',

aei_1 = ‘$aei_1',

Part_1 = ‘$Part_1',

aei_2 = ‘$aei_2',

aei_20 = ‘$aei_20',

aei_3 = ‘$aei_3',

Part_2 = ‘$Part_2',

aei_4 = ‘$aei_4',

aei_21 = ‘$aei_21',

aei_5 = ‘$aei_5',

Part_3 = ‘$Part_3',

aei_6 = ‘$aei_6',

aei_22 = ‘$aei_22',

aei_7 = ‘$aei_7',

Part_4 = ‘$Part_4',

aei_8 = ‘$aei_8',

aei_23 = ‘$aei_23',

aei_9 = ‘$aei_9',

Part_5 = ‘$Part_5',

aei_10 = ‘$aei_10',

aei_24 = ‘$aei_24',

Notes = ‘$Notes',

New_Quote = ‘$New_Quote',

aei_11 = ‘$aei_11',

SLabor1 = ‘$SLabor1',

aei_12 = ‘$aei_12',

aei_25 = ‘$aei_25',

aei_13 = ‘$aei_13',

SLabor2 = ‘$SLabor2',

aei_14 = ‘$aei_14',

aei_26 = ‘$aei_26',

aei_15 = ‘$aei_15',

SLabor3 = ‘$SLabor3',

aei_16 = ‘$aei_16',

aei_27 = ‘$aei_27',

Other1 = ‘$Other1',

aei_28 = ‘$aei_28',

Other2 = ‘$Other2',

aei_29 = ‘$aei_29',

Other3 = ‘$Other3',

aei_30 = ‘$aei_30',

aei_45 = ‘$aei_45',

aei_32 = ‘$aei_32',

aei_41 = ‘$aei_41',

aei_40 = ‘$aei_40',

aei_43 = ‘$aei_43',

aei_42 = ‘$aei_42',

aei_50 = ‘$aei_50'


WHERE SONumber = '$SONumber'";

mysql_query($sql) or die(mysql_error());





?>
Thank you so much for your help.
 
Old 07-01-2013, 04:31 PM   #7
phase3studios
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
I can also add the php form if needed. I didn't expect to get this far over my head.
 
Old 07-01-2013, 04:34 PM   #8
phase3studios
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
also here is the page (form) http://www.autotransportlink.com/AEI...-Workorder.php (click new)
 
Old 07-01-2013, 06:48 PM   #9
phase3studios
LQ Newbie
 
Registered: Jul 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks, but I got help form another forum. It's done, all but a little tidying up. Thanks!
 
Old 07-02-2013, 11:16 AM   #10
vmccord
Member
 
Registered: Jun 2012
Location: Lawrence, KS
Distribution: Mostly CentOS
Posts: 67
Blog Entries: 29

Rep: Reputation: Disabled
Awesome!
 
Old 07-02-2013, 01:07 PM   #11
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
As you may come to find, should you continue to use this site, the idea is not only to ask questions but to also help others. It is good that you have found an answer, so to help others
that may search and find this question is similar to an issue they are having, please share your new found knowledge that others may benefit.
 
1 members found this post helpful.
Old 07-03-2013, 04:11 PM   #12
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Also, please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques. Thanks.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax errors connect2janu Programming 1 04-09-2012 08:11 PM
[SOLVED] script help (Case & IF statement syntax), easy to answer if you know shell scripting. casperpache Linux - Newbie 12 05-09-2011 08:18 AM
Not sure how to syntax this. My answer is below revsarah Linux - General 1 10-15-2010 02:10 PM
Friendly Linux errors and message boxes. AGazzaz Linux - General 2 05-18-2008 06:14 PM
find -exec syntax: bug in find? mfcarroll Programming 5 06-21-2007 08:13 PM


All times are GMT -5. The time now is 01:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration