Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 26th, 2005, 10:29 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default php parse error

error at end of prog.unexpected $:(


!doctype html public "-//W3C//DTD HTML 4.0//EN">
<?php
error_reporting (E_ALL);
$flag=true;
 $link=mysql_connect("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://.../~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";

}
}

?>


<html>
   <head>
      <title>PERSON INFORMATION</title>
   </head>
   <body>

<form method="post" >
<input type="text" name="search" <br>
<label> SEARCH PERSON NAME</label>
<input type="submit" name="submit" value="SEARCH PEOPLE">
<input type="submit" name="add" value="ADD_NEW_RECORD">
</form>
       </body>
</html>
  #2 (permalink)  
Old April 28th, 2005, 11:43 AM
Registered User
 
Join Date: Mar 2005
Location: Heemstede, n/a, Netherlands.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ajit,
Do you really expect that we are going to debug your code?
Take your script apart, try parts of it, until you hit the problem.
One thing I saw: LIKE `"$name" what is that backtick for?

Hillechien
  #3 (permalink)  
Old May 2nd, 2005, 08:24 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for reply thats was prob. i gave full code because

err. was on last line !

nothig else!

tx lot!

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 03:27 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM
parse error $end pag 118 table3.php vkranendonk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 February 2nd, 2006 12:05 PM
MySQL & PHP Parse error Stuart BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 March 17th, 2005 03:44 PM



All times are GMT -4. The time now is 06:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.