Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:45:53+00:00 2026-06-17T12:45:53+00:00

I am having a problem with PHP (am very inexperienced with it) and I

  • 0

I am having a problem with PHP (am very inexperienced with it) and I am getting the below error. Could anyone help me find the cause of the below error.

Parse error: syntax error, unexpected ” (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/jsnow/projects/one/htdocs/edit-exec.php on line 30

My Code:

$dbconn = mysql_select_db(APP_DB);
if(!$dbconn) 
{ 
    die("ERROR SELECTING DB"); 
}

$query = "SELECT * FROM users WHERE users_id='$_SESSION['SESS_USER_ID']'"; 
$result = @mysql_query($query);

if($result) { 
    header("location: success-register.php");  
    exit();
}else { 
    die("Query failed");  
}

I am not sure if its something obvious but I cant see it.

Any help would be very appreciative.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:45:54+00:00Added an answer on June 17, 2026 at 12:45 pm

    The above code has not been very well written.

    You are probably better off using something like PDO instead of the below.

    However the problem is most likely with the ‘ inside of $query.

    Try the below.

    $dbconn = mysql_select_db(APP_DB);
    if(!$dbconn) {
        die("ERROR SELECTING DB");
    }
    
    $query = "SELECT * FROM users WHERE users_id='".$_SESSION['SESS_USER_ID']."'";
    $result = @mysql_query($query);
    
    if($result) {
       header("location: success-register.php");
       exit();
    }else {
       die("Problem registering");
    } 
    

    That would fix the code but I would recommend using something like the below instead (will add params later and satanize ensuring protection from sql injection):

    $dbh = new PDO("database details");
    $sth = $dbh->prepare('SELECT * FROM users WHERE users_id=:users_id');
    $sth->bindParam(':users_id', $_SESSION['SESS_USER_ID']);
    $sth->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new to php/MySQL and I'm having a bit of trouble. Help would
I am having a very strange problem, and I'm not sure of the cause.
I'm having a problem where PHP is reporting an open_basedir restriction error when CakePHP
I'm having a very interesting problem with PHP. The following code grabs a line
I'm having a problem implementing custom 404 error pages on my Windows/IIS/PHP webhost. Whenever
I am very new in php. I am having a problem in condition checking.
I'm having a very specific problem so I hope someone can help. I'm building
I'm having a problem with php's for loop. The loop iterates too fast and
I'm having a problem with a PHP website running on IIS 7 on Windows
I am having one problem with the PHP json_encode function. It encodes numbers as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.