dqcd84732 2013-09-25 17:32
浏览 18
已采纳

too long

I have a PDO/MySQL database connection. My database holds content for various landing pages. To view these landing pages I enter *localhost/landing_page_wireframe.php* and append with ?lps=X (where X represents the Thread_Segment) to display the particular page in the browser. I am now getting to second iterations of these pages and need to add a secondary classifier to follow "Thread_Segment" to distinguish which version I am trying to pull up. Here is a snippet of my current working query.

   <?php
    $result = "SELECT * FROM landing_page WHERE Thread_Segment = :lps";
    $stmt = $connection->prepare($result);
    $stmt->bindParam(':lps', $_GET['lps']);
    $stmt->execute();
    $thread = "";
    $threadSegment = "";
    $version = "";
    $categoryAssociation = "";
    while($row = $stmt->fetch()) {
        $thread = $row["Thread"];
        $threadSegment = $row["Thread_Segment"];
        $version = $row["Version"];
        $categoryAssociation = $row["Category_Association"];
    }
?>

So I need to now change this to add in the secondary classifier to distinguish between versions. I would imagine my query would change to something like this:

$result = "SELECT * FROM landing_page WHERE Thread_Segment = :lps AND Version = :vrsn";

if this is correct so far, then where I am beginning to get lost is in the following PHP code.

    $stmt = $connection->prepare($result);
    $stmt->bindParam(':lps', $_GET['lps']);
    $stmt->execute();

I imagine I need to include some secondary iteration of this in my php to talk to the secondary classifier, but not totally sure how to go about this, and then I would imagine my url appendage would go from ?lps=X to something like this ?lps=X&vrsn=Y (Y representing the version).

I should state that I am somewhat new to PHP/MySql so the answer here may be simple, or may not even be possible. Perhaps I am not even going about this the correct way. Thought you all might be able to shed some insight, or direction for me to curve my research on the matter to. Thanks and apologies for any improper terminology, as I am definitely new to these technologies.

  • 写回答

2条回答 默认 最新

  • drzfnr0275 2013-09-25 17:40
    关注

    The URL change is as you describe. Just add another bindParam call to use that parameter:

    $stmt = $connection->prepare($result);
    $stmt->bindParam(':lps', $_GET['lps']);
    $stmt->bindParam(':vrsn', $_GET['vrsn']);
    $stmt->execute();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号