code for a PHP form that connects with a database - php

I am having problems with creating a PHP form for a web site that popluates a MySQL database.
Here is the error message I am getting at the following URL: http://www.laboro.biz/employer.php:
Parse error: syntax error, unexpected $end in /hermes/bosoraweb013/b1108/ywh.tsarge83/laboro/employer-FormToEmail.php on line 228
The other file that is the action file is http://www.laboro.biz/employer-FormToEmail.php.
I need help with scripting to make this work.
Can anyone please help?

You're missing a curly brace somewhere in your script.
You're missing a { or have one more } or ; than needed. Look it over.

Related

Getting parse error in php

For some reasons I am getting parse error on the last line of the file even it is blank. I've used connect.php file as a connection file for putting the comment into the database. I'm using wampserver as a local server & coded all by myself
It must be some thing did not closed properly , like { or some line ending left post your php file for give proper solution

PHP Syntax - Connecting to Database

I created a database through an online site and would like to connect to it from my android Activity. I believe that the core issue is my PHP file. I keep getting a syntax error from this line of code:
$con = mysqli_connect('h31.170.234.43', “markf”, “boston”, “a9208078_mydb”);
The name of my file is Register.php and the error is:
Parse error: syntax error, unexpected T_VARIABLE in /home/a9208078/public_html/Register.php on line 2
First, I'm curious if my parameters are correct, Host Name, the username that I used for that site, my password, and the database name?
Does anyone know why this error is occuring? Thanks so much!
PS: I changed the information around from my actual password and database name for obvious security reasons but the idea is the same
You're using funky quotes around three parameter values. That's what happens when you copy and paste your code from a blog post or tutorial.
$con = mysqli_connect('h31.170.234.43', 'markf', 'boston', 'a9208078_mydb');
FYI, your IP address is invalid and probably also a copy and paste error or typo.

Can't get .php to output to the browser

I am completely new to coding and my current assignment is just to use a "here document" block. All the code I have for the program is:
<?php
$firstphpstring = <<<ONTOTHENEXTONE
I have now coded my first block to be displayed
in my very first web page.I am excited to see what the
next several weeks have in stored.
ONTOTHENEXTONE;
echo $firstphpstring;
?>
But I keep getting the following error:
Parse error: syntax error, unexpected T_SL in > C:\wamp\www\php_foothill\Week2Lab_CIS052N_heredoc_gettype.php on line 2
I am using Windows 7, WAMPServer 2.2, and have the .php file in a folder in C:\wamp\www
Remove the space after the <<<ONTOTHENEXTONE.

Syntax error on closing brace after opening a php tag

i'm getting trouble with a function that looks pretty much like this:
<?php
function my_function() {
if(!empty($variable)) {
//Do some stuff
}
else {
?>show a message<?php
}
}
?>
The problem is i'm getting a parse error:
Parse error: syntax error, unexpected ‘}’ in /www/bla/bla/bla.php on line 8
I know for a fact that i'm not missing or have an extra '}' brace because the code works just fine on my local server and i've run a validator to make sure the syntax is correct, however, when i port the code to the online server, i get the error.
I believe it has something to do with the php installation not supporting the closing and reopening of php tags between the condition but i'm not sure how would i go about fixing it.
I know i could just do echo 'message'; instead, but this is not the only place where the script uses that kind of syntax to display messages, so fixing it here would just mean i'd get the error on another line, and then another.
Thanks.
As it stands that piece of code runs just fine as is on PHP 5.2.14.
When you pasted in the code are you sure you pasted this line exactly as-is?:
?>show a message<?php
The only thing I can think of is that the code on the server is using a short open tag <? but SHORT_OPEN_TAG is turned off in the server's php.ini, for example :
?>show a message<?
I had a similiar issue with my file. This was throwing an error in my file:
<?php } ?>
This may seem silly, I added a comment which seemed to fix the error:
<?php
//
}
?>

wordpress (301 redirect plugin)/ php question

I am setting up a website in wordpress. the site was done by someone else. After setting up the site / database I get the following error:
Parse error: syntax error, unexpected $end in C:\Documents and Settings\user101\
Desktop\wordpress\wp-content\plugins\wp-301redirect\wp-301redirect.php on
line 320
line 320 is the very last line of wp-301redirect.php page. I looked up what 301redirect is and it is apparently a plugin. The wp-301redirect.php page I have is exactly what the plugin provides (zip download). line by line.
Does anyone know what might be causing this.?
In the default file for this plugin. line 220 has <? it should be changed to <?php to fix this error
Try removing the last line after ?>. And generally it's advisable to not close your PHP with ?> as it's not required and prevents this from happening in the first place.
Most likely, a function or control block is missing its matching end-brace, such as:
function foo() {
//stuff
...
// EOF
OR
if (true) {
...
// EOF

Categories