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

  • Home
  • SEARCH
  • 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 7935127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:49:49+00:00 2026-06-03T21:49:49+00:00

I have problem with showing results from visits table depending on search form !

  • 0

I have problem with showing results from “visits” table depending on search form !

here is the code !

                <?php

                $date1 = $_POST['day'] . "-" . $_POST['month'] . "-" . $_POST['year'];
                $date2 = $_POST['day1'] . "-" . $_POST['month1'] . "-" . $_POST['year1'];
                $product=$_POST['product'];
                $region=$_POST['region'];
                $speciality=$_POST['speciality'];
                $type=$_POST['visit_type'];

$query="SELECT id, name, seller_1_name, seller_2_name FROM visits Where (speciality ='$speciality') AND (type ='$type') AND (product ='$product') AND (date BETWEEN '$date1' AND '$date2')";
$num=mysql_numrows($result);
$row = mysql_fetch_array($result);

?>

<h3> Showing results where Product is <?php echo $product; ?>, Speciality is <?php echo $speciality ?>, Region is <?php echo $region ?> and Type is <?php echo $type ?>.</h3>
        <table class="auto-style4" style="width: 100%" border="1"><tr>
        <td style="height: 18px">ID</td>
        <td style="height: 18px">Name</td>
        <td style="height: 18px">seller one name</td>
        <td style="height: 18px">seller 2 name</td>   
        </tr>
        <tr>
        <?php
$i=0;
while ($i < $num) {


$f1=mysql_result($result,$i,"id");
$f2=mysql_result($result,$i,"name");
$f4=mysql_result($result,$i,"seller_1_name");
$f5=mysql_result($result,$i,"seller_2_name");

?>        
        <td><?php echo $f1; ?> </td>
        <td><?php echo $f2; ?> </td>
        <td><?php echo $f4; ?></td>
        <td><?php echo $f5; ?></td>
         </tr>

<?php
$i++;
}
?>  

it shows the heading with the correct variables entered but the table is empty with error code :

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/ebarea/public_html/…/…/results_submitt.php on line 175

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebarea/public_html/…/…/results_submitt.php on line 176

What’s WRONG >!

  • 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-06-03T21:49:50+00:00Added an answer on June 3, 2026 at 9:49 pm

    You never executed mysql_query. Maybe something along the lines of:

    $query="SELECT id, name, seller_1_name, seller_2_name FROM visits Where (speciality ='$speciality') AND (type ='$type') AND (product ='$product') AND (date BETWEEN '$date1' AND '$date2')";
    $result=mysql_query($query); ## This line is new.
    $num=mysql_numrows($result);
    $row = mysql_fetch_array($result);
    

    To fix your date issues, you may need to be explicit in how you tell MySQL about the dates. For example:

    $query="SELECT 
                id, name, seller_1_name, seller_2_name
            FROM visits 
            WHERE
                (speciality ='$speciality') AND
                (type ='$type') AND
                (product ='$product') AND
                (date BETWEEN DATE('$date1') AND DATE('$date2'))";
    

    As others have pointed out, however, the code you are using to populate your variables is vulnerable to an SQL injection attack, and should really be updated.

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

Sidebar

Related Questions

I have problem with $_POST data. Some fields are missing from input form when
The problem is quite basic. I have a JTable showing cached data from a
I have a working flot graph, showing dynamically from sql using ajax. My problem
http://jsfiddle.net/q8P7Y/ I have a problem of showing the final score at the end, there
I have a problem with validation messages not showing after a redirect, even when
I have a list showing up when I click on button, the problem is
I have problem thinking this trough with PHP & Mysql . I have read
I have a problem on going back (clicking the Back button) from sub-activity to
While working with jQuery and PHP a problem occurs with loading new data from
I'm working on a problem that requires caching paginated search results: Paginating very large

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.