| 
 Posted by Mikey P on 09/19/05 18:04 
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>'); 
      } 
 
 
?>
 
  
Navigation:
[Reply to this message] 
 |