I can not find the parse error<

liunx

Guest
OK the server is telling me I have a parse error on line 47 but I cant find it maybe you guys can.....

<?php
require'conn_func.php';
?>

<?php

$supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.';

function search_data() {

global $supersecret_hash_padding, $search;

$conn = db_connect();

$loc = $_POST['loc'];

$user = $_POST['user'];
$man = $_POST['manufact'];
$device = $_POST['device_name'];

$chelsea = $_POST['chelsea'];
$gp4 = $_POST['gp4'];
$ap1 = $_POST['ap1'];
$ap2 = $_POST['ap2'];
$ap3 = $_POST['ap3'];

$macs1 = strtoupper($_POST['mac1_1']);
$macs2 = strtoupper($_POST['mac1_2']);
$macs3 = strtoupper($_POST['mac1_3']);
$macs4 = strtoupper($_POST['mac1_4']);
$macs5 = strtoupper($_POST['mac1_5']);
$macs6 = strtoupper($_POST['mac1_6']);

$macs = array($macs1, $macs2, $macs3, $macs4, $macs5, $macs6);

$mac = "$macs[0]:$macs[1]:$macs[2]:$macs[3]:$macs[4]:$macs[5]";

if( !$user && !$man && !$device && !$macs1 && !$macs2 && !$macs3 && !$macs4 && !$macs5 && !$macs6
&& !$chelsea && !$gp4 && !ap1 && !$ap2 && !$ap3 )

$feedback = "ERROR-----Please Fill in at least one field!!!!!";
return $feedback;

///////////////////////MAC SEARCH

//////line 47 is below
elseif( !$user && !$man && !$device && !$chelsea && !$gp4 && !ap1 && !$ap2 && !$ap3 )

$query = "SELECT *
FROM $loc
WHERE mac = '$mac'";

$result = mysql_query($query) or die("query failed!!".mysql_error());
$array = mysql_fetch_row($result);

$user = $array[1];
$man = $array[2];
$device = $array[3];

$mac = $array[4];

$chelsea = $array[5];
$gp4 = $array[6];
$ap1 = $array[7];
$ap2 = $array[8];
$ap3 = $array[9];

$search = "<tr><td>$user</td><td>$man</td><td>$device</td><td>$mac</td><td>$chelsea</td><td>$gp4
</td><td>$ap1</td><td>$ap2</td><td>$ap3</td></tr>";

/////////////////////////////////User Search//////////////////////////////
/////(!$user && !$man && !$device && !$macs1 && !$macs2 && !$macs3 && !$macs4 && !$macs5 && !$macs6
//&& !$chelsea && !$gp4 && !ap1 && !$ap2 && !$ap3)

elseif (!$user && !$man && !$device && !$macs1 && !$macs2 && !$macs3 && !$macs4 && !$macs5 && !$macs6
&& !$chelsea && !$gp4 && !ap1 && !$ap2 && !$ap3)
$query = "SELECT * FROM $loc WHERE user = '$user'";

$result = mysql_query($query) or die("query failed!!".mysql_error());
$num_row = mysql_num_rows($result);
$array = mysql_fetch_row($result);
print_r($array);

if ($result && $num_row = 0) {
$feedback = 'ERROR-----There are no devices matching that information!!!!!';
return $feedback;
}else{
if ($result && $num_row = 1) {
$user = $array[1];
$man = $array[2];
$device = $array[3];

$mac = $array[4];

$chelsea = $array[5];
$gp4 = $array[6];
$ap1 = $array[7];
$ap2 = $array[8];
$ap3 = $array[9];

$search = "<tr><td>$user</td><td>$man</td><td>$device</td><td>$mac</td><td>$chelsea</td><td>
$gp4</td><td>$ap1</td><td>$ap2</td><td>$ap3</td></tr>";
}else{
print_r($array);
//for ($i=0; $i < $num_row; $i++) {

}
}

//function view_data() {

//$conn = db_connect();

//$loc = $_POST['loc'];

//$query = "SELECT * FROM $loc";

//$result = mysql_query($query) or die("query failed!!".mysql_error());

//if (!$result) {

//$feedback = 'ERROR--Database error';

//return $feedback;
//}else{
//$array = mysql_fetch_array($result);

//$search = "";
//}
//}
?>your IF statement is built wrong:

what you have (line 47):

elseif( !$user && !$man && !$device && !$chelsea && !$gp4 && !ap1 && !$ap2 && !$ap3 )

what you need:

elseif((!$user)&&(!$man)&&(!$device)&&(!$chelsea)&&(!$gp4)&&(!ap1)&&(!$ap2)&&(!$ap3))you can do that Horus, it is fine. but I don't like the fact that he is using the short version of the if statement.

you need to use {} in your if's or you will get errors like this and not know where they are or why or even if it is the if statement.thanks again!!!!!!!!http://www.htmlforums.com/newreply.php?action=newreply&threadid=43516#OK I made those changes and now I have a parse error on the very last line.....

<?php
require'conn_func.php';
?>

<?php
$supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.';

function search_data() {

global $supersecret_hash_padding, $search;

$conn = db_connect();

$loc = $_POST['loc'];

$user = $_POST['user'];
$man = $_POST['manufact'];
$device = $_POST['device_name'];

$chelsea = $_POST['chelsea'];
$gp4 = $_POST['gp4'];
$ap1 = $_POST['ap1'];
$ap2 = $_POST['ap2'];
$ap3 = $_POST['ap3'];

$macs1 = strtoupper($_POST['mac1_1']);
$macs2 = strtoupper($_POST['mac1_2']);
$macs3 = strtoupper($_POST['mac1_3']);
$macs4 = strtoupper($_POST['mac1_4']);
$macs5 = strtoupper($_POST['mac1_5']);
$macs6 = strtoupper($_POST['mac1_6']);

$macs = array($macs1, $macs2, $macs3, $macs4, $macs5, $macs6);

$mac = "$macs[0]:$macs[1]:$macs[2]:$macs[3]:$macs[4]:$macs[5]";

if((!$user) && (!$man) && (!$device) && (!$macs1) && (!$macs2) && (!$macs3) && (!$macs4) && (!$macs5) && (!$macs)
&& (!$chelsea) && (!$gp4) && (!ap1) && (!$ap2) && (!$ap3)){

$feedback = "ERROR-----Please Fill in at least one field!!!!!";
return $feedback;

///////////////////////MAC SEARCH//////////////////////////

}elseif((!$user) && (!$man) && (!$device) && (!$chelsea) && (!$gp4) && (!ap1) && (!$ap2) && (!$ap3)){

$query = "SELECT *
FROM $loc
WHERE mac = '$mac'";

$result = mysql_query($query) or die("query failed!!".mysql_error());
$array = mysql_fetch_row($result);

$user = $array[1];
$man = $array[2];
$device = $array[3];

$mac = $array[4];

$chelsea = $array[5];
$gp4 = $array[6];
$ap1 = $array[7];
$ap2 = $array[8];
$ap3 = $array[9];

$search = "<tr><td>$user</td><td>$man</td><td>$device</td><td>$mac</td><td>$chelsea</td><td>$gp4
</td><td>$ap1</td><td>$ap2</td><td>$ap3</td></tr>";

/////////////////////////////////User Search//////////////////////////////
/////((!$user) && (!$man) && (!$device) && (!$macs1) && (!$macs2) && (!$macs3) && (!$macs4) && (!$macs5) && (!$macs6) && (!$chelsea) && (!$gp4) && (!ap1) && (!$ap2) && (!$ap3))

}elseif((!$man) && (!$device) && (!$macs1) && (!$macs2) && (!$macs3) && (!$macs4) && (!$macs5) && (!$macs6)
&& (!$chelsea) && (!$gp4) && (!ap1) && (!$ap2) && (!$ap3)){

$query = "SELECT * FROM $loc WHERE user = '$user'";

$result = mysql_query($query) or die("query failed!!".mysql_error());
$num_row = mysql_num_rows($result);
$array = mysql_fetch_row($result);
print_r($array);

if ($result && $num_row = 0) {
$feedback = 'ERROR-----There are no devices matching that information!!!!!';
return $feedback;
}else{
if ($result && $num_row = 1) {
$user = $array[1];
$man = $array[2];
$device = $array[3];

$mac = $array[4];

$chelsea = $array[5];
$gp4 = $array[6];
$ap1 = $array[7];
$ap2 = $array[8];
$ap3 = $array[9];

$search = "<tr><td>$user</td><td>$man</td><td>$device</td><td>$mac</td><td>$chelsea</td><td>
$gp4</td><td>$ap1</td><td>$ap2</td><td>$ap3</td></tr>";
}else{
print_r($array);
//for ($i=0; $i < $num_row; $i++) {
}
}
}

function view_data() {

$conn = db_connect();

$loc = $_POST['loc'];

$query = "SELECT * FROM $loc";

$result = mysql_query($query) or die("query failed!!".mysql_error());

if (!$result) {
$feedback = 'ERROR--Database error';
return $feedback;

}else{
$array = mysql_fetch_array($result);

$search = '';
}
}
?>That probably means you're missing a }

Try adding one of those in there.yes, you are missing a } right before the last function. so you forgot the close the first function.
 
Back
Top