Hi I have just started learning php a few weeks ago and was happily modifying my website until i met with this really confusing problem that has been troubling me all day long.I created a Layout Table and drew 3 Layout cell (I'm using Dreamweaver).Then i did three different php scripts and pasted it to the 3 cells.Problem is, when i pasted the 3rd php script in the 3rd Cell,the php script at the 2nd cell wont show up!If i take out the 2nd php script in the 2nd cell the 3rd script will be visible!these two scripts just can't coexist with each other and i can't seem to find what went wrong anywhere... This code is before i insert the 3rd php script: <br> <?php echo $row[search] ?> <!--<table class="wd750" align="center"> <tr> <td class="usp"><span class="tagline">$row[banner]</td> </tr> </table> --> <table class="wd750" align="center"> <tr> <td class="hrhdlL"><span class="tagline"><strong>Browse by category</strong></span></td> </tr> </table> <hr> <table width=100% cellspacing="5" cellpadding="0"> <!--DWLayoutTable--> <tr> <td width="138" height="157" valign="top"><p> </p> </td> <td width="657" valign="top"> <table width=100%> <!--DWLayoutTable--> <tr> <td height="21" valign="top"> <br> <?php echo $row[displaycat] ?></td> </tr> <tr> <td width="634" height="128"> </td> </tr> <!--DWLayoutTable--> </table></td> <td width=152 valign="top" nowrap><p class="tagline"></p> <p class="tagline"> </p> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("2u2ia", $con); $result = mysql_query("SELECT * FROM textad limit 10"); while($row = mysql_fetch_array($result)) { $siteurl = $row["link"]; $sitetext = $row["text"]; echo ("<a href='http://$siteurl'>$sitetext </a>"); echo "<br />"; echo "<br />"; } mysql_close($con); ?> <p> </p> <p> </p></td> </tr> </table> ========================================================= and this is after i added the 3rd script: <br> <?php echo $row[search] ?> <!--<table class="wd750" align="center"> <tr> <td class="usp"><span class="tagline">$row[banner]</td> </tr> </table> --> <table class="wd750" align="center"> <tr> <td class="hrhdlL"><span class="tagline"><strong>Browse by category</strong></span></td> </tr> </table> <hr> <table width=100% cellspacing="5" cellpadding="0"> <!--DWLayoutTable--> <tr> <td width="138" height="157" valign="top"><p> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("2u2ia", $con); $result = mysql_query("SELECT * FROM bannerad "); while($row = mysql_fetch_array($result)) { $siteurl = $row["banlink"]; $filename = $row["banname"]; $adid = $row["bannerid"]; echo ("<a href='http://$siteurl'><img border=\"2\" src=\"banners/$filename\" width=\"100\" height=\"50\"></a>"); } mysql_close($con); ?></p> </td> <td width="657" valign="top"> <table width=100%> <!--DWLayoutTable--> <tr> <td height="21" valign="top"> <br> <?php echo $row[displaycat] ?></td> </tr> <tr> <td width="634" height="128"> </td> </tr> <!--DWLayoutTable--> </table></td> <td width=152 valign="top" nowrap><p class="tagline"></p> <p class="tagline"> </p> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("2u2ia", $con); $result = mysql_query("SELECT * FROM textad limit 10"); while($row = mysql_fetch_array($result)) { $siteurl = $row["link"]; $sitetext = $row["text"]; echo ("<a href='http://$siteurl'>$sitetext </a>"); echo "<br />"; echo "<br />"; } mysql_close($con); ?> <p> </p> <p> </p></td> </tr> </table> ======================================================= Somebody help me......
Just I can say that you missed ; twice; May be that is the problem. echo $row[search] ; echo $row[displaycat] ;
What YIAM says should be the case. You need semi colon to end a statement. Echo will not overlap. It will list everything out. Example: echo "My"; echo " name"; echo " is"; PHP: The output will be as follow My name is Code (markup):
no,friend,i think there is another problem check $row[banner] you didn't use <? ?> and you didn't use echo(); so it's uselss. please be patient,when you begin to step into the php world hope this helps. /s
I have put the semicolons but the problem is still there. for the $row[banner] i already put <!-- and --> because i don't want to display it at this moment... Is it possible that the 2nd php script used up the space and the 3rd php script was unable to squeeze in? I have attached the screenshots for 1)before i pasted the 3rd php script 2) and after i pasted the 3rd php script at wwwsabahholidaycom/why.html
I finally managed to get all the php scripts to appear. For this part "<?php echo $row[displaycat]?>" i had to make a direct connection to the mysql database like the other two scripts.Thanks guys for pointing out my mistakes >v<