General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 25th, 2003, 01:05 PM
Kinsbane Kinsbane is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 Kinsbane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Browsing records w/multiple categories, I get a parse error

Hay guys

I get a parse error when trying to browse multiple categories.

How it works is this:
On the search page w/form, there are four drop-down boxes that contain all records of different columns from my database. I wanted to engineer it so that, if the user only picked a selection from one drop-down box, the resulting query would pick it up and only display records from the categories they chose from. So if I choose 2/4 drop down boxes, then the query would only grab from those two columns.

At the top of each drop-down box is an <.option> tag, with value=0, like so:
Code:
<option value="0"></option>
This leaves the very top spot blank.

On my results page, I have it setup so it first checks if there are all value=0's passed to it, in which case it performs the broadest query possible for the table. If not, it runs through each drop down's value and adds the appropriate SQL query onto the final query. However, I am getting a parse error, as shown below:
PHP Code:
 $sql_conn=mysql_connect($Host$User$Pass) or die("MySQL Error #".mysql_errno().": ".mysql_error()); 
$sql_db=mysql_select_db($DB); 
if(
$_POST['p_Site_search']=="0" AND $_POST['p_Project_search']=="0" AND $_POST['s_Type_search']=="0" AND $_POST['s_Iteration_search']=="0") { 
    
$SQL="SELECT COUNT(*) AS Total  FROM ".$Table
// error, line 12
// Parse error: parse error, unexpected '}' in c:\program files\apache group\apache\htdocs\intranet_test\browseresults.ph  p on line 12
    
// line12 here
    
else { 
    
$SQL="SELECT COUNT(*) AS Total FROM ".$Table." WHERE "
        if(
$_POST['p_Site_search']!="0"){ 
        
$SQL.=" p_Site='".$_POST['p_Site_search']."' AND "
           } 
        if(
$_POST['p_Project_search']!="0"){ 
        
$SQL.=" p_Project='%".$_POST['p_Project_search']."%' AND "
        } 
        if(
$_POST['s_Type_search']!="0"){ 
        
$SQL.=" s_Type='".$_POST['s_Type_search']."' AND "
        } 
        if(
$_POST['s_Iteration_search']!="0"){ 
        
$SQL.=" s_Iteration='".$_POST['s_Iteration_search']."' AND "
        }       
    }      
    
$SQL.=" s_Iteration <> '0' ORDER BY p_Site DESC"// i have no idea what this line is for
    
$SQL_Result=mysql_query($SQL$sql_conn); 
    
$SQL_Result_Array=mysql_fetch_array($SQL_Result);
    
$Total mysql_count($SQL_Result); 


From there, the code sets up to start printing the results all nice and pretty and goes on to perform pagination.

Anyways, can you guys figure out why it's telling me the closing brace is unexpected? I can't see why it is, and I've tried putting it in different spots, deleting it, everything i can think of.

Thanks!

Reply With Quote
  #2  
Old July 25th, 2003, 03:11 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Try adding a semi-colon at the end of line 11.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Browsing records w/multiple categories, I get a parse error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT