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

MySQL Insert with PHP

Name: Anonymous 2010-12-17 11:05

I can't figure this out. Something is wrong with my SQL insert statement, and I have no idea what it is. (I also tried setting the variables for all of the values to be input, ie $city = "test" but that didn't work either...halp!)


<form method="POST" action="hw8b.php">
    Name:<br />
    <input type="text" name="name1" /><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

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

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

$_POST["howard"];
$_POST["password"];

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

mysql_select_db("myDB");

$SQLstring = "SELECT MAX(ID) FROM FANS";
$QueryResult = mysql_query($SQLstring);
$Row = mysql_fetch_row($QueryResult);
$fanID = $Row[0] + 1;

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

$QueryResult = mysql_query($SQLstring);

Name: Anonymous 2010-12-17 16:59

You're completely right, using correct syntax is totally gay.
That being said the real question is, why are you using a piece of shit wannabe database like MySQL, when you can get a perfectly fine Oracle database license for just $560?

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