Parse error: syntax error, unexpected '{' Line 89

I am getting the following error:

Parse error: syntax error, unexpected ‘{’ in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 89

This is the code:

if ($totalRows_avail_state(($row[‘county’]== 0) || ($row[‘county_1’]== 0) || ($row[‘county_2’]== 0)) || ($row[‘county_3’]== 0) || ($row[‘county_4’]== 0)){
echo ‘Be the first in your County’;
}
elseif ($totalRows_avail_state(($row[‘county’]== 1) || ($row[‘county_1’]== 1) || ($row[‘county_2’]== 1)) || ($row[‘county_3’]== 1) || ($row[‘county_4’]== 1)){
echo ‘There are only 2 Spaces Left’;
}
elseif ($totalRows_avail_state(($row[‘county’]== 2) || ($row[‘county_1’]== 2) || ($row[‘county_2’]== 2) || ($row[‘county_3’]== 2) || ($row[‘county_4’]== 2)){
echo ‘There is only 1 Space Left’;
}
elseif ($totalRows_avail_state(($row[‘county’]== 3) || ($row[‘county_1’]== 3) || ($row[‘county_2’]== 3)) || ($row[‘county_3’]== 3) || ($row[‘county_4’]== 3)){
echo ‘Sorry, this county is sold out’;
}

The perplexing part is the error is calling line 89, which is the 2nd elseif statement (echo ‘There is only 1 Space Left’:wink:

Can anyone shed light on this?

Thank you

Gary

Hi

Good idea to wrap code in php tags :wink:

Secondly that doesn’t look like the complete code so which line is actually 89? - Please post the entire code.

Sorry about the tags, I’ll remember next time.

This is line 89

<?php
elseif ($totalRows_avail_state(($row[‘county’]== 2) || ($row[‘county_1’]== 2) || ($row[‘county_2’]== 2) || ($row[‘county_3’]== 2) || ($row[‘county_4’]== 2)){
echo ‘There is only 1 Space Left’;
}
?>

Again, perplexing because I C/P from line one.

Thank you for your help.

Gary

I can’t see anything directly wrong with the code posted so it must be something else causing the php parser to think its line 89

Also php tags mean these:

 and a closing php tag [/ php] without the space.

The entire thing is going goofy. I commented out line 89, and I got this error;

Line 32 is $ss=$_POST[‘state’];
Line 33 is $cs=$_POST[‘county’];

Notice: Undefined index: state in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 32

Notice: Undefined index: county in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 33

Lines 59-64 (I was testing)

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 59

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 60

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 61

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 62

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 63

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 64

Line 84 is

if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0)) || ($row['county_3']== 0) || ($row['county_4']== 0)){
echo 'Be the first in your County';

Fatal error: Function name must be a string in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 84

Start of entire code

<?php ini_set('error_reporting', E_ALL); ?> 
<?php require_once('Connections/assess.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$ss=$_POST['state'];
$cs=$_POST['county'];
$colname_avail_state = "-1";
if (isset($_POST['state'])) {
  $colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
}
$colnam_avail_state = "-1";
if (isset($_POST['county'])) {
  $colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);
}
mysql_select_db($database_assess, $assess);
$query_avail_state = sprintf("SELECT * FROM law_firm WHERE state = '$ss' AND (law_firm.county= '$cs') OR (law_firm.county_1 = '$cs') OR (law_firm.county_2 = '$cs') OR(law_firm.county_3 = '$cs') OR (law_firm.county_4 = '$cs')", GetSQLValueString($colname_avail_state, "text"),GetSQLValueString($colnam_avail_state, "text"));
$avail_state = mysql_query($query_avail_state, $assess) or die(mysql_error());
$row_avail_state = mysql_fetch_assoc($avail_state);
$totalRows_avail_state = mysql_num_rows($avail_state);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

/*echo "$totalRows_avail_state";*/
while ($row = mysql_fetch_array($avail_state)){  

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

echo 'this is row avail state'."$row_avail_state";

}
/*if ( !empty($_POST['county']))
  foreach ( $_POST['county'] AS $id => $name )
    echo 'You have selected '. " {$name}".'<br />';*/
    
    
if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0)) || ($row['county_3']== 0) || ($row['county_4']== 0)){
echo 'Be the first in your County';
}
elseif ($totalRows_avail_state(($row['county']== 1) || ($row['county_1']== 1) || ($row['county_2']== 1)) || ($row['county_3']== 1) || ($row['county_4']== 1)){
echo 'There are only 2 Spaces Left';
}
/*elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2)){
echo 'There is only 1 Space Left';
}
*/elseif ($totalRows_avail_state(($row['county']== 3) || ($row['county_1']== 3) || ($row['county_2']== 3)) || ($row['county_3']== 3) || ($row['county_4']== 3)){
echo 'Sorry, this county is sold out';
}

?>
</body>
</html>
<?php
mysql_free_result($avail_state);
?>

This is all being done on a testing server if that matters.

Again, Thank you for your help.

Gary

PS: I notice your code goes into a nice little box, and I posted the other day and it did as well…how do I make sure I get the box?

Lets see if this is better…

The entire thing is going goofy. I commented out line 89, and I got this error;


Line 32 is $ss=$_POST['state'];
Line 33 is $cs=$_POST['county'];

Notice: Undefined index: state in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 32

Notice: Undefined index: county in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 33

Lines 59-64 (I was testing)


echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 59

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 60

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 61

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 62

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 63

Notice: Undefined variable: row in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 64

Line 84 is


if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0)) || ($row['county_3']== 0) || ($row['county_4']== 0)){
echo 'Be the first in your County';

Fatal error: Function name must be a string in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 84

Start of entire code



<?php ini_set('error_reporting', E_ALL); ?>
<?php require_once('Connections/assess.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$ss=$_POST['state'];
$cs=$_POST['county'];
$colname_avail_state = "-1";
if (isset($_POST['state'])) {
$colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
}
$colnam_avail_state = "-1";
if (isset($_POST['county'])) {
$colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);
}
mysql_select_db($database_assess, $assess);
$query_avail_state = sprintf("SELECT * FROM law_firm WHERE state = '$ss' AND (law_firm.county= '$cs') OR (law_firm.county_1 = '$cs') OR (law_firm.county_2 = '$cs') OR(law_firm.county_3 = '$cs') OR (law_firm.county_4 = '$cs')", GetSQLValueString($colname_avail_state, "text"),GetSQLValueString($colnam_avail_state, "text"));
$avail_state = mysql_query($query_avail_state, $assess) or die(mysql_error());
$row_avail_state = mysql_fetch_assoc($avail_state);
$totalRows_avail_state = mysql_num_rows($avail_state);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

/*echo "$totalRows_avail_state";*/
while ($row = mysql_fetch_array($avail_state)){

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

echo 'this is row avail state'."$row_avail_state";

}
/*if ( !empty($_POST['county']))
foreach ( $_POST['county'] AS $id => $name )
echo 'You have selected '. " {$name}".'<br />';*/


if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0)) || ($row['county_3']== 0) || ($row['county_4']== 0)){
echo 'Be the first in your County';
}
elseif ($totalRows_avail_state(($row['county']== 1) || ($row['county_1']== 1) || ($row['county_2']== 1)) || ($row['county_3']== 1) || ($row['county_4']== 1)){
echo 'There are only 2 Spaces Left';
}
/*elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2)){
echo 'There is only 1 Space Left';
}
*/elseif ($totalRows_avail_state(($row['county']== 3) || ($row['county_1']== 3) || ($row['county_2']== 3)) || ($row['county_3']== 3) || ($row['county_4']== 3)){
echo 'Sorry, this county is sold out';
}

?>
</body>
</html>
<?php
mysql_free_result($avail_state);
?>

That would be the php tags as I’ve mentioned twice now.

<code here>[/ php] (Delete the space in the closing bracket).

It will then look like:

```php

&lt;code here&gt;

Please edit your above post to use the php tags - it makes it much easier on the eye to see everything.

The reason your code is going goofy when commenting out that line is probably because line 89 is not at fault - the parser just thinks it is.

There is this above the function:
if (!function_exists(“GetSQLValueString”)) {

You’ve got an extra } just after the return; at the end of the switch-case block.

With regard to tags around php code in posts, if you click on the “Go Advanced” button, you get a lot more buttons come up in the post area. To put php tags around php code select the code then click on the php icon.

SpacePheonix

I clocked that but on closer inspection the function is wrapped inside the ‘if function exists’

So the two closing } are correct

hence my deleted post

(unless im wrong again, in which case Im logging off til next week :slight_smile: )

I take it back!!!

Line 32 - 34:


$ss=$_POST['state'];
$cs=$_POST['county'];
$colname_avail_state = "-1";

Then down below you’re doing an isset on $_POST[‘state’] ? - You need to do that first before trying to assign the $ss and $cs variables from $_POST values otherwise your script will error if they’re not set in the $_POST array (which it is).


$colname_avail_state = "-1";

if ((isset($_POST['state'])) and (isset($_POST['county'])))
   {
   $ss = $_POST['state'];
   $cs = $_POST['county'];
   $colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
   $colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);

   //Etc
   }

Soz, short reply - got to do something (food related :D)

GWPAUL

Are you sure that last code is the code you had the problem with ?

you have commented out the section


/*if ( !empty($_POST['county']))
foreach ( $_POST['county'] AS $id => $name )
echo 'You have selected '. " {$name}".'<br />';*/

which is great, but if this wasnt commented youd have problems as the foreach doesnt have any {} around the echo.

AND

its on line 89 where your original problem was.

I didn’t think it needed any curly braces as long as it was only one line of code that needed to execute?

I’m going blind here.

The code has 11{ and 11}. The top portion of the code is mostly written by the program and works on other pages. I am still getting the

Parse error: syntax error, unexpected ‘{’ in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 90

elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2)){
echo 'There is only 1 Space Left';
}


<?php ini_set('error_reporting', E_ALL); ?> 
<?php require_once('Connections/assess.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_avail_state = "-1";
if (isset($_POST['state'])) {
  $colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
}
$colnam_avail_state = "-1";
if (isset($_POST['county'])) {
  $colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);
}

mysql_select_db($database_assess, $assess);
$query_avail_state = sprintf("SELECT * FROM law_firm WHERE state = '$ss' AND (law_firm.county= '$cs') OR (law_firm.county_1 = '$cs') OR (law_firm.county_2 = '$cs') OR(law_firm.county_3 = '$cs') OR (law_firm.county_4 = '$cs')", GetSQLValueString($colname_avail_state, "text"),GetSQLValueString($colnam_avail_state, "text"));
$avail_state = mysql_query($query_avail_state, $assess) or die(mysql_error());
$row_avail_state = mysql_fetch_assoc($avail_state);
$totalRows_avail_state = mysql_num_rows($avail_state);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

echo "$totalRows_avail_state";
while ($row = mysql_fetch_array($avail_state)){  

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

echo 'this is row avail state'."$row_avail_state";

}
if ( !empty($_POST['county']))
  foreach ( $_POST['county'] AS $id => $name ){
    echo 'You have selected '. " ($name)".'<br />';
}
	
if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0)) || ($row['county_3']== 0) || ($row['county_4']== 0)){
echo 'Be the first in your County';
}
elseif ($totalRows_avail_state(($row['county']== 1) || ($row['county_1']== 1) || ($row['county_2']== 1)) || ($row['county_3']== 1) || ($row['county_4']== 1)){
echo 'There are only 2 Spaces Left';
}
elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2)){
echo 'There is only 1 Space Left';
}
elseif ($totalRows_avail_state(($row['county']== 3) || ($row['county_1']== 3) || ($row['county_2']== 3)) || ($row['county_3']== 3) || ($row['county_4']== 3)){
echo 'Sorry, this county is sold out';
}

?>
</body>
</html>
<?php
mysql_free_result($avail_state);
?>

I wonder if going to the switch function would help.

Any other suggestions?

Thanks to everyone for having a look.

Gary

You’re missing a closing curly bracket


elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2)){
echo 'There is only 1 Space Left';
}

Right before the { at the end of the line add a ) symbol. There should be 3 of them not 2.

Important EDIT:
Looking at the other elseif’s it may not be the end of the line that needs the extra ) symbol:


//From each elseif clause:
($row['county_2']== 0)) ||
($row['county_2']== 1)) ||
($row['county_2']== 2) || //<<===Gotcha!
($row['county_2']== 3)) ||

Thats the cookie.

I’m somewhat confused, Kevinslair posted a reply that was onto something, but now I dont find it??

Anyway, seems there some missing ) (parens) in the line of code.

So now I am getting the error

Fatal error: Function name must be a string in C:\xampplite\htdocs\assesslawyer\county_avail.php on line 76

line 76


if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0) || ($row['county_3']== 0) || ($row['county_4']== 0))){
echo 'Be the first in your County';
}

I got rid of the $ss and $cs and am using the


$colname_avail_state = "-1";
if (isset($_POST['state'])) {
  $colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
}
$colnam_avail_state = "-1";
if (isset($_POST['county'])) {
  $colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);
}

For so you dont have to scroll up, here it is now in its entirety


<?php ini_set('error_reporting', E_ALL); ?> 
<?php require_once('Connections/assess.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$colname_avail_state = "-1";
if (isset($_POST['state'])) {
  $colname_avail_state = (get_magic_quotes_gpc()) ? $_POST['state'] : addslashes($_POST['state']);
}
$colnam_avail_state = "-1";
if (isset($_POST['county'])) {
  $colnam_avail_state = (get_magic_quotes_gpc()) ? $_POST['county'] : addslashes($_POST['county']);
}
mysql_select_db($database_assess, $assess);
$query_avail_state = sprintf("SELECT * FROM law_firm WHERE state = '$$colname_avail_state' AND (law_firm.county= '$colnam_avail_state') OR (law_firm.county_1 = '$colnam_avail_state') OR (law_firm.county_2 = '$colnam_avail_state') OR(law_firm.county_3 = '$colnam_avail_state') OR (law_firm.county_4 = '$colnam_avail_state')", GetSQLValueString($colname_avail_state, "text"),GetSQLValueString($colnam_avail_state, "text"));
$avail_state = mysql_query($query_avail_state, $assess) or die(mysql_error());
$row_avail_state = mysql_fetch_assoc($avail_state);
$totalRows_avail_state = mysql_num_rows($avail_state);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php 


echo "$totalRows_avail_state";
while ($row = mysql_fetch_array($avail_state)){  

echo $row ['state'].'<br />';
echo $row ['county'].'<br />';
echo $row ['county_1'].'<br />';
echo $row ['county_2'].'<br />';
echo $row ['county_3'].'<br />';
echo $row ['county_4'].'<br />';

echo 'this is row avail state'."$row_avail_state";

}
if ( !empty($_POST['county']))
  foreach ( $_POST['county'] AS $id => $name ){
    echo 'You have selected '. " ($name)".'<br />';
}
	
if ($totalRows_avail_state(($row['county']== 0) || ($row['county_1']== 0) || ($row['county_2']== 0) || ($row['county_3']== 0) || ($row['county_4']== 0))){
echo 'Be the first in your County';
}
elseif ($totalRows_avail_state(($row['county']== 1) || ($row['county_1']== 1) || ($row['county_2']== 1) || ($row['county_3']== 1) || ($row['county_4']== 1))){
echo 'There are only 2 Spaces Left';
}
elseif ($totalRows_avail_state(($row['county']== 2) || ($row['county_1']== 2) || ($row['county_2']== 2) || ($row['county_3']== 2) || ($row['county_4']== 2))){
echo 'There is only 1 Space Left';
} 

elseif ($totalRows_avail_state(($row['county']== 3) || ($row['county_1']== 3) || ($row['county_2']== 3) || ($row['county_3']== 3) || ($row['county_4']== 3))){
echo 'Sorry, this county is sold out';
}

?>
</body>
</html>
<?php
mysql_free_result($avail_state);
?>

Again, thank you to everyone for all the help.

gary

Lol you change your code faster than I can debug it :smiley:

When I do that I call it “trial by idiot”…

@gwpaul: Are you using an editor which supports php or just note/wordpad?

Reason I ask is that the missing parens didn’t take me long to discover using notepad++ - I just pointed to them all to make it show its opposite partner symbol and eventually the odd one turned up which didn’t have a partner.

If you don’t have it, notepad++ is very good.

I’m using dreamweaver cs3. It does highlight code. I just threw the code into notepad++, but did not see any highlighting. I just threw it into newbeans and all looked good…