PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<table width="100%" border="0" cellspacing="0" cellpadding="0"> // begin master table
<tr> // begin master table's only row
while ()
{ // begin while loop
<td> // begin master table column to be repeated by loop
<table width="25%" border="0" cellspacing="0" cellpadding="0"> // begin sub-table in master table column
<tr> // sub-table row 1
<td><div align="center">$image</div></td>
</tr> //end sub-table row 1
<tr> // sub-table row 2
<td><div align="center">$title</div></td>
</tr> // end sub-table row 2
<tr> // sub-table row 3
<td><div align="center">$make</div></td>
</tr> // end sub-table row 3
<tr> // sub-table row 4
<td><div align="center">$var</div></td>
</tr> // end sub-table row 4
</table> //end sub-table
</td> //end master table column
} //end loop
</tr> //end master table row
</table> //end master table
hopefully this is self-explanatory or i drew it out well enough for everyone to see. im pretty sure my html is correct here, but my problem is all the php syntax within the loop. can someone help me out here by giving all the correct,error-free syntax. no matter how hard i try i can never get the errors worked out. i thought a 'clean' version would be easier to work with if someone feels like tackling it. thanks.
The above code would be saved as a .php file. It basically goes through a loop 4 times, each time printing the <table> code. As you can see, each time a PHP statement is used, it is described by using <?php ?> tags. This is necessary in order to let the parser know that it's encountering PHP code which needs to be processed.
my problem lies in the parse errors im receiving within the loop...not how many times its run (im controlling the record navigation already). maybe playing with the code ive already posted for the tables...inserting where i should start <?php and end it ?> etc. also inserting proper punctuation where i need it would help. thanks
Well if you look at the way you set up your loop, there is no <?php ?> tag and also, it doesn't have an 'echo' or 'print' statement telling it to print the table.
i just didnt put the echo or php tags in this post. of course theyre in my script. how should i treat all that table info that i posted first if im trying to echo it (thats what i was originaly asking...echo the entire loop). should i be using ".;" and where?
while ()
{ // begin while loop
echo "<td>\n"; // begin master table column to be repeated by loop
echo "<table width="25%" border="0" cellspacing="0">\n";
and so on and so forth. just make sure to escape all the " other the ones for the echo statement. the \n is a carriage return which will put whatever is in the the next statement on a new line.