Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP view only selected records using OBDC with Access DB 1

Status
Not open for further replies.

bigcat48

Programmer
Aug 27, 2008
72
US
All - Usually I use mysql databases, but i'm doing a special assignment in which i have to use an Access database using an odbc connection.

My Goal:
-have a select menu with options populated from the database
-when an option is selected, view only selected records
-have all of this on one page

This is what I have so far.
Select Menu (php include that is not included yet)
Code:
<p><form action="trainsymbols.php" method="post" id="selectForm">        
        <label>By LSize:</label>
            <select name="id" multiple="multiple" id="multipleSelect">
                <option selected value="">Any LSize</option>
                <?php
                $conn=odbc_connect('crewforecast20080804','','');
                if (!$conn)
                  {exit("Connection Failed: " . $conn);}
                  
                //call data to be viewed
                $sql = "SELECT * FROM tbl4combo_symbols ORDER BY LSize ASC";
                $rs = odbc_exec($conn, $sql);
                if (!$rs)
                  {exit("Error in SQL");}
                while (odbc_fetch_row($rs))
                {
                  $id = odbc_result($rs,"ID");
                  $LSize = odbc_result($rs,"LSize");
                  echo "<option value='$id'>$LSize</option>\n";
                }
                odbc_close($conn);    
                ?>
            </select><br />
        <p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
    </form></p>

Display page
Code:
<table id="SortTable" class="tablesorter">
            <thead>
                <tr>
                    <!--<th class="w70">ID</th>-->
                    <th class="w325">4combo</th>
                    <th class="w70">LSymbol</th>
                    <th class="w70">ESymbol</th>
                    <th class="w70">LSize</th>
                    <th class="w70">ESize</th>
                    <th class="w70" colspan="2">Action</th>
                </tr>
            <tbody>
<?php
        // create database connection
        $conn=odbc_connect('crewforecast20080804','','');
        if (!$conn)
          {exit("Connection Failed: " . $conn);}
        
        // call data to be viewed
        $sql="SELECT * FROM tbl4combo_symbols ORDER BY '4combo' ASC";
        
        // submit the query
        $rs=odbc_exec($conn,$sql);
        // if query is invalid do this
        if (!$rs)
          {exit("Error in SQL");}
        // if query is valid do this
        while (odbc_fetch_row($rs))
        {
          $id=odbc_result($rs,"ID");
          $fcombo=odbc_result($rs,"4combo");
          $lsym=odbc_result($rs,"LSymbol");
          $esym=odbc_result($rs,"ESymbol");
          $lsize=odbc_result($rs,"LSize");
          $esize=odbc_result($rs,"ESize");
          //echo "<tr><td>$id</td>";
          echo "<td>$fcombo</td>";
          echo "<td>$lsym</td>";
          echo "<td>$esym</td>";
          echo "<td>$lsize</td>";
          echo "<td>$esize</td>";
          echo "<td class=\"center\"><a href=\"update_trnsym.php?id=$id\"><img src=\"images/edit-page-blue.gif\" title=\"Edit\" /></a></td>";
          echo "<td class=\"center\"><a href=\"delete_trnsym.php?id=$id\"><img src=\"images/delete.png\" title=\"Delete\" /></a></td></tr>";
        }
        odbc_close($conn);
        ?>

A select page not connecting to the display page.

I assume this would work if I had two things:
1. <?php echo $_SERVER['PHP_SELF']; ?>
2. A Loop


Thanks in advance.
BC
 
Well the basic structure would be to have the select box populated first, then under that a block where you check to see if an option was selected, if it was you go and display the information there, and if not you probably do nothing.


You only need to specify the name of the current page in your form action. Which is what $_SERVER['PHP_SELF'] does. but you can just as easily say display.php there or whatever the name of your page is.


Code:
<p><form action="trainsymbols.php" method="post" id="selectForm">        
        <label>By LSize:</label>
            <select name="id" multiple="multiple" id="multipleSelect">
                <option selected value="">Any LSize</option>
                <?php
                $conn=odbc_connect('crewforecast20080804','','');
                if (!$conn)
                  {exit("Connection Failed: " . $conn);}
                  
                //call data to be viewed
                $sql = "SELECT * FROM tbl4combo_symbols ORDER BY LSize ASC";
                $rs = odbc_exec($conn, $sql);
                if (!$rs)
                  {exit("Error in SQL");}
                while (odbc_fetch_row($rs))
                {
                  $id = odbc_result($rs,"ID");
                  $LSize = odbc_result($rs,"LSize");
                  echo "<option value='$id'>$LSize</option>\n";
                }
                odbc_close($conn);    
                ?>
            </select><br />
        <p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
    </form></p>

[red]if(isset($_POST['id'])){[/red][green]//Check if an option was chosen from the select box[/green]
[green]//display stuff goes here using your Id from your select box to perform the query. [/green]
}
else{
[green]\\do something if no option is selected.[/green]
}

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
So I can just simply add the display page stuff in the area below and it should work?

Code:
[COLOR=red]if(isset($_POST['id']))[/color]{
[COLOR=green]//display stuff goes here[/color]
}
else{
[COLOR=red]//what would you suggest that I put here[/color]
}


Updated code
Code:
	[COLOR=red]<?php include("includes/select.php"); ?>[/color]
		
		<table id="SortTable" class="tablesorter">
			<thead>
				<tr>
					<!--<th class="w70">ID</th>-->
					<th class="w325">4combo</th>
					<th class="w70">LSymbol</th>
					<th class="w70">ESymbol</th>
					<th class="w70">LSize</th>
					<th class="w70">ESize</th>
					<th class="w70" colspan="2">Action</th>
				</tr>
			<tbody>
		<?php
		// create database connection
		$conn=odbc_connect('crewforecast20080804','','');
		if (!$conn)
		  {exit("Connection Failed: " . $conn);}
		
		// call data to be viewed
		$sql="SELECT * FROM tbl4combo_symbols ORDER BY '4combo' ASC";
		
		// submit the query
		$rs=odbc_exec($conn,$sql);
		// if query is invalid do this 
		if (!$rs)
		  {exit("Error in SQL");}
		// if query is valid do this 
		while (odbc_fetch_row($rs))
		{
		  $id=odbc_result($rs,"ID");
		  $fcombo=odbc_result($rs,"4combo");
		  $lsym=odbc_result($rs,"LSymbol");
		  $esym=odbc_result($rs,"ESymbol");
		  $lsize=odbc_result($rs,"LSize");
		  $esize=odbc_result($rs,"ESize");
		  //echo "<tr><td>$id</td>";
		  echo "<td>$fcombo</td>";
		  echo "<td>$lsym</td>";
		  echo "<td>$esym</td>";
		  echo "<td>$lsize</td>";
		  echo "<td>$esize</td>";
		  echo "<td class=\"center\"><a href=\"update_trnsym.php?id=$id\"><img src=\"images/edit-page-blue.gif\" title=\"Edit\" /></a></td>";
		  echo "<td class=\"center\"><a href=\"delete_trnsym.php?id=$id\"><img src=\"images/delete.png\" title=\"Delete\" /></a></td></tr>";
		}
		
		}
		[COLOR=red]else{
		\\do something if no option is selected.
		}[/color]
		odbc_close($conn);
		?>
			</tbody>
		</table>
 
Basically yes, although your display code, right now doesn't make use of the variable from the select box. which would be something along the lines of $_POST['selectboxname']

and then make use of it in your query.
$sql="SELECT *FROM tbl4combo_symbols WHERE somefieldinyourtable='" . $_POST['selectboxname'] . "'";



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
How should I write the code to display the select menu and the records display on the same page?

Here is my updated code:

Code:
<p><form action="[COLOR=red]<?php echo $_SERVER['PHP_SELF']; ?>[/color]" method="post" id="selectForm">		
			<label>By LSize:</label>
				<select name="LSize" multiple="multiple" id="multipleSelect">
					<option selected value="">Any LSize</option>
					<?php
					$conn=odbc_connect('crewforecast20080804','','');
					if (!$conn)
					  {exit("Connection Failed: " . $conn);}
					  
					//call data to be viewed
					$sql = "SELECT DISTINCT LSize FROM tbl4combo_symbols ORDER BY LSize ASC";
					$rs = odbc_exec($conn, $sql);
					if (!$rs)
					  {exit("Error in SQL");}
					while (odbc_fetch_row($rs)) 
					{
					  //$id = odbc_result($rs,"ID");
					  $LSize = odbc_result($rs,"LSize");
					  echo "<option value='$LSize'>$LSize</option>\n"; 
					}
					odbc_close($conn);	
					?>
				</select><br />
			<p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
			</form></p>
		[COLOR=red]<?php
		if(isset($_POST['LSize']))
			{
				//Check if an option was chosen from the select box
				//display stuff goes here using your Id from your select box to perform the query.
			}
		/*else
			{
				//do something if no option is selected.
				trainsymbols.php
			}*/
		; ?>[/color]
		
		<table id="SortTable" class="tablesorter">
			<thead>
				<tr>
					<!--<th class="w70">ID</th>-->
					<th class="w325">4combo</th>
					<th class="w70">LSymbol</th>
					<th class="w70">ESymbol</th>
					<th class="w70">LSize</th>
					<th class="w70">ESize</th>
					<th class="w70" colspan="2">Action</th>
				</tr>
			<tbody>
		<?php
		// create database connection
		$conn=odbc_connect('crewforecast20080804','','');
		if (!$conn)
		  {exit("Connection Failed: " . $conn);}
		
		// call data to be viewed
		//$sql="SELECT * FROM tbl4combo_symbols ORDER BY '4combo' ASC";
		$sql="SELECT * FROM tbl4combo_symbols WHERE LSize='" . $_POST['LSize'] . "'";
		
		// submit the query
		$rs=odbc_exec($conn,$sql);
		// if query is invalid do this 
		if (!$rs)
		  {exit("Error in SQL");}
		// if query is valid do this 
		while (odbc_fetch_row($rs))
		{
		  $id=odbc_result($rs,"ID");
		  $fcombo=odbc_result($rs,"4combo");
		  $lsym=odbc_result($rs,"LSymbol");
		  $esym=odbc_result($rs,"ESymbol");
		  $lsize=odbc_result($rs,"LSize");
		  $esize=odbc_result($rs,"ESize");
		  //echo "<tr><td>$id</td>";
		  echo "<td>$fcombo</td>";
		  echo "<td>$lsym</td>";
		  echo "<td>$esym</td>";
		  echo "<td>$lsize</td>";
		  echo "<td>$esize</td>";
		  echo "<td class=\"center\"><a href=\"update_trnsym.php?id=$id\"><img src=\"images/edit-page-blue.gif\" title=\"Edit\" /></a></td>";
		  echo "<td class=\"center\"><a href=\"delete_trnsym.php?id=$id\"><img src=\"images/delete.png\" title=\"Delete\" /></a></td></tr>";
		}
		odbc_close($conn);
		?>
			</tbody>
		</table>
 
Close, all your table and query stuff at the end which I assume is the part that shows the info based on what was selected should go inside the IF statement where you check if an option was selected.

Otherwise it will try to run it every time the page is requested even if there's nothing selected, and that will generate an error.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
The original display is showing correctly but when I select an option I would get the following error message:

"Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in C:\xampp\htdocs\crewforecast\trainsymbols-test.php on line 108
"

Here is the update code:

Code:
<p><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="selectForm">		
			<label>By LSize:</label>
				<select name="LSize" <!--multiple="multiple"--> id="multipleSelect">
					<option selected value="">Any LSize</option>
					<?php
					$conn=odbc_connect('crewforecast20080804','','');
					if (!$conn)
					  {exit("Connection Failed: " . $conn);}
					  
					//call data to be viewed
					$sql = "SELECT DISTINCT LSize FROM tbl4combo_symbols ORDER BY LSize ASC";
					$rs = odbc_exec($conn, $sql);
					if (!$rs)
					  {exit("Error in SQL");}
					while (odbc_fetch_row($rs)) 
					{
					  //$id = odbc_result($rs,"ID");
					  $LSize = odbc_result($rs,"LSize");
					  echo "<option value='$LSize'>$LSize</option>\n"; 
					}
					odbc_close($conn);	
					?>
				</select><br />
			<p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
			</form></p>
		<?php
		if(isset($_POST[LSize]))
			{
				//Check if an option was chosen from the select box
				//display stuff goes here using your Id from your select box to perform the query.
				
				echo "<table id='SortTable' class='tablesorter'>";
				echo "<thead>";
				echo "	<tr>";
				echo "		<th class='w325'>4combo</th>";
				echo "		<th class='w70'>LSymbol</th>";
				echo "		<th class='w70'>ESymbol</th>";
				echo "		<th class='w70'>LSize</th>";
				echo "		<th class='w70'>ESize</th>";
				echo "		<th class='w70' colspan='2'>Action</th>";
				echo "	</tr>";
				echo "<tbody>";

				// create database connection
				$conn=odbc_connect('crewforecast20080804','','');
				if (!$conn)
				  {exit("Connection Failed: " . $conn);}
				
				// call data to be viewed
				$sql="SELECT * FROM tbl4combo_symbols WHERE LSize='" . $_POST[LSize] . "'";
				
				// submit the query
				[COLOR=red]$rs=odbc_exec($conn,$sql);[/color]
				// if query is invalid do this 
				if (!$rs)
				  {exit("Error in SQL");}
				// if query is valid do this 
				while (odbc_fetch_row($rs))
				{
				  $fcombo=odbc_result($rs,"4combo");
				  $lsym=odbc_result($rs,"LSymbol");
				  $esym=odbc_result($rs,"ESymbol");
				  $lsize=odbc_result($rs,"LSize");
				  $esize=odbc_result($rs,"ESize");
				  echo "<td>$fcombo</td>";
				  echo "<td>$lsym</td>";
				  echo "<td>$esym</td>";
				  echo "<td>$lsize</td>";
				  echo "<td>$esize</td>";
				  echo "<td class='center'><a href='update_trnsym.php?id=$id'><img src='images/edit-page-blue.gif' title='Edit' /></a></td>";
				  echo "<td class='center'><a href='delete_trnsym.php?id=$id'><img src='images/delete.png' title='Delete' /></a></td></tr>";
				}
				  echo "</tbody>";
				  echo "</table><br />";
				odbc_close($conn);				
			}
		else
			{
				//do something if no option is selected.
				
				echo "<table id='SortTable' class='tablesorter'>";
				echo "	<thead>";
				echo "		<tr>";
				echo "			<th class='w325'>4combo</th>";
				echo "			<th class='w70'>LSymbol</th>";
				echo "			<th class='w70'>ESymbol</th>";
				echo "			<th class='w70'>LSize</th>";
				echo "			<th class='w70'>ESize</th>";
				echo "			<th class='w70' colspan='2'>Action</th>";
				echo "		</tr>";
				echo "	<tbody>";

				// create database connection
				$conn=odbc_connect('crewforecast20080804','','');
				if (!$conn)
				  {exit("Connection Failed: " . $conn);}
				
				// call data to be viewed
				$sql="SELECT * FROM tbl4combo_symbols ORDER BY '4combo' ASC";
				
				// submit the query
				$rs=odbc_exec($conn,$sql);
				// if query is invalid do this 
				if (!$rs)
				  {exit("Error in SQL");}
				// if query is valid do this 
				while (odbc_fetch_row($rs))
				{
				  $fcombo=odbc_result($rs,"4combo");
				  $lsym=odbc_result($rs,"LSymbol");
				  $esym=odbc_result($rs,"ESymbol");
				  $lsize=odbc_result($rs,"LSize");
				  $esize=odbc_result($rs,"ESize");
				  echo "<td>$fcombo</td>";
				  echo "<td>$lsym</td>";
				  echo "<td>$esym</td>";
				  echo "<td>$lsize</td>";
				  echo "<td>$esize</td>";
				  echo "<td class='center'><a href='update_trnsym.php?id=$id'><img src='images/edit-page-blue.gif' title='Edit' /></a></td>";
				  echo "<td class='center'><a href='delete_trnsym.php?id=$id'><img src='images/delete.png' title='Delete' /></a></td></tr>";
				}
				
				  echo "</tbody>";
				  echo "</table><br />";
				odbc_close($conn);
			}
		; ?>
 
Code:
$sql="SELECT * FROM tbl4combo_symbols WHERE LSize=$_POST[LSize]";
 
PERFECT!!! Works like a charm!

Next question; Is there anyway I can use the multiple select and select two or more values and display only those.
 
sure. you can select whatever fields you like from your database. just replace the asterisk with the column names you are after. or have i misunderstood.
 
Well maybe.

I want to be able to select value1 and value 2 from the dropdown and then display all records per these two selections.
 
sure

Code:
$sql="SELECT * FROM tbl4combo_symbols WHERE LSize IN (" . implode(',', $POST['LSize']) . ")";
 
oops.
Code:
$sql="SELECT * FROM tbl4combo_symbols WHERE LSize IN (" . implode(',', $[red]_[/red]POST['LSize']) . ")";
 
Not working.

I need these options:
-select one value
-select two or more
-select all value

This is what I am receiving.

Code:
Warning: implode() [function.implode]: Invalid arguments passed in C:\xampp\htdocs\crewforecast\trainsymbols-test.php on line 108

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'LSize IN ()'., SQL state 37000 in SQLExecDirect in C:\xampp\htdocs\crewforecast\trainsymbols-test.php on line 110
Error in SQL
 
i suspect that this was returned when only one result was selected. but even then i'm surprised.

this is a bit more refined in that it tests for single selects as well as multi selects. there is no difference between more than one and all in this context.

Code:
if (is_array($_POST['LSize']){
 $where = "IN (". implode (','$_POST['LSize']) .")";
} elseif (!empty($_POST['LSize'])){
 $where = "= " . $_POST['LSize'];
$sql="SELECT * FROM tbl4combo_symbols WHERE LSize $where";
}

there is a f
 
Not working correctly. Just an error message now.

Error: Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\crewforecast\trainsymbols-test.php on line 108

Here is the updated code:
(the reason why I removed the "'" in the POST is because LSize is a number field)

Code:
if (is_array($_POST[LSize]){
					$where = "IN (". implode (','$_POST[LSize]) .")";
				} elseif (!empty($_POST[LSize])){
					$where = "= " . $_POST[LSize];
				$sql="SELECT * FROM tbl4combo_symbols WHERE LSize $where";
				}

Need more help. Thanks.
 
(the reason why I removed the "'" in the POST is because LSize is a number field

completely irrelevant. you must enquote associative array keys unless they are used inside a double quoted string. check out the manual.

and you really could have worked out the error yourself with a little bit of applied brain power. i had missed out a close round bracket to finish the if condition. this is the kind of thing we expect IT professionals (whether or not they are language specialists) to be able to self-help.

Code:
if (is_array($_POST[LSize]) [red])[/red]{
 
Thanks JPADIE,

It works great. I have a couple of needs though.

I want to be able to select an option to display all records.

How can I add this?

This what I have that works:
Code:
<p><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="selectForm">		
			<label>By LSize:</label>
				<select name="LSize" multiple="multiple" id="multipleSelect" >
					<option selected value="">-- Select An LSize --</option>
					<?php
					// create database connection
					include("includes/connection.php");
					  
					// Call the data
					$sql = "SELECT DISTINCT LSize FROM tbl4combo_symbols ORDER BY LSize ASC";
					
					// Run the query
					$rs = odbc_exec($conn, $sql);
					if (!$rs)
					  {exit("Error in SQL");}
					while (odbc_fetch_row($rs)) 
					{
					  $LSize = odbc_result($rs,"LSize");
					  echo "<option value='$LSize'>$LSize</option>\n"; 
					}
					odbc_close($conn);	
					?>
				</select><br />
			<p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
			</form></p>
		<?php
		
		
		if(isset($_POST[LSize]))
			{				
				//Check if an option was chosen from the select box
				//display stuff goes here using your Id from your select box to perform the query.
				
				echo "<table id='SortTable' class='tablesorter'>";
				echo "<thead>";
				echo "	<tr>";
				echo "		<th class='w325'>4combo</th>";
				echo "		<th class='w70'>LSymbol</th>";
				echo "		<th class='w70'>ESymbol</th>";
				echo "		<th class='w70'>LSize</th>";
				echo "		<th class='w70'>ESize</th>";
				echo "		<th class='w70' colspan='2'>Action</th>";
				echo "	</tr>";
				echo "<tbody>";
				
				// create database connection
				include("includes/connection.php");
				
				// call the data
				//$sql="SELECT * FROM tbl4combo_symbols WHERE LSize=$_POST[LSize]";
				//$sql="SELECT * FROM tbl4combo_symbols WHERE LSize IN (" . implode(',', $_POST[LSize]) . ")";
				if (is_array($_POST[LSize])){
					$where = "IN (". implode (',', $_POST[LSize]) .")";
				} elseif (!empty($_POST[LSize])){
					$where = "= " . $_POST[LSize];
				$sql="SELECT * FROM tbl4combo_symbols WHERE LSize $where";
				} 
				// submit the query
				$rs=odbc_exec($conn,$sql);
				// if query is invalid do this 
				if (!$rs)
				  {exit("Error in SQL");}
				// if query is valid do this 
				while (odbc_fetch_row($rs))
......
 
Code:
<?php
<p><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="selectForm">        
            <label>By LSize:</label>
                <select name="LSize" multiple="multiple" id="multipleSelect" >
                    <option selected value="">-- Select An LSize --</option>
					[red]<option value="ALL">All LSizes</option>[/red]
                    <?php
                    // create database connection
                    include("includes/connection.php");
                      
                    // Call the data
                    $sql = "SELECT DISTINCT LSize FROM tbl4combo_symbols ORDER BY LSize ASC";
                    
                    // Run the query
                    $rs = odbc_exec($conn, $sql);
                    if (!$rs)
                      {exit("Error in SQL");}
                    while (odbc_fetch_row($rs))
                    {
                      $LSize = odbc_result($rs,"LSize");
                      echo "<option value='$LSize'>$LSize</option>\n";
                    }
                    odbc_close($conn);    
                    ?>
                </select><br />
            <p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>
            </form></p>
        <?php
        
        
        if(isset($_POST['LSize']))
            {                
                //Check if an option was chosen from the select box
                //display stuff goes here using your Id from your select box to perform the query.
                
                echo "<table id='SortTable' class='tablesorter'>";
                echo "<thead>";
                echo "    <tr>";
                echo "        <th class='w325'>4combo</th>";
                echo "        <th class='w70'>LSymbol</th>";
                echo "        <th class='w70'>ESymbol</th>";
                echo "        <th class='w70'>LSize</th>";
                echo "        <th class='w70'>ESize</th>";
                echo "        <th class='w70' colspan='2'>Action</th>";
                echo "    </tr>";
                echo "<tbody>";
                
                // create database connection
                include("includes/connection.php");
                
                // call the data
                //$sql="SELECT * FROM tbl4combo_symbols WHERE LSize=$_POST[LSize]";
                //$sql="SELECT * FROM tbl4combo_symbols WHERE LSize IN (" . implode(',', $_POST[LSize]) . ")";
              [red]  if (is_array($_POST['LSize'])){
                	if (in_array('ALL', $_POST['LSize'])){
                		$where = '';
                	} else {
                    	$where = "WHERE LSize IN (". implode (',', $_POST['LSize']) .")";
					}
                } elseif (!empty($_POST[LSize])){
                    if (in_array('ALL', $_POST['LSize'])){
                		$where = '';
                	} else {
						$where = "WHERE LSize = " . $_POST[LSize];
					}
				}
                $sql="SELECT * FROM tbl4combo_symbols $where";[/red]
                }
                // submit the query
                $rs=odbc_exec($conn,$sql);
                // if query is invalid do this
                if (!$rs)
                  {exit("Error in SQL");}
                // if query is valid do this
                while (odbc_fetch_row($rs))
?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top