$_server[php_self]
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

$_server[php_self]

From: Mikey P <phatnugs420@comcast.net>
Date: Mon Sep 19 2005 - 17:04:15 CEST

hi all i'm having issues with this returned function. I can get it to
delete a database but i really want it to grab the stateselect
extention and grab all the cities related to that state. I wanted to
contain this on one page instead of going over multiple pages which i
can do. Sorry if this doesn't make much sense i'm a newbie.. below is
the code. the isset($_get is where i have the issues. any help would
be appreciated.

<?php

    $dbcnx = @mysql_connect('localhost', 'root', '');
    if (!$dbcnx) {
      die( '<p>Unable to connect to the ' .
           'database server at this time.</p>' );
    }
    // Select the hotel database
    if (! @mysql_select_db('uniguest') ) {
      die( '<p>Unable to locate the Hotel List ' .
           'database at this time.</p>' );
    }

$result = @mysql_query('SELECT DISTINCT state FROM hotelList ORDER by
state');
    if (!$result) {
      die('<p>Error performing query: ' .
          mysql_error() . '</p>');
    }
    while ( $row = mysql_fetch_array($result) ) {
      echo(' | <a href="' . $_SERVER['PHP_SELF'] . '?stateSelect=' .
$row['state'] . '">' . $row['state'] . '</a>');
    }

            // Select the hotel database
    if (! @mysql_select_db('uniguest') ) {
      die( '<p>Unable to locate the Hotel List ' .
           'database at this time.</p>' );
    }

        if (isset($_GET['stateSelect'])) {
        $state2 = $_GET['stateSelect'];
        $query = mysql_query("SELECT * FROM hotelList WHERE state='$state2'
ORDER by name")
        or die (mysql_error());
         $name = $row['name'];
        echo($name);
      } else {
        echo('<p>Error: ' .
             mysql_error() . '</p>');
      }

?>
Received on Tue Oct 18 02:25:42 2005