Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2005, 06:09 AM
Registered User
 
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default parse error

:(:(
could not find error on line 134
form line. please need help

parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ajit/displayinfo.php on line 134




<!doctype html public "-//W3C//DTD HTML 4.0//EN">
<?php
error_reporting (E_ALL);
$flag=true;
$link=mysql_pconnect("localhost", "ajit", "ajit")
   or die ("Could not connect to MySQL");

    mysql_select_db ("ajit")
   or die ("Could not select database");
$submitSearch=$_POST['submit'];
$name=$_POST['search'];
$add=$_POST['add'];
if(isset($link))
     { if(isset($submitSearch))
                 {
                   if(isset($name))
                   {


                   $searchResult=mysql_query('select * from personInfo where name LIKE `"$name" ORDER BY date DESC;')
                   or die ("Query failed");
                   if(mysql_num_rows($searchResult)>0 ){
                     display_table($searchResult);
                     }
                    else{
                    echo"no such row obtained";
                    }
                    }
                else{echo"Give the name of person you want to search";}

                }
                    elseif(isset($add))
                    {

                      Header("Location: http://192.168.0.10/~ajit/infoform.php");
                     }




                    else{
                    $result = mysql_query('select * from personInfo order BY date DESC;')
                    or die ("Query failed");
                    $num=mysql_num_rows($result);

                    display_table($result);
                    }

    }

 else{
     echo"could not connect to the database";

     }





/* THIS TABLE WILL DISPLAY ALL FETCHED ROWS FROM TABLE + ADD EDIT LINK+
+E-MAIL LINK*/


function display_table($result)
{
 if(isset($result))
 {
 $subject="REMINDER ABOUT WORK";
 $messege="Hello sir/madam";
 print "<table border=1><br>";
 $temp=0;
 echo"<tr>";
               for($temp=0;$temp<18;$temp++)
               {
               echo"<td>";
               $fieldname= mysql_field_name($result, $temp);
               echo"$fieldname";
               echo"</td>";
               }
 echo"</tr>";

                while ($line = mysql_fetch_array($result))
                {
                echo "<tr>";

                     foreach ($line as $key=>$value)
                        {
                        $temp=0;
                                if ((mysql_field_name($result, $temp)=="emailid"))
                                {
                                echo "<td>";
                                @mail($value, $subject, $message );

                                echo'<a href="mailto:$value?subject="Feedback">E-MAIL</a>';

                                echo "</td>";
                                }

                                else{
                                echo "<td>";
                                echo"$value";
                                echo"</td>";
                                }
`
                      $row = mysql_fetch_array($result,MYSQL_NUM);
                      $id=$row[0];
                       //echo"<td align=\"center\" bgcolor=\"#5647A1\" onclick=\"window.location.href='editform.php';\"> EDIT </td>";

                       echo"<td>";
                       echo"<a href=\"editinfo.php?Name=id\">";
                       echo"</td>";

                       $temp++;
                       echo "</tr>";
                      }
                print "</table><br>";
               }
}
else{
echo"NO RESULTS FOUND";

}
}




echo'<html>
   <head>
      <title>PERSON INFORMATION</title>
   </head>
   <body>';

echo"<form method=\"post\" action=\".'$_SERVER['PHP_SELF'].'\" >";
echo'<input type="text" name="search" <br>';
echo'<label> SEARCH PERSON NAME</label>';
echo'<input type="submit" name="submit" value="SEARCH PEOPLE">';
echo'<input type="submit" name="add" value="ADD_NEW_RECORD">';
echo'</form>
       </body>
</html>';

 
Old April 27th, 2005, 08:16 AM
Authorized User
 
Join Date: Apr 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jmukesh Send a message via Yahoo to jmukesh
Default


Change ur line :

Header("Location: http://192.168.0.10/~ajit/infoform.php");

to

header("Location: http://192.168.0.10/~ajit/infoform.php");

 
Old May 6th, 2005, 05:07 AM
Registered User
 
Join Date: May 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could remove the extra character on line 104 which is a: `

and the replace line 134 with:

echo"<form method='post' action=" . $_SERVER['PHP_SELF'] . " >";

or

echo '<form method="post" action=' . $_SERVER['PHP_SELF'] . ' >';

As for the header() function change you should do that as well.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 02:27 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.