Page 1 of 1

*New error* data from form to mysql help please

Posted: Mon Feb 16, 2004 1:26 am
by mikegotnaild
I get "Parse error: parse error in /www/n/naild/htdocs/localmm/modules/Band_List/submit.php on line 23"
And i dont understand why. Heres my code for both the form and the action.

submitaband.php

Code: Select all

<? 
if(!eregi("modules.php", $_SERVER&#1111;'PHP_SELF']))&#123; 
     die("You can't access this file directly..."); 
&#125; 

$module_name = basename(dirname(__FILE__)); 
$module_dir = "modules/$module_name/"; 
include("header.php"); 
$index = 1;//right sidebar or not 0=off 1=on 
title("Submit a band"); 
OpenTable(); 
?> 

<FORM ACTION="http://naild.com/localmm/modules.php?name=Band_List&file=submit" METHOD="POST"> 
Band Name:<br>
<input type="text" name="band_name"size=20><br>
Description:<br>
<textarea cols=65 rows=10 name="description"></textarea><br>
History:<br>
<textarea cols=65 rows=10 name="history"></textarea><br> 
Influences:<br>
<input type="text" name="influences"size=65><br>
Select Genra:<br>
<select name="genra" size=20 multiple><br>
<option>Acoustic 
<option>Alternative 
<option>Blues 
<option>Christian 
<option>Classic Rock 
<option>Classical 
<option>Country 
<option>Cover Bands 
<option>Death Metal 
<option>Disc Jockey 
<option>Easy Listening 
<option>Electronic 
<option>Emo 
<option>Experimental 
<option>Folk 
<option>Funk 
<option>Gospel 
<option>Gothic 
<option>Grunge 
<option>Hardcore 
<option>Hip Hop 
<option>Instrumental 
<option>Jazz 
<option>Metal 
<option>Modern Rock 
<option>Progressive 
<option>Punk 
<option>Rap 
<option>Reggae 
<option>Rock 
<option>Speed Metal 
<option>Swing 
<option>Techno 
</select>
<br> 
   Email:<br>
   <input type="text" name="email"size=20><br>
   Website:<br>
   <input type="text" name="website"size=20><br>
   <input type="submit" name="submit" value="submit">
</form>
<?php 
CloseTable(); 
include("footer.php"); 
?>
Submit.php

Code: Select all

<?
//MySQL Variables
$host = "host";
$login_name = "user";
$password = "pass";

//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");

//Select the database
MySQL_select_db("bandsandmembers") or die("Could not select database");

//Assign contents of form to variables
$bandname = $_POST&#1111;'band_name']; 
$description = $_POST&#1111;'description'];
$history = $_POST&#1111;'history'];
$influences = $_POST&#1111;'influences'];
$genra = $_POST&#1111;'genra'];
$email = $_POST&#1111;'email'];
$website = $_POST&#1111;'website'];

$sql = "INSERT INTO nuke_bands FROM bandsandmembers SET
band_name = "$bandname", // THIS IS LINE 23
description = "$description"
history = "$history"
influences = "$influences"
genra = "$genra"
Email = "$email"
website = "$website"
"); 

$result = mysql_query($sql);

//Code to check if statement executed properly and display a page
if ($result) &#123;
header("Location: http://naild.com/localmm/modules.php?name=Band_List&file=sent");
&#125; else &#123;
echo("An error has occured");
&#125;
//Close connection with MySQL
MySQL_close()
?>

Posted: Mon Feb 16, 2004 2:49 am
by microthick

Code: Select all

//Select the database 
MySQL_select_db("bandsandmembers") or die("Could not select database" 

//Assign contents of form to variables 
$bandname = $_POST&#1111;'band_name']; // THIS IS LINE 14
Missing semi-colon on line 12... where you are selecting the database.

Posted: Mon Feb 16, 2004 3:06 am
by mikegotnaild
Now im getting a new error on line 23

Posted: Mon Feb 16, 2004 3:18 am
by mikegotnaild
Should i be doing this

Code: Select all

$sql = "INSERT INTO nuke_bands FROM bandsandmembers (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','#email','$website')");

Posted: Mon Feb 16, 2004 3:21 am
by mikegotnaild
That doesnt work either

Posted: Mon Feb 16, 2004 3:24 am
by markl999
sql = "INSERT INTO nuke_bands (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','$email','$website')";

Not sure what the 'FROM bandsandmembers' bit was trying to do :o

Posted: Mon Feb 16, 2004 3:27 am
by mikegotnaild
lol DUH!

Posted: Mon Feb 16, 2004 3:30 am
by mikegotnaild
im still getting an error on that line though

$sql = "INSERT INTO nuke_bands (band_name, description, history, influences, genra, Email, website) VALUES ('$bandname','$description','$history','$influences','$genra','$email','$website')";

Posted: Mon Feb 16, 2004 3:31 am
by mikegotnaild
nevermind i had an e xtra )

Posted: Mon Feb 16, 2004 3:32 am
by mikegotnaild
YAY my FIRST working data submission into mysql!

Posted: Mon Feb 16, 2004 3:41 am
by mikegotnaild
i got ONE tiny problem with this. When i test my form and submit it. All information is recorded correctly to the database Except for email. In phpmyadmin under the Column Email. It shows #Email and not the correct information. What is making this happen?

Posted: Mon Feb 16, 2004 6:21 am
by markl999
Cause you left in the #email (in the INSERT query) instead of $email as i'd corrected? ;)