Wrox Programmer Forums
|
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 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 26th, 2005, 09:29 AM
Registered User
 
Join Date: Apr 2005
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>
 
Old April 28th, 2005, 10:43 AM
Registered User
 
Join Date: Mar 2005
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
 
Old May 2nd, 2005, 07:24 AM
Registered User
 
Join Date: Apr 2005
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!






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 02: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





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