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:
Anonymous2008-12-05 23:14
fuck that.
PHP is a toy language. what you really want is scalability and power.
lrn2java
then
lrn2PreparedStatement
Name:
Anonymous2008-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']."'");
}
It's only fair, anyone still relying on magic quotes has it coming.
Name:
Anonymous2008-12-06 13:27
>>16
PHP 6 is vaporware written by an Asian transsexual. Good luck with that.
Name:
Anonymous2008-12-06 17:11
1. Stop being a faggot. PHP is absolute shit. MySQL is not a modern implementation of a RDMS. The current MySQL smells like 1998 RDMSes.
2. If you insist on being a faggot, do not write dynamic SQL queries. Dynamic queries or for idiots and amatures. Write stored procedures for app data queries. Stored procedures are a recent MySQL development, which is just fucking faggy as shit they didn't implement them years ago. As long as you do not have dynamic sql in the stored proc, you will not have sql injection attacks. You can also give no access to the DB tables for the user used by the web app, so the only access is done by the sp's and you can be sure what they do because you fucking wrote them.
It is so fucking funny how these faggy PHP/MySQL devs have no concept of basic database security. Even mature PHP scripts are fucking disgusting.