Redirect A Certain Page if * Does not exist?
<p>I have a <code>profile.php</code> page, and when someone views their own profile, it grabs the id of their user and adds <code>profile.php?UserID=*</code> (* being the id number of a user). At the moment, there is no legit way to look at others profiles, but you are able to change the id in the url. Problem is, you can go to the profile of a user who doesn't exist and make it will be the default profile page without anything on it. Is there a way to get the id from a page/url and see if it exists or not, and if not, to redirect to a certain page?</p>

<pre><code>&lt;?php
    include('./dbnotseen/global.php');
    $profile = mysql_query("SELECT * FROM admin WHERE username='$username'");
    $row = mysql_fetch_array($profile);
    $username = $row['username'];

    if (($session_username)) {

    }else {
        ("location: index.php");
    }

    //max per page
    $per_page = 1;

    //get start variable
    $start = $_GET['UserID'];

    //count records
    $record_count = mysql_num_rows(mysql_query("SELECT * FROM admin"));

    //count max pages
    $mac_pages = $record_count / $per_page;

    if (!$start)
        $start = 0;

    //display data
    $get = mysql_query("SELECT * FROM admin WHERE id='$start'");
    while ($row = mysql_fetch_array($get)) {
        $id = $row['username']; 
        $picture = $row['picture'];
        $admin = $row['admin'];
        $status = $row['status'];
        $desc = $row['description'];
        $twitter = $row['twitter'];
    }
?&gt;
</code></pre>

<p>That's the main part of the PHP in the profile.php. The rest is just getting a status, description etc.</p>
