I keep getting this error message and would love your help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hpailles
    New Member
    • Jul 2010
    • 2

    #1

    I keep getting this error message and would love your help

    I keep getting this error, could somebody help?
    Parse error: parse error, expecting `']'' in C:\wamp\www\Con tact Database\addent ry.php on line 5

    Code:
    <?php
    if ((!$_POST) || (isset($_GET["master_id])){
    		//haven't seen the form, so show it
    		$display_block = "
    		<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
    		
    	if (isset($_GET["master_id"])) {
    		//connect to database
    		$mysqli = mysqli_connect("localhost", "test", "test", "houseinsandiego");
    			
    		??get first, last names for display/tests validity
    		$get_names_sql = "SELECT concat_ws(' ',f_name, l_name) AS display_name
    							FROM master_name WHERE id = '".$_GET["master_id"]."'";
    		$get_names_res = mysqli_query($mysqli, $get_names_sql)
    							or die(mysqli_error($mysqli));
    Last edited by Dormilich; Jul 5 '10, 06:22 AM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you forgot to close the last string part in line 5.

    Comment

    • hpailles
      New Member
      • Jul 2010
      • 2

      #3
      Originally posted by hpailles
      I keep getting this error, could somebody help?



      Code:
      <?php
      if ((!$_POST) || (isset($_GET["master_id])){
      		//haven't seen the form, so show it
      		$display_block = "
      		<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
      		
      	if (isset($_GET["master_id"])) {
      		//connect to database
      		$mysqli = mysqli_connect("localhost", "test", "test", "houseinsandiego");
      			
      		??get first, last names for display/tests validity
      		$get_names_sql = "SELECT concat_ws(' ',f_name, l_name) AS display_name
      							FROM master_name WHERE id = '".$_GET["master_id"]."'";
      		$get_names_res = mysqli_query($mysqli, $get_names_sql)
      							or die(mysqli_error($mysqli));
      thanks, now, how about this other parse error?

      Parse error: parse error in C:\wamp\www\Con tact Database\addent ry.php on line 69

      Code:
      if ($_GET) {
      $display_block .= "<input type=\"hidden\"name=\"master_id\"
      value=\"".$_GET["master_id"]."\">"
      }
      Last edited by Dormilich; Jul 6 '10, 05:33 AM. Reason: Please use [code] tags when posting code

      Comment

      • TheServant
        Recognized Expert Top Contributor
        • Feb 2008
        • 1168

        #4
        Not sure without more code, but there might be some confusion with using double quotes to call your $_GET variable. Try:
        Code:
        if ($_GET) {
        $display_block .= "<input type=\"hidden\"name=\"master_id\"
        value=\"".$_GET['master_id']."\" />"
        I also added and extra '/' at the end as HTMl should have a self closing element like:
        Code:
        <input />

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          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.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            Originally posted by Dormilich
            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.
            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.

            Comment

            Working...