The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database search filter
#41
Hi Sorry have not been active, my project got scraped Sad

LBC, I think you may need to remove the initial code blocks and just have:

Code:
if($project == 1){
Code:
$project = '1';
Code:
}

Code:
if($volunteer == 1){
Code:
$volunteer = '1';
Code:
}

Then when it comes to returning the results you would have something like:

Code:
if(!empty($_POST)){
Code:
echo "<strong>Here's what we found under Volunteers...</strong><br>";
Code:
if(!empty($matches) && $volunteer == 1){
Code:
foreach ($matches as $m){
Code:
$foundQ = $db->query("SELECT * FROM users WHERE volunteer = 1 AND id = ?",($m));
Code:
$found = $foundQ->first();
Code:
echo '<a href="users/profile.php?id='.$found->id.'"'.'>'.$found->fname.' '.$found->lname.'</a><br>';
Code:
}
Code:
}else{
Code:
echo "Sorry. No users were found";
Code:
}
Code:
}
Code:
?>

Hopefully the syntax is correct and this returns the results you are after. If this works you can insert an elif for projects.
  Reply
#42
Hmm...that looks like you dropped all the other boxes. Or did you mean:

<pre>
Code:
if($project == 1){
$project = '1';
}
</pre>


<pre>
Code:
if($volunteer == 1){
$volunteer = '1';
}
</pre>


<pre>
Code:
if($small_animals == 'small animals'){
$small_animals = 'small animals';
}
</pre>


<pre>
Code:
if($large_animals == 'large_animals'){
$large_animals = 'large animals';
}
</pre>


etcetera etcetera...
  Reply
#43
Only Project and Volunteer code blocks are changed.

Small animals etc remains the same.
  Reply
#44
Nope...its not giving any results from project or volunteer search. ( array(0) {} )
It finds users from the other boxes but is not displaying them.
  Reply
#45
so after spending a bit of time setting up a test the solution is as follows:

Replace
Code:
$foundQ = $db->query("SELECT * FROM users WHERE volunteer = 1 AND id = ?",($m));

with
Code:
$foundQ = $db->query("SELECT * FROM users WHERE volunteer = '1' AND id = ?",($m));

notice the single quotes around the 1.

Works on my system so hopefully will work on yours. Smile

  Reply
#46
Thank you for your effort sabr, but I'm afraid it doesn't work.

When I now check the Project box alone it sees the user (id 99), but it doesnt display it in the results.
Code:
array(1) {
Code:
[0]=>
Code:
object(stdClass)#7 (1) {
Code:
["id"]=>
Code:
string(2) "99"
Code:
}
Code:
}

Also, when I check the Project box AND the Small Animals box it gives me the Volunteer users that have set Small Animals as an interest. When it should only give me the Project user.

I have sent mudmin all the data (sql and php) and he is taking a crack at it on his own system.

Fingers crossed Smile
  Reply
#47
My brain has just engaged and worked out why you are seeing this.
I can think of a complex way to solve this but would like to see what Mudmin comes up with. Smile
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)