473,414 Members | 1,615 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,414 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 1500
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.