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-05 23:26

You'll have to create one if statement for each ship, i.e.
if($_GET['ship']=="hax"){
    mysql_query("Select* from 'ship_orders'
where ship_name='hax'");
}elseif($_GET['ship']=="my"){
    mysql_query("Select* from 'ship_orders'
where ship_name='my'");
}elseif($_GET['ship']="anus"){
    mysql_query("Select* from 'ship_orders'
where ship_name='anus'");
}else{
    mysql_query("Select* from 'ship_orders'
where ship_name='".$_GET['ship']."'");
}

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