Solved

SQl statements getting parse errors

Posted on 2007-03-20
7
217 Views
Last Modified: 2007-03-21
Can you tell me what looks wrong with this?

$PremiumFound = false;
$NormalFound = false;

$conn = mysql_connect("","","");
mysql_select_db("providers",$conn);

$SQLStrings(0) = mysql_query("SELECT Top 1 * FROM tblAdspace where tblAdspace.strProviderservice = '" .$_REQUEST['strProviderservice']. "' AND (tblAdspace.strZipcode = '" .$_REQUEST['strZipcode']. "' OR tblAdspace.strTown = '" .$_REQUEST['strTown']. "') AND  tblAdspace.strAd_size = 'Premium'")
or die(mysql_error());

$SQLStrings(1) = mysql_query("SELECT * FROM tblAdspace where tblAdspace.strProviderservice = '" .$_REQUEST['strProviderservice']. "' AND (tblAdspace.strZipcode = '" .$_REQUEST['strZipcode']. "' OR tblAdspace.strTown = '" .$_REQUEST['strTown']. "') AND  tblAdspace.strAd_size = 'Basic' ")
or die(mysql_error());
0
Comment
Question by:pingeyeg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 11

Accepted Solution

by:
elfe69 earned 500 total points
ID: 18756627
First: SELECT TOP 1 * FROM tblAdspace should be replaced by SELECT * FROM tblAdspace (SELECT TOP 1 is not a valid SQL statement)
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18756642
I don't know, I'm still getting the error.
0
 
LVL 11

Expert Comment

by:elfe69
ID: 18756681
What is the error you get ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:pingeyeg
ID: 18756740
Parse error: parse error in /Library/WebServer/Documents/providers.php on line 357
0
 
LVL 11

Expert Comment

by:elfe69
ID: 18757459
The error you get is not an SQL error, but a PHP parse error: the code in your PHP page is not correct, look at line 357 in your providers.php file
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18757644
I don't understand.  Does that mean that maybe I have a quote or double quote wrong or missing?  Is it referring to a syntax error?
0
 
LVL 11

Expert Comment

by:elfe69
ID: 18757714
Yes, you have certainly a syntax error in your PHP code
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MSSQL - Lock Row from reading by other programs 9 62
$_SERVER Variable question 31 57
Multi line FPDF footer: 3 30
xml with php question 5 37
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question