Jump to content

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('myemail@mydomain.com', '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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.