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

PHP & MySQL

Name: Anonymous 2010-12-16 11:25

I can't figure out what's fucked up with my insert SQL query in PHP:

HTML Form:

<form method="POST" action="hw8b.php">
    Name:<br />
    <input type="text" name="name" /><br /><br />
    City:<br />
    <input type="text" name="city" /><br /><br />
    Email:<br />
    <input type="text" name="email" /><br /><br />
    <input type="submit" value="Insert">
    </form>


PHP page:

<?php

$DBConnect = mysql_connect("localhost", "mylastname", "");

if (! $DBConnect)
{
  echo "<P>Database not available";
}

$password = "myusername";
$userID = "mypassword";

$name = $_POST["name"];
$city = $_POST["city"];
$email = $_POST["email"];

mysql_select_db("myDBName");

$SQLstring = "INSERT INTO FANS VALUES(" . $name . ",'" . $city . "','" . $email . "');";

$QueryResult = mysql_query($SQLstring);

Name: Anonymous 2010-12-16 12:17

Anyone? Need halp.

Name: Anonymous 2010-12-16 12:37

"INSERT INTO FANS VALUES(" . $name . ",'" . $city . "','" . $email . "');";
$name = "hax";
$city = "'); drop tables; //"

Name: Anonymous 2010-12-16 14:16

>>3
$name = "BOBBY'); drop tables; //"

xkcd lulz
inb4 polecat
inb4 fo``f''

Name: Anonymous 2010-12-16 14:34

>>4
Back to xkcd.

Name: Fuck off, !Ep8pui8Vw2 2010-12-16 14:35

>>5
Fuck off, ``faggot''.

Name: Anonymous 2010-12-16 15:04

>>3

I'm not a dumbshit.



Anyone actually care to give USEFUL advice?

Name: Anonymous 2010-12-16 15:06

>>7
No, fucking TRY it. That's the problem with your code. You should be grateful to get even that, with a  problem description of "fucked up".

Name: Anonymous 2010-12-16 15:11

>>8
>drop tables;

I know SQL.

What I don't know is fucking with it from PHP.

Name: Anonymous 2010-12-16 15:28

>>9
Not that, you moron. Do >>3 in notepad. Substitute the variables manually. Look at what you did wrong in the string, and learn about unescape or whatever it's called.

Name: Anonymous 2010-12-16 15:40

Name: sage 2010-12-16 16:07

Man, I'm a web guy and you fucking suck OP. First off, never use double quotes you gay little faggot. If you have to put variables in a string use http://php.net/manual/en/function.sprintf.php Next you don't fucking know SQL because you don't even declare which fucking fields you're going to store the data in with your query and on top of that you didn't escape...WAIT!! WAIIT...
$password = "myusername";
$userID = "mypassword";???? REALLY!! REALLY? I've been fucking trolled. FUCK YOU OP!

Name: Anonymous 2010-12-16 16:26

>>12

myusername
mypassword

FILLER FIELDS

I'm not giving some random faggots online ANY Inkling of who I am, regardless if you have all the info needed to fuck with me.


also I will use double quotes all the fuck I want...unless you're talking about the actual INSERT cmd...my faggot teacher did all that shit and it makes no fucking sense at all.

Name: Anonymous 2010-12-16 16:53

>>12
Man, I'm a web guy
And it shows.  Maybe you should learn something about programming instead.

Name: Anonymous 2010-12-16 18:04

>>12
$password = "myusername";
$userID = "mypassword";

I didn't notice that. WHBT.

Name: sage 2010-12-16 18:34

>>14
That's the beauty of web programming--I don't have too!
Fuck off, [faggot]`spoiler'[/faggot]

Name: Anonymous 2010-12-16 20:15

Name: Anonymous 2010-12-16 23:09

>>14

Actually I'm first and foremost a programmer. I know VB(garbage)/Java/C++/C#(glorified VB&C++).

I hate this web shit...but it's required for my degree so I'm getting it done.

Had other shit to do earlier so I couldn't work it out after my posts, going to try to now.

Name: Anonymous 2010-12-17 11:22

This thread is convoluted with bullshit replies, apparently.

My feelings are hurt.

Name: Anonymous 2011-02-04 13:23


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