By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

I keep getting this error message and would love your help

P: 2
I keep getting this error, could somebody help?
Parse error: parse error, expecting `']'' in C:\wamp\www\Contact Database\addentry.php on line 5

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ((!$_POST) || (isset($_GET["master_id])){
  3.         //haven't seen the form, so show it
  4.         $display_block = "
  5.         <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
  6.  
  7.     if (isset($_GET["master_id"])) {
  8.         //connect to database
  9.         $mysqli = mysqli_connect("localhost", "test", "test", "houseinsandiego");
  10.  
  11.         ??get first, last names for display/tests validity
  12.         $get_names_sql = "SELECT concat_ws(' ',f_name, l_name) AS display_name
  13.                             FROM master_name WHERE id = '".$_GET["master_id"]."'";
  14.         $get_names_res = mysqli_query($mysqli, $get_names_sql)
  15.                             or die(mysqli_error($mysqli));
Jul 4 '10 #1
Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
you forgot to close the last string part in line 5.
Jul 5 '10 #2

P: 2
@hpailles
thanks, now, how about this other parse error?

Parse error: parse error in C:\wamp\www\Contact Database\addentry.php on line 69

Expand|Select|Wrap|Line Numbers
  1. if ($_GET) {
  2. $display_block .= "<input type=\"hidden\"name=\"master_id\"
  3. value=\"".$_GET["master_id"]."\">"
  4. }
Jul 6 '10 #3

TheServant
Expert 100+
P: 1,168
Not sure without more code, but there might be some confusion with using double quotes to call your $_GET variable. Try:
Expand|Select|Wrap|Line Numbers
  1. if ($_GET) {
  2. $display_block .= "<input type=\"hidden\"name=\"master_id\"
  3. value=\"".$_GET['master_id']."\" />"
  4.  
I also added and extra '/' at the end as HTMl should have a self closing element like:
Expand|Select|Wrap|Line Numbers
  1. <input />
Jul 6 '10 #4

Dormilich
Expert Mod 5K+
P: 8,639
missing semi-colon.

@TheServant: strictly speaking, the self closing tag (<tagName />) is only required in XML, in HTML it is an error, which is gracefully ignored.
Jul 6 '10 #5

TheServant
Expert 100+
P: 1,168
@Dormilich
Ahhh yes. Now it's glaring me in the face. I have spent too long in VB, forgetting my semi-colons :S

And thanks for the XML/HTML correction. I can't stand incorrect things like that... One of my pet hates.
Jul 6 '10 #6

Post your reply

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