ineedhelp512 Posted September 14, 2009 Share Posted September 14, 2009 I was here last night for adsense setup in my code and the problem was not resolved and i ended up using the include function and it worked for me. Now include function is working here <!--Business Homepage--> <td valign='bottom' align='center'>"; if( strlen( $row[9] ) !=0 ){ echo "<a target='_blank' href='http://".$row[9]."'><img src='images/home_icon.png' alt=''><br/> website </a>";} echo "</td> <!-- Email --> <td valign='bottom' align='center'>"; if( strlen( $row[10] ) !=0 ){ echo"<a href='mailto:".$row[10]."'><img src='images/email_icon.png' alt=''><br/>email </a>";} echo"</td> </tr></table>"; [b]include("ad.html");[/b] echo "</td><td valign='center' align='center'>"; echo "<br /><img src='images/logo-small.png' alt='' /><br/>"; echo "<strong><a href=\"javascript:slogan('".$row[15]."')\">See Business Slogan</a></strong>"; echo "</td></tr><tr><td colspan='2'><hr /></td></tr>"; it seems to be working here but doesnt work below i am pretty sure that i am missing a tag or something in the code below but cant seem to figure it out, PLEASE HELP the code is below. //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' /> [b]include("ads.html");[/b] </td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query; now if you see the above code you will find include("ads.html"); and it doesnt work.... can anyone tell me why.... please tell me if i am missing something in the code, please let me know where is the mistake. Thanks in advance. Your help will be truly appreciated. James. Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/ Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 Anyone Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917954 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 you get any error when you running this code? or you just dont see anything? Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917956 Share on other sites More sharing options...
Garethp Posted September 14, 2009 Share Posted September 14, 2009 Change [b]include("ads.html");[/b] to [b]"; include "ads.html"; echo "[/b] Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917957 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 Change [b]include("ads.html");[/b] to [b]"; include "ads.html"; echo "[/b] the [/b/] is not the part of his code, i think he added it in attempt to make the "include" bold so we can reconize it... but it's wont work in "code" tags... Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917960 Share on other sites More sharing options...
mikesta707 Posted September 14, 2009 Share Posted September 14, 2009 regardless of whether or not the [b] tags are in the actual code or not, gareths solution is correct. You are echoing "include('ads.php')" which will just output it to the screen. if you want to actually run the function, you can't have it in the echo statement. BTW, this is mostly personal preference, but I wouldn't echo out that much HTML. if all you want to do is show it just do <?php //php here ?> <!-- HTML HERE -> <?php //more php ?> <!-- More HTML --> <?php //etc. ?> Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917975 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 the[ b ] [ / b ] was just an attempt to make include("ads.html"); bold for you guys to see it in the code here is the error that i get Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/ blahblah and i tried your suggestions above but not woring please review the above code. Thanks for your replies sorry for being late.... i had to restart my machine James. Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917979 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 ok, this should work... //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' />"; include("ads.html"); echo "</td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query; Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917980 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 no it doesnt.....sorry any other suggestions Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917983 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 you still get the same error? Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917984 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 yes same error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/blahblah Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917987 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 ummm i cant find any problems.... umm try to run this code and tell me if you get error: //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' />"; echo "</td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query; i just removed the include ads.html if you dont get any error with this code, so the problem in your ads.html file... Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917988 Share on other sites More sharing options...
Garethp Posted September 14, 2009 Share Posted September 14, 2009 On what line was the error in? Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917989 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 this is what i get after removing include "ads.html" and adding echo Parse error: syntax error, unexpected '/' in /home/blah blah Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917990 Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 give us a link to your page, or tell me in what line was the error? Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-917993 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 Here is the complete code site is under .htaccess login right now..... <?php $pageTitle='Your Search Results'; include("header_query.php"); ?> <body OnLoad="loadImages()"> <!-- LOADING PAGE --> <div id="hidepage" style="position: absolute; left:0px; top:225px; height: 100%; width: 100%;"> <table width=100% height=100%><tr><td align='center' valign='center'> <object width="225" height="200"> <param name="movie" value="nationwideloading.swf"> <embed src="images/something.swf" width="500" height="200"> </embed> </object> </td></tr></table></div> <!-- LOADING PAGE --> <?php include("ps_pagination.php"); //set db server access variables $host = "something"; $user = "something"; $pass = "something"; $db = "something"; //open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); //select database mysql_select_db($db) or die ("Unable to select database!"); //create query //if(!isset($name)){ $name = $_GET["name"]; //} //if(!isset($category)){ $category = $_GET["category"]; //} //if(!isset($city)){ $city = $_GET["city"]; //} //if(!isset($state)){ $state = $_GET["state"]; //} if ($state == "NW") { $state=""; } if(strlen($city) == 0){ $cityQuery = ""; }else{ $cityQuery = "and `city` = '$city' "; } if(strlen($state) == 0){ $stateQuery = ""; }else{ $stateQuery = "and `state` = '$state' "; } if (strlen($category) == 0) { $type="`name` LIKE '".$name."%'"; } if (strlen($name) == 0) { $type="`description` LIKE '%".$category."%'"; } /* if (strlen($city) == 0) { $cityQuery = ""; } else { $cityQuery = "and city = '$city'"; } if ($state == "NW") { $stateQuery = ""; } else { $stateQuery = "and state = '$state'"; } */ /* if(!isset($_GET['query'])){ { if( strlen($category) == 0 ){ $query = "SELECT * FROM clients WHERE name LIKE '$name%' $cityQuery $stateQuery"; }else if( strlen($name) == 0 ){ $query = "SELECT * FROM clients2 WHERE description LIKE '%$category%' $cityQuery $stateQuery"; //name=&category=&city=&state= } $query = $query ." ORDER BY name"; }*/ // $query creation // Detetermine which table to use based on the selected state $region2 = array("CO","IA","KS","MN","MO","MT","ND","NE","SD","UT","WI","WY","AR","AZ","LA","NM","OK","TX","AK","CA","HI","ID","NV","OR","WA"); if (array_search($state, $region2) == NULL) $dbtable = "clients"; else $dbtable = "clients9"; if(!isset($_GET['query'])){ $query = "SELECT * FROM `clients` WHERE " . $type . " " . $cityQuery . " " .$stateQuery; $query = $query ." ORDER BY name"; }else{ $query=$_GET['query']; } if( strlen($category) == 0 && strlen($name) == 0 ){ //$query = NULL; } // Pagination // how many rows to show per page $rowsPerPage = 15; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $pager = new PS_Pagination($connection, $query, 15, 10, $name, $category, $city, $state ); //execute query //$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $result = $pager->paginate(); $totalResults = $pager->getNumberOfResults(); $totalPages = $pager->getNumberOfPages(); //displaying results echo " <div id='header'> <!--<h1>YellowPages</h1>--> <table border='0' width='100%'> <tr><td align='left'> <span><img src='images/banner_logo.png' alt='' /></span> </td><td align='right'> <span><img src='images/toll.gif' alt='' /></span> </td><td> </td></tr></table> </div>"; include("navigation.php"); echo "<div id='content'> <div id='hspace'> <!-- horizontal space --> </div> <!-- horizontal space --> <table border='0' width='100%'> <tr> <td width='200px' valign='center' align='center'> <img src='images/contact.png' width='225px' alt='' /> </td> <td> <h2 class='title'>Number of businesses found: ".$totalResults." - Page ".$pageNum." of ".$totalPages."</h2> <div class='content'>"; /*if( $query == NULL ){ echo "SEARCH ERROR MESSAGE"; }else if ( strlen($city) == 0 && strlen($category) == 0 ){ echo "SEARCH ERROR MESSAGE CATEGORY"; }*/ //echo $query; // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=0 width=100% >"; while($row = mysql_fetch_row($result)) { echo "<tr><td><b>"; /* echo "<td>".$row[0]."</td>"; echo "<td>".$row[1]."</td>"; echo "<td>".$row[2]."</td>"; echo "<td>".$row[3]."</td>"; echo "<td>".$row[4]."</td>"; echo "<td>".$row[11]."</td>"; */ echo $row[1]."</b><br/><br/>"; echo $row[2].", <br/>"; echo $row[3].", ". $row[4] . ", " .$row[5] ."<br />"; $phone = $row[6]; if(strlen($phone)!=0){ $area = substr($phone, 0, 3); $pre = substr($phone, 3, 3); $post = substr($phone, 6, 4); echo "Telephone: (" .$area.") ".$pre."-".$post. "<br />"; } $fax = $row[8]; if(strlen($fax)!=0){ $farea = substr($fax, 0, 3); $fpre = substr($fax, 3, 3); $fpost = substr($fax, 6, 4); echo "Fax: (" .$farea.") ".$fpre."-".$fpost. "<br />"; } if(strlen($row[10])!=0){ echo "Email: <a href='mailto:".$row[10]."'>".$row[10]." </a><br/>"; } if(strlen($row[9])!=0){ echo "Website: <a target='_blank' href='http://".$row[9]."'>".$row[9]."<br/>"; } echo $row[11]."</b><br/><br/>"; echo " <table border='0' cellpadding='5px' width='100%'><tr> <td valign='bottom' align='center'><a target='_blank' href='http://www.mapquest.com/maps/map.adp?address=". $row[2] ."&city=".$row[3]."&state=".$row[4]."&country=us&cid=lfmaplink'><img src='images/map_icon.png' alt='' /></a><br /> <a target='_blank' href='http://www.mapquest.com/maps/map.adp?address=". $row[2] ."&city=".$row[3]."&state=".$row[4]."&country=us&cid=lfmaplink'>map</a> </td> <!--Business Homepage--> <td valign='bottom' align='center'>"; if( strlen( $row[9] ) !=0 ){ echo "<a target='_blank' href='http://".$row[9]."'><img src='images/home_icon.png' alt=''><br/> website </a>";} echo "</td> <!-- Email --> <td valign='bottom' align='center'>"; if( strlen( $row[10] ) !=0 ){ echo"<a href='mailto:".$row[10]."'><img src='images/email_icon.png' alt=''><br/>email </a>";} echo"</td> </tr></table>"; include("ad.html"); echo "</td><td valign='center' align='center'>"; echo "<br /><img src='images/logo-small.png' alt='' /><br/>"; echo "<strong><a href=\"javascript:slogan('".$row[15]."')\">See Business Slogan</a></strong>"; echo "</td></tr><tr><td colspan='2'><hr /></td></tr>"; } echo "</table>"; //----------------- // print the link to access each page echo $pager->renderFullNav(); } else { // no // print status message echo "<img src='images/info.gif' alt='' /> We apologize, no somethingsomething.com listings matching your search criteria were found.<br /><br/>"; echo "Please return to the <a href='index.php'>previous page</a> and re-enter correct or more search criteria."; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); echo "</td></tr></table></div>"; include("footer.php"); ?> the error come on line 161 and thats where i want to include the ads.html file it works perfectly on line 232 Please solve this for me..... i am stuck for months and just keep scratching my head..... Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-918001 Share on other sites More sharing options...
ineedhelp512 Posted September 14, 2009 Author Share Posted September 14, 2009 you still there Quote Link to comment https://forums.phpfreaks.com/topic/174139-need-help-for-include-function-in-my-code/#findComment-918010 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.