SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help! Why does thid not work?

    I have a problem with a select statement Im doing.
    This works fine
    Code:
    <?php
    error_reporting(E_ALL); 
    $dbh=mysql_connect ("localhost", "user", "xxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("vader_directorytest",$dbh); 
    
    ?>
    However this

    Code:
     
    <?php
    error_reporting(E_ALL); 
    $dbh=mysql_connect ("localhost", "user", "xxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("vader_directorytest",$dbh); 
    select SName,SCity from t_fields where SState = 'nsw'
    ?>
    Gives this error message
    Parse error: parse error in /home/vader/public_html/test.php on line 15

    Line 15 is select SName,SCity from t_fields where SState = 'nsw'

    What am I doing wrong?
    Bill

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    PHP Code:
    <?php 
    error_reporting
    (E_ALL); 
    $dbh=mysql_connect ("localhost""user""xxxxxx" ) or die ('I cannot connect to the database because: ' mysql_error()); 
    mysql_select_db ("vader_directorytest",$dbh); 
    mysql_query("select SName,SCity from t_fields where SState = 'nsw'");
     
    ?>
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Member cybersunil's Avatar
    Join Date
    Apr 2003
    Location
    Mumbai
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Surely you should try giving the select command in mysql_query as mentioned in the post 2.

    Sunil
    Take it easy and life will take you places


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •