Mod_ReWrite / ReWriteMap a URL using a database lookup script

前端 未结 3 706
[愿得一人]
[愿得一人] 2021-01-17 04:40

The Scenario
I have completely rewritten an old existing ASP classic ecommerce website over to PHP.

The database design of the previous site had

3条回答
  •  星月不相逢
    2021-01-17 04:59

    You should have a different get variable name for the new ID. That way in your new program you will know whether to match the product using the old ID or the new one.

    $old = isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0 ? $_GET['id'] : 0;
    $new = isset($_GET['new']) && is_numeric($_GET['new']) && $_GET['new'] > 0 ? $_GET['new'] : 0;
    if ($old + $new > 0) {
        $query = 'SELECT * FROM `ProductDetails` WHERE '.($old > 0 ? '`OrigPrdID`='.$old : '`PrdDetID`='.$new).' LIMIT 1;';
        ...
    

提交回复
热议问题