PDA

View Full Version : more errors and help :S



Colin-Roberts
03-09-2006, 07:13 PM
Parse error: syntax error, unexpected $end in /home/colin/public_html/v4/search/add.php on line 36

<center>
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='';
$dbuserpass='';
$dbname = '';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

if ($_POST['name']) {
$name = $_POST['name'];
if ($_POST['about']) {
$about = $_POST['about'];
if ($_POST['url']) {
$about = $_POST['url'];
$query = "INSERT INTO search (name,about,url) VALUES ('".$name."','".$about."','".$url."')";
mysql_query($query)or die(mysql_error());
echo $name." was inserted successfully";
}else{
echo "About was left blank";

}
?>
<h2>Add</h2>
<form action='add.php' method='POST'>
Name: <input type='text' name='name' size='33' /><br />
Url: <input type='text' name='url' size='33' /><br />
About: <textarea name='about' cols='25' rows='5'/></textarea><br />
<input type='submit' value='Add!' />
</form>
<a href="search.php">Search for a website.</a>
</center>

then hopefully my search engine and sumbit thing will be done maybe

+ how do you so when it echos the feild url it makes it into a hyperlink

1
03-09-2006, 07:17 PM
Point out line 36 fgs,

DMB-Hosting
03-09-2006, 07:22 PM
I know, hightlight it or something i cba to count down to 36 or copy it into my editor

Colin-Roberts
03-09-2006, 07:27 PM
kk 1 sec i will.

Edit:

</center> is line 36 :S

1
03-09-2006, 07:30 PM
kk 1 sec i will.

Edit:
is line 36 :S
Bugger it mate.

It's just text, not php :l

I dont have a clue.

Colin-Roberts
03-09-2006, 07:36 PM
lol me either :S hopefully mentor can shine some light on it

VersionUpdate
03-09-2006, 07:37 PM
Google it :)

Yeah
03-09-2006, 07:39 PM
god colin we fixed this earlier ^.^



<center>
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='';
$dbuserpass='';
$dbname = '';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

if ($_POST['name']) {
$name = $_POST['name'];
if ($_POST['about']) {
$about = $_POST['about'];
if ($_POST['url']) {
$about = $_POST['url'];
$query = "INSERT INTO search (name,about,url) VALUES ('".$name."','".$about."','".$url."')";
mysql_query($query)or die(mysql_error());
echo $name." was inserted successfully";
}else{
echo "About was left blank";

}
}
?>
<h2>Add</h2>
<form action='add.php' method='POST'>
Name: <input type='text' name='name' size='33' /><br />
Url: <input type='text' name='url' size='33' /><br />
about: <textarea name='about' cols='25' rows='5'/></textarea><br />
<input type='submit' value='Add!' />
</form>
<a href="search.php">Search for a website.</a>
</center>

Colin-Roberts
03-09-2006, 07:49 PM
lol soo...

Yeah
03-09-2006, 07:50 PM
Try the code i posted does it work?

Colin-Roberts
03-09-2006, 07:51 PM
nope same error

Yeah
03-09-2006, 07:53 PM
Try this;



<center>
<?php
// set your infomation.
$dbhost='localhost';
$dbusername='';
$dbuserpass='';
$dbname = '';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

if ($_POST['name']) {
$name = $_POST['name'];
if ($_POST['about']) {
$about = $_POST['about'];
if ($_POST['url']) {
$about = $_POST['url'];
$query = "INSERT INTO search (name,about,url) VALUES ('".$name."','".$about."','".$url."')";
mysql_query($query)or die(mysql_error());
echo $name." was inserted successfully";
}else{
echo "About was left blank";

}
}
}
?>
<h2>Add</h2>
<form action='add.php' method='POST'>
Name: <input type='text' name='name' size='33' /><br />
Url: <input type='text' name='url' size='33' /><br />
about: <textarea name='about' cols='25' rows='5'/></textarea><br />
<input type='submit' value='Add!' />
</form>
<a href="search.php">Search for a website.</a>
</center>

Colin-Roberts
03-09-2006, 07:57 PM
cool worked i think +rep

Yeah
03-09-2006, 07:58 PM
np ;)

also for future referance $end means its missing a } from the end of the php script.

1
03-09-2006, 07:59 PM
I knew that ^^

Want to hide these adverts? Register an account for free!