teramera Posted February 16, 2009 Share Posted February 16, 2009 Hi!, I read up on the php stuff as a newbie and tried out editing an php script file. I am not getting any syntax error now but still i am making something wrong in the code. Its showing the code part also .... it should only read " Sign up or Register to be able to contact us." and if the member is registered then they should be allowed to give the rankings. Can you pls help. The output is reading like this: The code is here: <? session_start(); include("../includes/connection.php"); include("../includes/config.php"); $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $result_sellerdetails = mysql_query($sql_sellerdetails); $row_sellerdetails = @mysql_fetch_array($result_sellerdetails); if(@mysql_num_rows($result_sellerdetails ) > 0) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?=$row_sellerdetails['CompanyName']?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <script language="javascript"> function validate(theform) { if(theform.Name.value == "") { alert("Please enter Name"); theform.Name.focus(); return false; } else if(theform.Comment.value == "") { alert("Please enter Comment"); theform.Comment.focus(); return false; } return true; } function showComment() { document.getElementById('addcomment').style.display = "block"; document.getElementById('commentlink').style.display = "none"; } </script> </head> <body> <table border="0" cellspacing="0" width="1000" align="center"> <Tr> <? include("topheader.php"); ?> </Tr> <Tr> <Td> <table border="0" cellpadding="0" cellspacing="0" width="1000" align="center"> <Tr><td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86"> <? if($row_sellerdetails['CompanyLogo'] != "") { ?> <img src="../<?=$row_sellerdetails['CompanyLogo']?>" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="companyheading"><?=$row_sellerdetails['CompanyName']?></a> <? } else { ?> <a href="index.php?BuyerID=<?=$_REQUEST['SellerID']?>" class="companyheading"><?=$row_sellerdetails['CompanyName']?></a> <? } ?> </td></Tr> <Tr><td colspan="2"> <table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif"> <td align="center" height="32"><a href="index.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Home</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <Td align="center"><a href="buying_leads.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Buying Leads</a></Td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <Td align="center"><a href="blogs.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Blogs</a></Td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <? if($row_sellerdetails['GoldMember'] == 1) { ?> <Td align="center"><a href="about_us.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">About Us</a></Td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <? } ?> <Td align="center"><a href="view_contact_details.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="whitenav">Contact Us</a></Td> </table> </td></Tr> <Tr> <td width="21%" align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table> <!-- start of company profile--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <Tr> <Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td> <Td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?=$_REQUEST['BuyerID']?>#companyprofile" class="headinglink">Company Profile</a></Td> <Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td> </Tr> </table> <!-- end of company profile --> <!-- start of rating/comment--> <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <Tr> <Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td> <Td background="../images/bar-box_03.gif" class="heading"> <a href="ratings.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="headinglink">Ratings/Comments</a> </Td> <Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td> </Tr> </table> <!-- end of rating/comment --> <table border="0" cellpadding="0" cellspacing="0" height="10"><Tr><td></td></Tr></table> <!-- start of contact Us--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <Tr> <Td width="9" height="26"><img src="../images/bar-box_01.gif"></Td> <Td background="../images/bar-box_03.gif" class="heading">Contact Us</Td> <Td width="9" height="26"><img src="../images/bar-box_05.gif"></Td> </Tr> <Tr> <Td background="../images/bar-box_09.gif"></Td> <Td background="../images/bar-box_10.gif"> <table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar"> <Tr><td height="5"></td> <td></td> </Tr> <? $sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $resultContactUs = mysql_query($sqlContactUs, $conn); if (@mysql_num_rows($resultContactUs)!=0){ $row_ContactUs = @mysql_fetch_array($resultContactUs); echo " <Tr> <td width='3'></td> <td class='contentblack'> ".$row_ContactUs['CompanyName']." <br><br> <strong>Address:</strong><br> ".$row_ContactUs['StreetAddress']." ".$row_ContactUs['StreetAddress2']." ".$row_ContactUs['StreetAddress3']." ".$row_ContactUs['City']." <br> <br>"; ?> <a href="contact_now.php?BuyerID=<?=$_REQUEST['BuyerID']?>"><img src="../images/inquire_now.gif" border="0"></a> <br> <br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?=$_REQUEST['BuyerID']?>" class="contactus">View Contact Details</a> <? echo "</td> </Tr> "; } ?> </table> </Td> <Td background="../images/bar-box_11.gif"></Td> </Tr> <Tr> <Td width="9" height="13"><img src="../images/bar-box_15.gif"></Td> <Td background="../images/bar-box_16.gif"></Td> <Td width="9" height="13"><img src="../images/bar-box_17.gif"></Td> </Tr> </table> <!-- end of contact us--> </td> <td width="79%" align="center" valign="top"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <Tr height="10"><Td></Td></Tr> <!-- start view Contact Details --> <Tr><Td> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <Tr> <Td width="7" height="22"><img src="../images/topleft.gif"></Td> <Td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</Td> <Td width="8" height="22"><img src="../images/topright.gif"></Td> </Tr> <Tr> <Td background="../images/left.gif"></Td> <Td align="left"> <? if($_REQUEST['r']=="1") { ?> <br> <p class="redbold">Your feedback has been recorded.</p> <? } else { ?> <br> <? } ?> <?php if ($_SESSION['Name'] !=""){ ?> <div id="commentlink"><a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a></span><br></div> <div id="addcomment" style="display:none;"> <form method="post" action="add_comment.php?BuyerID=<?=$_REQUEST['BuyerID']?>" onSubmit="return validate(this);"> <table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3"> <tr bgcolor="#CCCCCC"><Td colspan="2" class="headings" style="color:#666666 ">Post a Comment</Td></tr> <tr><Td align="right" class="content">Name:</Td><td><input type="text" name="Name" id="Name"></td></tr> <tr><Td align="right" class="content">Rating:</Td><td><select name="Rating"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><Td align="right" class="content">Comment:</Td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr> <tr><Td></Td><td><input type="submit" value="Submit"></td></tr> </table> </form> </div> <?php } else { ?> <a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br> $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ ?> <br> <? while($row_comments = @mysql_fetch_array($resultcomments)) { ?> <p class="content"> <span style="color:#990000;">Comment By: <?=$row_comments['CommentBy']?></span> - <span style="color:#666666">Posted on <?=date("M d, Y",strtotime($row_comments['AddedDate']))?></span> <br> <span style="color:#000066">Rating: </span><img src="../images/rating<?=$row_comments['Rating']?>.gif" border="0"> <br> <?=$row_comments['Comment']?> </p> <? } } ?> </Td> <Td background="../images/right.gif"></Td> </Tr> <Tr> <Td width="7" height="4"><img src="../images/bottomleft.gif"></Td> <Td background="../images/bottom.gif"></Td> <Td width="8" height="4"><img src="../images/bottomright.gif"></Td> </Tr> </table> </Td></Tr> <!-- end of view contact details --> </table></td> </Tr> </table> </Td></Tr> <? include "footer.php"; ?> </table> </body> </html> <? } else { echo "Sorry, no record found.."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/ Share on other sites More sharing options...
htmlstig Posted February 16, 2009 Share Posted February 16, 2009 you need to add <? before $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-763751 Share on other sites More sharing options...
teramera Posted February 16, 2009 Author Share Posted February 16, 2009 Quote you need to add <? before $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ Hi ! htmlstig, I tried what you recommended above but now i get this error: Parse error: syntax error, unexpected T_ELSE on line 322 Can you pls take a look at it and help. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-763756 Share on other sites More sharing options...
marcus Posted February 16, 2009 Share Posted February 16, 2009 It upsets me that you used shorthand on most of your code and randomly used the normal tags in the middle of it. Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-763764 Share on other sites More sharing options...
htmlstig Posted February 16, 2009 Share Posted February 16, 2009 its because you have an else followed by an else .... if you find else { ?> <a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br> and change else to elseif ($_SESSION['Name'] ="") Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-763766 Share on other sites More sharing options...
teramera Posted February 17, 2009 Author Share Posted February 17, 2009 When I do as you recommended it still gives an error. Parse error: syntax error, unexpected T_ELSEIF on line 230 Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-763787 Share on other sites More sharing options...
The Little Guy Posted February 17, 2009 Share Posted February 17, 2009 Please, please, please format your code next time (tabs). Give this a try: <?php session_start(); include("../includes/connection.php"); include("../includes/config.php"); $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $result_sellerdetails = mysql_query($sql_sellerdetails); $row_sellerdetails = @mysql_fetch_array($result_sellerdetails); if(@mysql_num_rows($result_sellerdetails) > 0){ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php=$row_sellerdetails['CompanyName'];?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <script language="javascript"> function validate(theform){ if(theform.Name.value == ""){ alert("Please enter Name"); theform.Name.focus(); return false; }else if(theform.Comment.value == ""){ alert("Please enter Comment"); theform.Comment.focus(); return false; } return true; } function showComment(){ document.getElementById('addcomment').style.display = "block"; document.getElementById('commentlink').style.display = "none"; } </script> </head> <body> <table border="0" cellspacing="0" width="1000" align="center"> <tr> <?php include("topheader.php"); ?> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="1000" align="center"> <tr> <td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86"> <?php if($row_sellerdetails['CompanyLogo'] != ""){ echo '<img src="../'.$row_sellerdetails['CompanyLogo'].'" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID='.$_REQUEST['BuyerID'].'>" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; }else{ echo '<a href="index.php?BuyerID='.$_REQUEST['SellerID'].'" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; } ?> </td> </tr> <tr> <td colspan="2"> <table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif"> <tr> <td align="center" height="32"><a href="index.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Home</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="buying_leads.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Buying Leads</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="blogs.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Blogs</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <?php if($row_sellerdetails['GoldMember'] == 1){ echo '<td align="center"><a href="about_us.php?BuyerID='.$_REQUEST['BuyerID'].'" class="whitenav">About Us</a></td><td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>'; } ?> <td align="center"><a href="view_contact_details.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Contact Us</a></td> </tr> </table> </td> </tr> <tr> <td width="21%" align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of company profile--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>#companyprofile" class="headinglink">Company Profile</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of company profile --> <!-- start of rating/comment--> <table border="0" cellpadding="0" cellspacing="0" height="10"> <tr> <td></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="ratings.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="headinglink">Ratings/Comments</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of rating/comment --> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of contact Us--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading">Contact Us</td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> <tr> <td background="../images/bar-box_09.gif"></td> <td background="../images/bar-box_10.gif"> <table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar"> <tr> <td height="5"></td> <td></td> </tr> <?php $sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $resultContactUs = mysql_query($sqlContactUs, $conn); if (@mysql_num_rows($resultContactUs)!=0){ $row_ContactUs = @mysql_fetch_array($resultContactUs); echo ' <tr> <td width="3"></td> <td class="contentblack"> '.$row_ContactUs['CompanyName'].' <br><br> <strong>Address:</strong><br> '.$row_ContactUs['StreetAddress'].' '.$row_ContactUs['StreetAddress2'].' '.$row_ContactUs['StreetAddress3'].' '.$row_ContactUs['City'].' <br> <br>'; ?> <a href="contact_now.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>"><img src="../images/inquire_now.gif" border="0"></a> <br> <br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="contactus">View Contact Details</a> <?php echo "</td> </tr>"; } ?> </table> </td> <td background="../images/bar-box_11.gif"></td> </tr> <tr> <td width="9" height="13"><img src="../images/bar-box_15.gif"></td> <td background="../images/bar-box_16.gif"></td> <td width="9" height="13"><img src="../images/bar-box_17.gif"></td> </tr> </table> <!-- end of contact us--> </td> <td width="79%" align="center" valign="top"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr height="10"> <td></td> </tr> <!-- start view Contact Details --> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="7" height="22"><img src="../images/topleft.gif"></td> <td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</td> <td width="8" height="22"><img src="../images/topright.gif"></td> </tr> <tr> <td background="../images/left.gif"></td> <td align="left"> <?php if($_REQUEST['r']=="1"){ echo '<br><p class="redbold">Your feedback has been recorded.</p>'; }else{ echo '<br>'; } if ($_SESSION['Name'] !=""){ ?> <div id="commentlink"> <a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a> </div> <div id="addcomment" style="display:none;"> <form method="post" action="add_comment.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" onSubmit="return validate(this);"> <table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3"> <tr bgcolor="#CCCCCC"><td colspan="2" class="headings" style="color:#666666 ">Post a Comment</td></tr> <tr><td align="right" class="content">Name:</td><td><input type="text" name="Name" id="Name"></td></tr> <tr><td align="right" class="content">Rating:</td><td><select name="Rating"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td align="right" class="content">Comment:</td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr> <tr><td></td><td><input type="submit" value="Submit"></td></tr> </table> </form> </div> <?php }else{ echo '<a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>'; $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ echo '<br>'; while($row_comments = @mysql_fetch_array($resultcomments)){ echo '<p class="content"> <span style="color:#990000;">Comment By: '.$row_comments['CommentBy'].'</span> - <span style="color:#666666">Posted on '.date("M d, Y",strtotime($row_comments['AddedDate'])).'</span> <br> <span style="color:#000066">Rating: </span><img src="../images/rating'.$row_comments['Rating'].'.gif" border="0"> <br> '.$row_comments['Comment'].' </p>'; } } ?> </td> <td background="../images/right.gif"></td> </tr> <tr> <td width="7" height="4"><img src="../images/bottomleft.gif"></td> <td background="../images/bottom.gif"></td> <td width="8" height="4"><img src="../images/bottomright.gif"></td> </tr> </table> <?php } ?> </td> </tr> <!-- end of view contact details --> </table> </td> </tr> </table> </td> </tr> </table> <?php include "footer.php"; ?> </body> </html> <?php }else{ echo "Sorry, no record found.."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764557 Share on other sites More sharing options...
teramera Posted February 17, 2009 Author Share Posted February 17, 2009 Quote Please, please, please format your code next time (tabs). Give this a try: <?php session_start(); include("../includes/connection.php"); include("../includes/config.php"); $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $result_sellerdetails = mysql_query($sql_sellerdetails); $row_sellerdetails = @mysql_fetch_array($result_sellerdetails); if(@mysql_num_rows($result_sellerdetails) > 0){ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php=$row_sellerdetails['CompanyName'];?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <script language="javascript"> function validate(theform){ if(theform.Name.value == ""){ alert("Please enter Name"); theform.Name.focus(); return false; }else if(theform.Comment.value == ""){ alert("Please enter Comment"); theform.Comment.focus(); return false; } return true; } function showComment(){ document.getElementById('addcomment').style.display = "block"; document.getElementById('commentlink').style.display = "none"; } </script> </head> <body> <table border="0" cellspacing="0" width="1000" align="center"> <tr> <?php include("topheader.php"); ?> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="1000" align="center"> <tr> <td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86"> <?php if($row_sellerdetails['CompanyLogo'] != ""){ echo '<img src="../'.$row_sellerdetails['CompanyLogo'].'" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID='.$_REQUEST['BuyerID'].'>" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; }else{ echo '<a href="index.php?BuyerID='.$_REQUEST['SellerID'].'" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; } ?> </td> </tr> <tr> <td colspan="2"> <table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif"> <tr> <td align="center" height="32"><a href="index.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Home</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="buying_leads.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Buying Leads</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="blogs.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Blogs</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <?php if($row_sellerdetails['GoldMember'] == 1){ echo '<td align="center"><a href="about_us.php?BuyerID='.$_REQUEST['BuyerID'].'" class="whitenav">About Us</a></td><td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>'; } ?> <td align="center"><a href="view_contact_details.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="whitenav">Contact Us</a></td> </tr> </table> </td> </tr> <tr> <td width="21%" align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of company profile--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>#companyprofile" class="headinglink">Company Profile</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of company profile --> <!-- start of rating/comment--> <table border="0" cellpadding="0" cellspacing="0" height="10"> <tr> <td></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="ratings.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="headinglink">Ratings/Comments</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of rating/comment --> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of contact Us--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading">Contact Us</td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> <tr> <td background="../images/bar-box_09.gif"></td> <td background="../images/bar-box_10.gif"> <table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar"> <tr> <td height="5"></td> <td></td> </tr> <?php $sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $resultContactUs = mysql_query($sqlContactUs, $conn); if (@mysql_num_rows($resultContactUs)!=0){ $row_ContactUs = @mysql_fetch_array($resultContactUs); echo ' <tr> <td width="3"></td> <td class="contentblack"> '.$row_ContactUs['CompanyName'].' <br><br> <strong>Address:</strong><br> '.$row_ContactUs['StreetAddress'].' '.$row_ContactUs['StreetAddress2'].' '.$row_ContactUs['StreetAddress3'].' '.$row_ContactUs['City'].' <br> <br>'; ?> <a href="contact_now.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>"><img src="../images/inquire_now.gif" border="0"></a> <br> <br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" class="contactus">View Contact Details</a> <?php echo "</td> </tr>"; } ?> </table> </td> <td background="../images/bar-box_11.gif"></td> </tr> <tr> <td width="9" height="13"><img src="../images/bar-box_15.gif"></td> <td background="../images/bar-box_16.gif"></td> <td width="9" height="13"><img src="../images/bar-box_17.gif"></td> </tr> </table> <!-- end of contact us--> </td> <td width="79%" align="center" valign="top"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr height="10"> <td></td> </tr> <!-- start view Contact Details --> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="7" height="22"><img src="../images/topleft.gif"></td> <td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</td> <td width="8" height="22"><img src="../images/topright.gif"></td> </tr> <tr> <td background="../images/left.gif"></td> <td align="left"> <?php if($_REQUEST['r']=="1"){ echo '<br><p class="redbold">Your feedback has been recorded.</p>'; }else{ echo '<br>'; } if ($_SESSION['Name'] !=""){ ?> <div id="commentlink"> <a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a> </div> <div id="addcomment" style="display:none;"> <form method="post" action="add_comment.php?BuyerID=<?php=$_REQUEST['BuyerID'];?>" onSubmit="return validate(this);"> <table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3"> <tr bgcolor="#CCCCCC"><td colspan="2" class="headings" style="color:#666666 ">Post a Comment</td></tr> <tr><td align="right" class="content">Name:</td><td><input type="text" name="Name" id="Name"></td></tr> <tr><td align="right" class="content">Rating:</td><td><select name="Rating"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td align="right" class="content">Comment:</td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr> <tr><td></td><td><input type="submit" value="Submit"></td></tr> </table> </form> </div> <?php }else{ echo '<a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>'; $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ echo '<br>'; while($row_comments = @mysql_fetch_array($resultcomments)){ echo '<p class="content"> <span style="color:#990000;">Comment By: '.$row_comments['CommentBy'].'</span> - <span style="color:#666666">Posted on '.date("M d, Y",strtotime($row_comments['AddedDate'])).'</span> <br> <span style="color:#000066">Rating: </span><img src="../images/rating'.$row_comments['Rating'].'.gif" border="0"> <br> '.$row_comments['Comment'].' </p>'; } } ?> </td> <td background="../images/right.gif"></td> </tr> <tr> <td width="7" height="4"><img src="../images/bottomleft.gif"></td> <td background="../images/bottom.gif"></td> <td width="8" height="4"><img src="../images/bottomright.gif"></td> </tr> </table> <?php } ?> </td> </tr> <!-- end of view contact details --> </table> </td> </tr> </table> </td> </tr> </table> <?php include "footer.php"; ?> </body> </html> <?php }else{ echo "Sorry, no record found.."; } ?> Hi! Thanks The Little Guy, I tried your code but it gives this error: Parse error: syntax error, unexpected '=' on line 13 I really appreciate your help, could you pls take some more time and help me pls. Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764603 Share on other sites More sharing options...
Cal Posted February 17, 2009 Share Posted February 17, 2009 <?php=$row_sellerdetails['CompanyName'];?> ^You can't do it like that, it has to be a short open tag like <?=$row_sellerdetails['CompanyName'];?> Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764613 Share on other sites More sharing options...
kenrbnsn Posted February 17, 2009 Share Posted February 17, 2009 No, don't use short tags. "<?=" is the short tag for <?php echo", so the line should read: <?php echo $row_sellerdetails['CompanyName'];?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764617 Share on other sites More sharing options...
teramera Posted February 17, 2009 Author Share Posted February 17, 2009 Quote No, don't use short tags. "<?=" is the short tag for <?php echo", so the line should read: <?php echo $row_sellerdetails['CompanyName'];?> Ken I tried both yours as well as Cal's suggestions. If I change that line which is line 13 I get another error saying: Parse error: syntax error, unexpected '=' on line 68 Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764627 Share on other sites More sharing options...
The Little Guy Posted February 17, 2009 Share Posted February 17, 2009 Oops sorry... Fixed: <?php session_start(); include("../includes/connection.php"); include("../includes/config.php"); $sql_sellerdetails = "select * from buyer, buyer_profile WHERE buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $result_sellerdetails = mysql_query($sql_sellerdetails); $row_sellerdetails = @mysql_fetch_array($result_sellerdetails); if(@mysql_num_rows($result_sellerdetails) > 0){ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo $row_sellerdetails['CompanyName'];?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <script language="javascript"> function validate(theform){ if(theform.Name.value == ""){ alert("Please enter Name"); theform.Name.focus(); return false; }else if(theform.Comment.value == ""){ alert("Please enter Comment"); theform.Comment.focus(); return false; } return true; } function showComment(){ document.getElementById('addcomment').style.display = "block"; document.getElementById('commentlink').style.display = "none"; } </script> </head> <body> <table border="0" cellspacing="0" width="1000" align="center"> <tr> <?php include("topheader.php"); ?> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="1000" align="center"> <tr> <td colspan="2" align="center" valign="middle" background="../images/companyheadingbg.jpg" height="86"> <?php if($row_sellerdetails['CompanyLogo'] != ""){ echo '<img src="../'.$row_sellerdetails['CompanyLogo'].'" border="0" align="absmiddle" style="border:2px solid #8080C0"> <a href="index.php?BuyerID='.$_REQUEST['BuyerID'].'>" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; }else{ echo '<a href="index.php?BuyerID='.$_REQUEST['SellerID'].'" class="companyheading">'.$row_sellerdetails['CompanyName'].'</a>'; } ?> </td> </tr> <tr> <td colspan="2"> <table border="0" cellpadding="0" cellspacing="0" width="100%" background="../images/GSMenuBg.gif"> <tr> <td align="center" height="32"><a href="index.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="whitenav">Home</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="buying_leads.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="whitenav">Buying Leads</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <td align="center"><a href="blogs.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="whitenav">Blogs</a></td> <td width="2"><img src="../images/gsmenubgright.gif" border="0"></td> <?php if($row_sellerdetails['GoldMember'] == 1){ echo '<td align="center"><a href="about_us.php?BuyerID='.$_REQUEST['BuyerID'].'" class="whitenav">About Us</a></td><td width="2"><img src="../images/gsmenubgright.gif" border="0"></td>'; } ?> <td align="center"><a href="view_contact_details.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="whitenav">Contact Us</a></td> </tr> </table> </td> </tr> <tr> <td width="21%" align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of company profile--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="about_us.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>#companyprofile" class="headinglink">Company Profile</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of company profile --> <!-- start of rating/comment--> <table border="0" cellpadding="0" cellspacing="0" height="10"> <tr> <td></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading"><a href="ratings.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="headinglink">Ratings/Comments</a></td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> </table> <!-- end of rating/comment --> <table border="0" cellpadding="0" cellspacing="0" height="10"><tr><td></td></tr></table> <!-- start of contact Us--> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="9" height="26"><img src="../images/bar-box_01.gif"></td> <td background="../images/bar-box_03.gif" class="heading">Contact Us</td> <td width="9" height="26"><img src="../images/bar-box_05.gif"></td> </tr> <tr> <td background="../images/bar-box_09.gif"></td> <td background="../images/bar-box_10.gif"> <table border="0" cellpadding="3" cellspacing="0" width="100%" class="leftbar"> <tr> <td height="5"></td> <td></td> </tr> <?php $sqlContactUs = "SELECT * FROM buyer, buyer_profile where buyer.BuyerID=buyer_profile.BuyerID and buyer.BuyerID=".$_REQUEST['BuyerID']; $resultContactUs = mysql_query($sqlContactUs, $conn); if (@mysql_num_rows($resultContactUs)!=0){ $row_ContactUs = @mysql_fetch_array($resultContactUs); echo ' <tr> <td width="3"></td> <td class="contentblack"> '.$row_ContactUs['CompanyName'].' <br><br> <strong>Address:</strong><br> '.$row_ContactUs['StreetAddress'].' '.$row_ContactUs['StreetAddress2'].' '.$row_ContactUs['StreetAddress3'].' '.$row_ContactUs['City'].' <br> <br>'; ?> <a href="contact_now.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>"><img src="../images/inquire_now.gif" border="0"></a> <br> <br> <img src="../images/view_contact.gif" border="0" align="absmiddle"> <a href="view_contact_details.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" class="contactus">View Contact Details</a> <?php echo "</td> </tr>"; } ?> </table> </td> <td background="../images/bar-box_11.gif"></td> </tr> <tr> <td width="9" height="13"><img src="../images/bar-box_15.gif"></td> <td background="../images/bar-box_16.gif"></td> <td width="9" height="13"><img src="../images/bar-box_17.gif"></td> </tr> </table> <!-- end of contact us--> </td> <td width="79%" align="center" valign="top"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr height="10"> <td></td> </tr> <!-- start view Contact Details --> <tr> <td> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="7" height="22"><img src="../images/topleft.gif"></td> <td background="../images/top.gif" class="heading">Ratings/Reviews/Comments</td> <td width="8" height="22"><img src="../images/topright.gif"></td> </tr> <tr> <td background="../images/left.gif"></td> <td align="left"> <?php if($_REQUEST['r']=="1"){ echo '<br><p class="redbold">Your feedback has been recorded.</p>'; }else{ echo '<br>'; } if ($_SESSION['Name'] !=""){ ?> <div id="commentlink"> <a href="javascript:showComment();" class="edit">Click here to post Comment/Rating</a> </div> <div id="addcomment" style="display:none;"> <form method="post" action="add_comment.php?BuyerID=<?php echo $_REQUEST['BuyerID'];?>" onSubmit="return validate(this);"> <table border="0" width="100%" style="border:1px solid #cccccc;" cellpadding="3"> <tr bgcolor="#CCCCCC"><td colspan="2" class="headings" style="color:#666666 ">Post a Comment</td></tr> <tr><td align="right" class="content">Name:</td><td><input type="text" name="Name" id="Name"></td></tr> <tr><td align="right" class="content">Rating:</td><td><select name="Rating"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td align="right" class="content">Comment:</td><td><textarea name="Comment" id="Comment" cols="50" rows="5"></textarea></td></tr> <tr><td></td><td><input type="submit" value="Submit"></td></tr> </table> </form> </div> <?php }else{ echo '<a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br>'; $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){ echo '<br>'; while($row_comments = @mysql_fetch_array($resultcomments)){ echo '<p class="content"> <span style="color:#990000;">Comment By: '.$row_comments['CommentBy'].'</span> - <span style="color:#666666">Posted on '.date("M d, Y",strtotime($row_comments['AddedDate'])).'</span> <br> <span style="color:#000066">Rating: </span><img src="../images/rating'.$row_comments['Rating'].'.gif" border="0"> <br> '.$row_comments['Comment'].' </p>'; } } ?> </td> <td background="../images/right.gif"></td> </tr> <tr> <td width="7" height="4"><img src="../images/bottomleft.gif"></td> <td background="../images/bottom.gif"></td> <td width="8" height="4"><img src="../images/bottomright.gif"></td> </tr> </table> <?php } ?> </td> </tr> <!-- end of view contact details --> </table> </td> </tr> </table> </td> </tr> </table> <?php include "footer.php"; ?> </body> </html> <?php }else{ echo "Sorry, no record found.."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764631 Share on other sites More sharing options...
kenrbnsn Posted February 17, 2009 Share Posted February 17, 2009 You are still using the short tag "<?=". You really should use "<?php echo " instead. Short tags may not be enabled on every machine and your code would break if run on a machine with short tags disabled. Ken Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764635 Share on other sites More sharing options...
The Little Guy Posted February 17, 2009 Share Posted February 17, 2009 Quote You are still using the short tag "<?=". You really should use "<?php echo " instead. Short tags may not be enabled on every machine and your code would break if run on a machine with short tags disabled. Ken OK, I fixed that, I modified my prev post. Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764638 Share on other sites More sharing options...
teramera Posted February 17, 2009 Author Share Posted February 17, 2009 Thanks a ton The Little Guy, you made my day ! May you have a Wonderful Day as well. Thanks also everyone else for helping and keeping me going with the hope of getting it done. God Bless to all and Specially to phpfreaks.com for providing such a great service platform. Cheers ! Tera Quote Link to comment https://forums.phpfreaks.com/topic/145478-solved-php-code-error/#findComment-764646 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.