It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

What's wrong with this?

Moderator: Malcolm

What's wrong with this?

Postby Johnathan on Tue May 27, 2008 5:54 pm

Code: Select all
<?php
$con = mysql_connect("rdbms.strato.de","*******","********");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("DB407820", $con);
mysql_query("INSERT INTO favicon (faviconURL, siteURL, email)
VALUES
('$_POST[faviconURL]','$_POST[siteURL]','$_POST[email]')";
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Your Favicon has been added, refresh the page to see it.";
mysql_close($con)
?>


I get this, "Parse error: syntax error, unexpected ';' in /mnt/web2/43/79/51648779/htdocs/JBP/favicon/submit_favicon.php on line 18"

Then I take the ";" so I end up with this:
Code: Select all
<?php
$con = mysql_connect("rdbms.strato.de","U407820","thomas02");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("DB407820", $con);
mysql_query("INSERT INTO favicon (faviconURL, siteURL, email)
VALUES
('$_POST[faviconURL]','$_POST[siteURL]','$_POST[email]')"
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Your Favicon has been added, refresh the page to see it.";
mysql_close($con)
?>


And get this "Parse error: syntax error, unexpected T_IF in /mnt/web2/43/79/51648779/htdocs/JBP/favicon/submit_favicon.php on line 19".
You can see the form and what happens here... http://www.jbportal.net/favicon/favicon.php

Any ideas???
Johnathan
1000+ Club
 
Posts: 1207
Joined: Thu May 31, 2007 3:28 pm
Location: Belfast, Northen Ireland

Postby webmaster on Tue May 27, 2008 6:42 pm

Try putting a ";" after this row
Code: Select all
('$_POST[faviconURL]','$_POST[siteURL]','$_POST[email]')"
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Johnathan on Tue May 27, 2008 7:04 pm

Yea, that's what it was at the start but I got an error, the first one in my post. Thanks for the help anyway.
Johnathan
1000+ Club
 
Posts: 1207
Joined: Thu May 31, 2007 3:28 pm
Location: Belfast, Northen Ireland

Postby willyamPax on Wed Jul 16, 2008 6:20 am

try putting a semicolon like below
mysql_close($con);
and u lack ) try this
mysql_query("INSERT INTO favicon (faviconURL, siteURL, email)
VALUES
('$_POST[faviconURL]','$_POST[siteURL]','$_POST[email]')");
willyamPax
 
Posts: 4
Joined: Mon Jul 14, 2008 1:27 am

Postby npsari on Mon Oct 13, 2008 5:34 pm

I would say the right code should be as you have it at the top

So anyway, Perhaps the php code is reacting to another issue on the page

Perhaps you have an extra } or {
npsari
 
Posts: 19
Joined: Thu Mar 08, 2007 7:14 pm
Location: England


Who is online

Users browsing this forum: No registered users and 1 guest