Jump to content

Parse error


mhhallmon

Recommended Posts

I'm trying to query sql to post all new users on my site to the index page. This string:

 

$sql = "SELECT COUNT(id) FROM users WHERE activated='1'";

 

keeps returning this error:

 

Parse error: syntax error, unexpected T_LNUMBER in /home/******/********/index.php on line 14

 

I have tried canceling out as suggested on php.net using: 

 

$sql = SELECT COUNT(id) FROM users WHERE activated=\'1';

 

and receive:

 

Parse error: syntax error, unexpected $end in /home/******/********/index.php on line 35

 

because now it's incomplete. What's the issue? All suggestions I have found online are not working. 

Link to comment
https://forums.phpfreaks.com/topic/282490-parse-error/
Share on other sites

  • 2 weeks later...

I am new to programming/php. I've seen good and bad video resources of people trying to teach newcomers but it ends up not working in the end. Maybe it's on my server, maybe not.

 

I am trying to get an html form to send email using php. I tried some video tutorials like, http://www.youtube.com/watch?v=z2cVERxjSRY and the persons code in the video always works yet when you try to do it on your server it comes up short. I kept getting this error after writing the code as it is shown. 

PHP Parse error:  syntax error, unexpected T_IF in /*********/*********/public_html/test/support-send.php on line 2

 

Here is the php code:

Line1: <?PHP>
Line2: if (isset($_POST['submit'])) {
Line3: $body = 'Name: ' .$_POST['name'] ."\n"
Line4: .'Email: ' .$_POST['email'] ."\n"
Line5: .'Message: ' .$_POST['message'] .;
Line6:
Line7: mail('[email protected]', 'Contact Form', $body);
Line8: header('location: contact-thank-you.php');
Line9:
Line10: } else {
Line11: header('location: contactform.php');
Line12: exit(0);
Line13: }
Line14: ?>
 
Can anyone tell me what is going on in line2 or how I can make the email action work another way? 
Link to comment
https://forums.phpfreaks.com/topic/282490-parse-error/#findComment-1452836
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.