473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to fix "syntax error, unexpected T_VARIABLE on line 13"

So i made a script for editing a member profile.
But now i get this error:
Parse error: syntax error, unexpected T_VARIABLE on line 13
Here is the code of the script:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     session_start();
  3.     include_once('config.php');
  4.     include_once('functions.php');
  5.     if(isset($_POST['verzonden'])){
  6.         $fout_bericht       = '';
  7.         $naam = mysql_real_escape_string($_POST['username']);
  8.         $user = mysql_real_escape_string($_POST['user']);
  9.         $db        = safe_db_open($host, $gebruiker, $wachtwoord, $database);
  10.         $id = $_SESSION['id'];
  11. $aSQLfields = array();
  12. if(isset($_POST['username'])){
  13. $aSQLfields[] = "naam='$naam'";
  14. }
  15. if(isset($_POST['user'])){
  16.  $aSQLfields[] = "user='$user'";
  17. }
  18.         elseif($_POST['naam'] == ($_POST['user'])){
  19.             $fout_bericht .= "You must fill in at least one field!";
  20.         }
  21.         if($fout_bericht){
  22.             echo " <html><head><link rel=\"stylesheet\" href=\"css/style.css\" /></head><body><h1>";
  23.             echo $fout_bericht . "<br/></h1>";
  24.             echo "<a class=\"btn btn-lg btn-success\" href=\"edit.php\"><i class=\"fa fa-refresh fa-spin fa-2x\"></i> <h1>Try again</h1></a></body></html>";
  25.         }
  26.         else{
  27.   $query = "update members set " . join(',', $aSQLfields) . " where id = '$id'";
  28.         safe_query($db, $query);
  29.         mysqli_close($db);
  30.  
  31.             echo "Edited Profile Succesfully!";
  32.             echo "You will be redirected to Home in 3 seconds...";
  33.             header("Refresh: 3; url=view.php");
  34.         }
  35.     } 
  36.     else{
  37.     ?> 
  38. -HTML CODE-
  39. <?php } ?>
  40.  
Apr 15 '14 #1
1 1499
Rabbit
12,516 Expert Mod 8TB
On line 13 you're trying to assign a string to an array rather than an array element.
Apr 15 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Salim | last post by:
Hi people, keep getting this errorParse error: parse error, unexpected T_STRING in order_fns.php line 91. the code is below for the file and I've indicated line 91 <?php function...
8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
14
by: dbldeegd | last post by:
My Java Script executes fine on an test HTML page, but on the required page which is php results in an error. the page The script drops in message box when the page is loaded since the script...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
11
by: JRough | last post by:
I'm trying to use output buffering to cheat so i can print to excel which is called later than this header(). header("Content-type: application/xmsdownload"); header("Content-Disposition:...
0
by: JRough | last post by:
On Sep 26, 3:23 pm, Captain Paralytic <paul_laut...@yahoo.comwrote: without the exit I get this again: Warning: Cannot modify header information - headers already sent by (output started at...
68
mideastgirl
by: mideastgirl | last post by:
I keep getting this error and I cannot figure it out. My curly brackets are closed, and I am using the correct tags for <?php to open and ?> to close my code. Can someone please help me! Here is...
1
by: geobb08 | last post by:
</div> <div class="featured_tab"> <img src="http://bytes.com/images/demo/5.PNG" alt="" /> <p>Help</p> </div> </li> <?php }?> </ul> </div> </div> </div>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.