Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:37:54+00:00 2026-05-26T11:37:54+00:00

I am practicing with php mysql search results. The only problem I am getting

  • 0

I am practicing with php mysql search results. The only problem I am getting is that the search isn’t consistent in returning results.

Please visit:

weezy.co.uk/newresults.php

type in ‘trainee’ in the first search box at the top.
Sometimes the results show sometimes they don’t. I don’t get it?

my HTML search box code is:

<form action="newresults.php" method="post" name="form">
<input type="text" id="search" name="search" 
size="30" value="" style="background-    color:white; border: 
solid 1px #ffffff; height: 30px; font-size:19px; font-family: 
HelveticaNeue-Light; font-weight: 1;
vertical-align:9px;color:#151515" 
onfocus="if(this.value == ''){this.value = 
'';this.style.color='#363D42'}" />
</div>
</div>
<div class="search">
<div class="search1">
<input type="text" 
id="searchterm" name="searchterm"  size="25" value="" style="background- 
color:white;  border: 
solid 1px #ffffff; height: 30px; font-size:19px; font-family: 
HelveticaNeue-Light; font-            weight: 1;
vertical-align:9px;color:#151515" 
onfocus="if(this.value == ''){this.value = 
'';this.style.color='#363D42'}" />
</form>

php code:

<?php

$conn = mysql_connect("", "", "");

if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}

{

$search = "%" . $_POST["search"] . "%";
$searchterm = "%" . $_POST["searchterm"] . "%";

}

if (!mysql_select_db("weezycouk_641290_db1")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
}

$sql = "SELECT name,lastname,email 
    FROM   test_mysql
    WHERE  name LIKE '$search%' AND lastname LIKE '$searchterm%'";

$result = mysql_query($sql);

if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}

if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}


while ($row = mysql_fetch_assoc($result)) {
echo '<br>';
echo '<br>';
echo '<div class="data1">';
echo $row["name"];
echo '</div>';
echo '<br>';
echo '<div class="data2">';
echo $row["lastname"];
echo '</div>';
echo '<br>';
echo '<div class="data3">';
echo $row["email"];
echo '</div>';
}

mysql_free_result($result);

?>

Thanks guys!

James

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:37:55+00:00Added an answer on May 26, 2026 at 11:37 am

    When your page loads with results, you also load a “Tags” sidebar with the question “Want the recruiters to find you?” The input boxes in that sidebar are filled in with “Enter name” and “Enter chosen industry.” The “name” attribute on both those inputs is “search,” so you are posting multiple fields named “search.”

    Just change the names on the inputs in your sidebar to fix this bug. You should definitely sanitize the inputs (as others have noted), too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm practicing some file upload with PHP and I was uploading a file numerous
I was practicing SRM Problems in Topcoder.I came across this problem Problem Statement: Today
I was practicing the dynamic programming problem on SPOJ. But I have no idea
I am practicing with PHP and AJAX but I have some problems! I'm trying
I am new to PHP and I am practicing the file_put_contents() function, and I
i'm new at php and i'm practicing with the basics of php now i
I am actually practicing Greedy Algorithms and There is a problem on topcoder.. So
I was just practicing some coding and noticed that I was able to use
I am practicing StringToByteArray() on VS2005. But throw exception. Could you please tell me
I've been practicing certain techniques in XNA and lately came across an issue that's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.