Jump to content

Blip

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Blip's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey thanks guys, that last change worked. Yeah, I'd like to have time to read a book, butn I don't have that luxury at the moment. Thanks for your help.
  2. It doesn't get set. I'm lifting this code from the net but I don't really understand it What is the first argument of this (SQL) supposed to be? if (!mysql_query($SQL,$con)) Do i use $result instead? Thanks
  3. Hi folks, I'm new to PHP and have been doing ASP so please bear with me I'm getting an empty query error, but I'm not trying to query the database, I'm trying to add records. Can someone tell me what Im doing wrong? It is indeed getting the info from the form and therefore getting the variable values it needs. I know this because I have a "Hello World!" print statement inside of the first "If" and it does print out, so this condidtional woks. so what's wrong? Thanks in advance Also, not that this script lives in a folder named admin, and the database lives in a folder called database. Both are in the same level under the root folder. Is my path for the database wrong? Here's the code <html> <head> </head> <body> <?php $dayname=$_POST['dayname']; $day=intval($_POST['day']); $month=intval($_POST['month']); $year=intval($_POST['year']); $title=$_POST['title']; $description=$_POST['description']; $cost=$_POST['cost']; $location=$_POST['location']; $contact=$_POST['contact']; $type=$_REQUEST["type"]; $con = mysql_connect("mysql","username","password"); if (!$con)   {   die('Could not connect: ' . mysql_error());   } mysql_select_db("Classes", $con); if ($type == "enter") { print "Hello, World!"; $result = mysql_query("INSERT INTO classes (dayname, day, month, year, title, description, cost, location, contact) VALUES ('$dayname', '$day', '$month', '$year', '$title', '$description', '$cost', '$location', '$contact')"); if (!mysql_query($SQL,$con))   {   die('Error: ' . mysql_error());   } header ('location: enter.php'); } if ($type == "edit") { } if ($type == "delete") { } ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.