LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-23-2007, 02:11 PM   #1
Scooby-Doo
LQ Newbie
 
Registered: Oct 2007
Posts: 4

Rep: Reputation: 0
Parse error: parse error, unexpected $ in /home/content/d/o/m/domain/html/addpuppy2.p


Hi I'm new to PHP and I'm building a site for my Mom. I am trying to insert data into the database but I keep getting this error.

Parse error: parse error, unexpected $ in /home/content/d/o/m/domain/html/addpuppy2.php on line 29

I think I have something wrong with my coding (wouldn't be suprised) and I would greatly appreciate if you could help me. Here's the page's coding.

PHP Code:
<?php
//DB connect info goes here.

mysql_select_db("tttbd"$con);
   
$sql="INSERT INTO addpup (name, breed_id, sex, birth_month, birth_day, birth_year, currency, price, ship_incl, ship_area, registered, vaccinated, vet_exam, health_cert, health_guar, pedigree, travel_crate, more_info)
VALUES
    ('$_POST[name]','$_POST[breed_id]','$_POST[sex]','$_POST[birth_month]','$_POST[birth_day]','$_POST[birth_year]','$_POST[currency]','$_POST[price]','$_POST[ship_incl]','$_POST[ship_area]','$_POST[registered]','$_POST[vaccinated]','$_POST[vet_exam]','$_POST[health_cert]','$_POST[health_guar]','$_POST[pedigree]','$POST[travel_crate]','$_POST[more_info]')"
;

    if (!
mysql_query($sql,$con))
    
$title "Your Puppy Added Successfully!";
  {
  die(
'<font color="ff000">Error: an error occured, please contact the website builder.</font>');
  
$title "I'm sorry and error occured";
  }
echo 
"Your Puppy has been added successfully!";
mysql_close($con)
?>
<html>
<head>
<title><?php echo $title ?></title>

</head>
<body>

<?php
    
echo $title 
?>
<br>
Please click <a href="#">HERE</a> to continue.
</body>
</html>
This is a puppy website and this page is used to upload my Mom's info.
 
Old 10-23-2007, 11:19 PM   #2
derzok
Member
 
Registered: Aug 2004
Location: Ohio
Distribution: Debian, Slackware
Posts: 58

Rep: Reputation: 15
For starters, you need to put semicolons ( ; ) at the end of ALL your php commands. That includes the echo $title commands as well as your mysql_close() command
 
Old 10-24-2007, 09:06 PM   #3
Scooby-Doo
LQ Newbie
 
Registered: Oct 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Well, I'm confused, because it still doesn't work. Umm... I made the original script when I hosted my domain with hostgator and I recently switched to Godaddy and the script worked with hostgator so I copied it and edited it to make it work with the new form, but I can't get it to go through. Is there as special thing that I have to do to get it to work with Godaddy?

Last edited by Scooby-Doo; 10-24-2007 at 10:56 PM. Reason: Updating my original post.
 
Old 10-25-2007, 09:41 AM   #4
Scooby-Doo
LQ Newbie
 
Registered: Oct 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Here's the updated code.
PHP Code:
<?php
$con 
mysql_connect("HOST","USERNAME","PASS");
if (!
$con);
  {
  die(
'Could not connect: ' mysql_error());

mysql_select_db("tttbd"$con);
   
$sql="INSERT INTO addpup (name, breed_id, sex, birth_month, birth_day, birth_year, currency, price, ship_incl, ship_area, registered, vaccinated, vet_exam, health_cert, health_guar, pedigree, travel_crate, more_info);
VALUES
    ('$_POST[name]','$_POST[breed_id]','$_POST[sex]','$_POST[birth_month]','$_POST[birth_day]','$_POST[birth_year]','$_POST[currency]','$_POST[price]','$_POST[ship_incl]','$_POST[ship_area]','$_POST[registered]','$_POST[vaccinated]','$_POST[vet_exam]','$_POST[health_cert]','$_POST[health_guar]','$_POST[pedigree]','$POST[travel_crate]','$_POST[more_info]')"
;

    if (!
mysql_query($sql,$con));
    
$title "Your Puppy Added Successfully!";
  {
  die(
'<font color="ff000">Error: an error occured, please contact the website builder.</font>');
  
$title "I'm sorry and error occured";
  }
echo 
"Your Puppy has been added successfully!";
mysql_close($con);
?>
<html>
<head>
<title><?php echo $title?></title>

</head>
<body>

<?php
    
echo $title
?>
<br>
Please click <a href="/momsadminpage.php">HERE</a> to continue.
</body>
</html>

Last edited by Scooby-Doo; 10-25-2007 at 09:49 AM. Reason: colorise the coding
 
  


Reply

Tags
error, help, parse, php


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the meaning of "PHP Parse error: parse error, unexpected $ in..." frandalla Programming 23 03-04-2009 12:34 PM
need help with "Parse error: parse error, unexpected T_STRING" coffee245 Programming 2 01-29-2007 11:53 AM
php send email parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expect jamesjoy Programming 7 12-06-2005 04:33 PM
in gcc compiler error: parse error before string constsnt cynthia_thomas Linux - Networking 1 10-20-2005 01:29 AM
PHP parse error unexpected '>' ldp Programming 2 03-04-2005 02:20 PM


All times are GMT -5. The time now is 05:23 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration