Jump to content

gBase

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gBase's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Out of curiosity, what server would that be?  I'm using Apache.
  2. Hi, I have a PHP/MySQL app that users login to with a server-side login (not application-side.)  What would be the best way to have them logout?  I would like to have a link to a 'logout.php' page (easy enough,) but what is the proper php code to say 'if the user hits the back button, they will be redirected to the opening page' (and therefore prompted to login again.)  Since the login is server-side (.htaccess,) hitting any pages within the directory of the application will need a login the same as the home page.  Thanks for any help.  :)
  3. gBase

    syntax error

    [quote="fenway"]At this point, you could have re-written the entire 10-line script already....[/quote] Do I need to?  I was under the impression I had something that was pretty close to working.
  4. gBase

    syntax error

    Thanks, tried that but still getting same output when I search.
  5. gBase

    syntax error

    Ok, cool...now it works (sort of.)  it displays the correct fields (ID, Name, Organization, etc.) but with no values attached to them, not matter what name I search for.  Any thoughts? In other words, I get: ID: Name: Organization: Title: Street: City: State: Zip:
  6. gBase

    syntax error

    lol...good catch, took those out but I'm still getting the same error... ???
  7. gBase

    syntax error

    Ok...tried that, searched again and got [code] Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 21 [/code]
  8. gBase

    syntax error

    Sure...here's my form: [code] <p><b><font color="blue">Search Records:</b><br /></font> <form action="search.php" method="post" > Name:<br /> <input type="text" name="Name" /><br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset"> </form></p> [/code] and here's the php file: [code] <?php include('db_login.php'); $connection = mysql_connect($db_host, $db_username, $db_password); $db_select = mysql_select_db($my_database);     $db = "my_database";     mysql_select_db($db) or die("Could not select the database '" . $db . "'.  Are you sure it exists?"); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $request = mysql_query("SELECT ID, Name, Organization, Title, Street, City, State, Zip FROM table01 WHERE ID LIKE '%$_POST['Name']%'"); // Loop through the results. while ($result_row = mysql_fetch_row(($result))) { echo 'ID: '.$result_row[0] . '<br />'; echo 'Name: '.$result_row[1] . '<br />'; echo 'Organization: '.$result_row[2]. '<br />'; echo 'Title: '.$result_row[3]. '<br />'; echo 'Street: '.$result_row[4] . '<br />'; echo 'City: '.$result_row[5]. '<br />'; echo 'State: '.$result_row[6]. '<br />'; echo 'Zip: '.$result_row[7]. '<br /><br />'; } // free the results mysql_free_result($request); // Close the connection mysql_close($connection); ?> [/code]
  9. gBase

    syntax error

    Yes, I'm using a form which takes the 'Name' string from the user and passes it to a php file that's supposed to find the IDs in the database that correspond to that name and display the records.  Thanks, I tried $_POST['Name'] but still am getting a blank result when I try to search for a Name.
  10. gBase

    syntax error

    I'm not sure how to define it/give it values...I thought searchTerm was where I put the search field for the user to search for.
  11. gBase

    syntax error

    Right now I have this: [code] $request = mysql_query("SELECT ID, Name, Organization, Title, Street, City, State, Zip FROM table01 WHERE ID LIKE '%$Name%'"); [/code] I want the search string to be someone's Name, and the code to find the IDs (primary key) in my database that correspond with that name and display the available records...
  12. gBase

    syntax error

    Ok...now I'm not getting any more errors, but when I search for a person's name, I get nothing on the next page (at all.)  Thanks for your help tho... :)
  13. gBase

    syntax error

    [code] <?php include('db_login.php'); $connection = mysql_connect($db_host, $db_username, $db_password); $db_select = mysql_select_db($my_database);     $db = "my_database";     mysql_select_db($db) or die("Could not select the database '" . $db . "'.  Are you sure it exists?"); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $request = mysql_query("SELECT ID, Name FROM tableName WHERE colName LIKE '%$searchTerm%'"); echo ' <table>'; // Loop through the results. while ($row = mysql_fetch_assoc($request)) echo ' <tr> <td>', $row['ID'], '</td> <td>', $row['Name'], '</td> </tr>'; // free the results mysql_free_result($request); echo ' </table>'; } // Close the connection mysql_close($connection); ?> [/code]
  14. gBase

    syntax error

    Looks good...tried it but I got a parse error: [code] Parse error: syntax error, unexpected '}' on line 22 [/code] WTF...There's no } there!!
  15. gBase

    syntax error

    Hmmm...I'm not sure if this is doing what I need it to do...I want the user to be able to search for strings for fields like 'Name,' and this code will query the database for the ID (primary key) of any records with that 'Name', and display the records.  Is there a query that would work better?  Thanks!  :)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.