首页 \ 问答 \ PHP MySQL数据库多重过滤(PHP MySQL Database multi filtration)

PHP MySQL数据库多重过滤(PHP MySQL Database multi filtration)

所以我有一个包含大量属性的表,并将它们显示在网页上。 由于我们的产品范围很广,我开发了一种过滤系统。 但是,在使用时,您只能选择一个标签,但我们希望以某种方式设计它,以便您可以选择一个标签,然后选择另一个标签。 我目前的代码如下。

<h3>Advanced Search:</h3>

    <table>
<tr>
    <td colspan="2" style="vertical-align: top; width:50%; !important;">
          <h3>Location</h3>
          <div>
            <a href="webpropertyloc.php?loc=Alsancak" data-ajax="false" class="ui-btn">Alsancak</a>
            <a href="webpropertyloc.php?loc=Karsiyaka" data-ajax="false" class="ui-btn">Karsiyaka</a>
            <a href="webpropertyloc.php?loc=Lapta" data-ajax="false" class="ui-btn">Lapta</a>
            <a href="webpropertyloc.php?loc=Kayalar" data-ajax="false" class="ui-btn">Kayalar</a>
            <a href="webpropertyloc.php?loc=Sadrazamkoy" data-ajax="false" class="ui-btn">Sadrazamkoy</a>
            <a href="webpropertyloc.php?loc=Camlibel" data-ajax="false" class="ui-btn">Cambeli</a>
            <a href="webpropertyloc.php?loc=Baspinar" data-ajax="false" class="ui-btn">Baspinar</a>
            <!--<a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>
            <a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>
            <a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>-->
          </div>
          </td>


    <td style="vertical-align: top; width:25%;">      
          <h3>Number of Bedrooms</h3>
          <div>
            <a href="webpropertybed.php?bed=1" data-ajax="false" class="ui-btn">1</a>
            <a href="webpropertybed.php?bed=2" data-ajax="false" class="ui-btn">2</a>
            <a href="webpropertybed.php?bed=3" data-ajax="false" class="ui-btn">3</a>
            <a href="webpropertybed.php?bed=4" data-ajax="false" class="ui-btn">4</a>
          </div>
    </td>

然后继续使用另外几个选项,然后页面上的代码如下:

    <h1>Properties</h1>

    <?php
    $loc = $_GET["loc"];
    $con = mysql_connect("localhost","Username","Password");
    mysql_selectdb("db",$con);
    $sql = "SELECT * FROM Properties WHERE Location='$loc' ORDER BY  `Properties`.`Price` ASC";
    $mydata = mysql_query($sql,$con);

    echo "<h4>Location:" . $loc . "</h4><br>";

    while($record = mysql_fetch_array($mydata)){
        echo  "<div id=\"property\">" . "<img src=\"images/" . $record['MainPic'] . "\" id=\"propimg\" align=\"left\">" . "<div id=\"text\" style=\"text-align: center; margin-right:20px;\"><h2>" . $record['Title'] . "</h2>" . $record['Ref'] . "<br/>" . "&pound;" . $record['Price'] . "<br/>" . $record['Location'] . "<br/>" . "<a href=\"property_view.php?id=" . $record['ID'] . "\" data-ajax=\"false\" class=\"ui-btn\" id=\"button\">Details</a></div>" . "<img src=\"images/bottom-line.png\" id=\"bottomline\"></div>" . "</div>" ;

    }

    mysql_close($con);
    ?>

任何帮助都会受到极大的欢迎。 提前致谢!


So I have a table with a whole load of properties and have displayed them on a webpage. As we have a wide range I developed a filtration system. However when used you can only select one tag, but we want to devise it in a way so that you can select one tag and then another. My current code is as follows.

<h3>Advanced Search:</h3>

    <table>
<tr>
    <td colspan="2" style="vertical-align: top; width:50%; !important;">
          <h3>Location</h3>
          <div>
            <a href="webpropertyloc.php?loc=Alsancak" data-ajax="false" class="ui-btn">Alsancak</a>
            <a href="webpropertyloc.php?loc=Karsiyaka" data-ajax="false" class="ui-btn">Karsiyaka</a>
            <a href="webpropertyloc.php?loc=Lapta" data-ajax="false" class="ui-btn">Lapta</a>
            <a href="webpropertyloc.php?loc=Kayalar" data-ajax="false" class="ui-btn">Kayalar</a>
            <a href="webpropertyloc.php?loc=Sadrazamkoy" data-ajax="false" class="ui-btn">Sadrazamkoy</a>
            <a href="webpropertyloc.php?loc=Camlibel" data-ajax="false" class="ui-btn">Cambeli</a>
            <a href="webpropertyloc.php?loc=Baspinar" data-ajax="false" class="ui-btn">Baspinar</a>
            <!--<a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>
            <a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>
            <a href="property.php?loc=" data-ajax="false" class="ui-btn"></a>-->
          </div>
          </td>


    <td style="vertical-align: top; width:25%;">      
          <h3>Number of Bedrooms</h3>
          <div>
            <a href="webpropertybed.php?bed=1" data-ajax="false" class="ui-btn">1</a>
            <a href="webpropertybed.php?bed=2" data-ajax="false" class="ui-btn">2</a>
            <a href="webpropertybed.php?bed=3" data-ajax="false" class="ui-btn">3</a>
            <a href="webpropertybed.php?bed=4" data-ajax="false" class="ui-btn">4</a>
          </div>
    </td>

And it goes on with another few options the code then on the page is as follows:

    <h1>Properties</h1>

    <?php
    $loc = $_GET["loc"];
    $con = mysql_connect("localhost","Username","Password");
    mysql_selectdb("db",$con);
    $sql = "SELECT * FROM Properties WHERE Location='$loc' ORDER BY  `Properties`.`Price` ASC";
    $mydata = mysql_query($sql,$con);

    echo "<h4>Location:" . $loc . "</h4><br>";

    while($record = mysql_fetch_array($mydata)){
        echo  "<div id=\"property\">" . "<img src=\"images/" . $record['MainPic'] . "\" id=\"propimg\" align=\"left\">" . "<div id=\"text\" style=\"text-align: center; margin-right:20px;\"><h2>" . $record['Title'] . "</h2>" . $record['Ref'] . "<br/>" . "&pound;" . $record['Price'] . "<br/>" . $record['Location'] . "<br/>" . "<a href=\"property_view.php?id=" . $record['ID'] . "\" data-ajax=\"false\" class=\"ui-btn\" id=\"button\">Details</a></div>" . "<img src=\"images/bottom-line.png\" id=\"bottomline\"></div>" . "</div>" ;

    }

    mysql_close($con);
    ?>

Any help would be greatly received. Thanks in advance!


原文:https://stackoverflow.com/questions/28726751
更新时间:2022-08-03 16:08

最满意答案

您应该使用自定义函数来交换列表中的两个节点,而不是复制节点的每个结构成员。

void swap(struct client *a, struct client *b)
{
    a->prev->next = b;
    b->prev = a->prev;

    b->next->prev = a;
    a->next = b->next;

    a->prev = b;
    b->next = a;
}

You should use a custom function to swap two nodes in your list instead of copy each struct member of the node.

void swap(struct client *a, struct client *b)
{
    a->prev->next = b;
    b->prev = a->prev;

    b->next->prev = a;
    a->next = b->next;

    a->prev = b;
    b->next = a;
}

相关问答

更多
  • 你的插入函数看起来应该是这样的 void Insert(struct StudentRecords Record) { struct Node* newNode = GetNewNode(Record); struct Node *tmp = head; /* Check if we need to insert at head */ if (head==NULL) { head = newNode; return; } /* Check if new node ...
  • 您应该使用自定义函数来交换列表中的两个节点,而不是复制节点的每个结构成员。 void swap(struct client *a, struct client *b) { a->prev->next = b; b->prev = a->prev; b->next->prev = a; a->next = b->next; a->prev = b; b->next = a; } You should use a custom function to swa ...
  • 滑动链表的更简单方法是这样的: for (node *current = head; current != nullptr; current = current->next) { // This will run through all of the nodes until we reach the end. } 并滑动到倒数第二个项目(确保node->next存在)如下所示: for (node *current = head; current->next != nullptr; current ...
  • 您未正确实现合并排序,该排序基于递归地将列表分为两部分,对它们进行排序并合并结果。 但是在你的代码中,你并没有真正将列表分成两半。 注意在行中: while((head_two != NULL) && (head_two->next != NULL)) { head = head->next; head_two = head->next->next; } head_two = head->next; head->next = NULL; 当head_two到达列表末尾时退出while循环: ...
  • 部分问题是 while ((aux->prox!=NULL)||(aux->prox->time<=time)) 我猜你的意思 while ((aux->prox!=NULL)&&(aux->prox->time<=time)) 我没有寻找其他问题。 再见, 弗朗西斯 Part of the problem is while ((aux->prox!=NULL)||(aux->prox->time<=time)) I guess you meant while ((aux->prox!=NULL)&&(au ...
  • 排序例程,通过比较来决定之前或之后的内容。 如果在函数中进行比较,则元素的顺序由返回确定(例如,小于零(通常为-1 ),零,大于零(通常为1的返回))。 如果要对主要参数进行排序并遇到等效项,请按辅助字符串进行比较,并将这些结果用于展示位置。 在大多数情况下,比较函数将采用指向要比较的每个节点的void指针。 通过这种方式,您可以访问sort函数中的主要和次要字符串。 如果第一次比较的结果等于零,则在sort函数中包含二次比较,并根据该二次比较的结果返回( -1, 0, 1 )。 A sort routin ...
  • 这是合并排序链表的传统和最快方法。 它是一种自下而上的样式合并排序,它使用指向节点的指针数组来保存中间列表,其中array [i]为null或指向列表,其中2表示power i节点。 原始列表中的节点合并到数组中,然后合并阵列中的列表以形成单个排序列表。 HP / Microsoft C ++ STL std :: list :: sort使用相同的算法。 /* prototype */ NODE * MergeLists(NODE *pSrc1, NODE *pSrc2); /* sort list u ...
  • 在分析提供的源代码时,建议的排序算法非常接近预期的“选择排序算法” 。 存在两个嵌套循环,但是执行独立功能。 步骤1 - 通过包括从第一个循环到第二个循环的条件来执行真正的嵌套循环。 要对所有列表进行排序,选择将从索引的下一个节点开始。 for(index = head; index -> next != head; index = index -> next) { // start the selection from the index->next for(selection = ind ...
  • 像这样解决 Node *sort_ll(Node* head){ if(head == NULL || head->next == NULL) return head;//There is no need for processing int max = head->data; Node *prev = head; Node *to_move = NULL; Node *tmp = head->next; //find maximum va ...
  • 问题出在你的find_mid函数上。 如果使用仅包含两个节点的链接列表对其进行测试,您会看到它返回最后一个节点而不是第一个节点。 例: list = ListNode.new(4, ListNode.new(3)) res = find_mid(list) puts res.val # It would print 3 因此,列表将不再缩小,代码将永远或实际上使用大小为2的链表重复递归,直到堆栈太深错误 。 然后解决方案是按如下方式更改功能: def find_mid(head) return n ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)