0

I have the following index.php:

<?php
$uri = $_SERVER["REQUEST_URI"];

require_once "sql.php";
$link = mysqli_connect($host, $user, $pw, $db);
$urls = $link->query("SELECT URL FROM TEST");

    switch ($uri) {
    case "/":
    header("location: http://www.mysite.com/en/index.php");
    break;

    while($rurl = mysqli_fetch_array($urls)){
        case $rurl['URL']:
            header("location: http://www.mysite.com/folder/page.php?test=$rurl['URL']");
         break;
    }

    default:
        include "errors/404.php";
        header("HTTP/1.0 404 Not Found");
    break;
}
?>

I get a couple of errors on the while loop. How can I insert a "case:" into the while?

Thank you

4

1 回答 1

1

为什么要在while循环中使用case?你可以使用一个

if (!empty($rurl['URL'])) 

(不确定我是否得到了你想要做的事情)

于 2013-05-02T00:04:06.507 回答