Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Selecting Info from MYSQL table

Name: Anonymous 2008-12-05 22:59

Lets say I have a link on a webpage, a name of a ship per chance.  And I want the user to be able to click on the ship name, and be able to see all of the orders the ship has.  I have the SQL statement, but how do I go about having the link name inserted into the SQL statement? 

ex.
(in SQL statement form)
Select* from 'ship_orders'
where ship_name=(Link name here ie. a ship name located in the database);

I hope this makes sense (I'm actually quite new to PHP and SQL code, so it's kind of hard to explain what I want.. sorry)

Name: Anonymous 2008-12-06 3:47

>>7
You should be using the ENTERPRISE BEST PRACTICES for SQL string escaping [1]


  if(get_magic_quotes_gpc()) {
    $ship_name = stripslashes( $_GET['ship'] );
  } else {
    $ship_name = $_GET['ship'];
  }

    $ship_name = mysql_real_escape_string( $ship_name );
    mysql_query( "SELECT * FROM ship_orders WHERE ship_name='$ship_name'" );


[1]. http://ca3.php.net/mysql_real_escape_string

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List