| | |
3 lines of code not working
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
php Syntax (Toggle Plain Text)
<table align="left" style="width: 764px"> <tr> <td> <?php $con =mysql_connect("localhost","root",""); mysql_select_db("administration",$con); $list=mysql_query("SELECT * FROM cycles"); echo "<table border=1>"; echo "<tr>" ; echo "<td align=center style='color:red'>CID</td>"; echo "<td align=center style='color:green'>Brand</td>"; echo "<td align=center style='color:red'>Type</td>"; echo "<td align=center style='color:green'>Style</td>"; echo "<td align=center style='color:red'>Model</td>"; echo "<td align=center style='color:green'>Gear No</td>"; echo "<td align=center style='color:red'>Frame</td>"; echo "<td align=center style='color:green'>Group Set</td>"; echo "<td align=center style='color:red'>Price</td>"; echo "<td align=center style='color:green'>Release Date</td>"; echo "</tr>"; $bg = '#eeeeee'; // Set the background color. while($row=mysql_fetch_array($list)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); echo "<tr>" ; echo "<td align=center>".$row['cycleID'] ."</td>"; echo "<td align=center>".$row['brand']."</td>"; echo "<td align=center>".$row['type']."</td>"; echo "<td align=center>".$row['style']."</td>"; echo "<td align=center>".$row['model'] ."</td>"; echo "<td align=center>".$row['gearNo']."</td>"; echo "<td align=center>".$row['frame']."</td>"; echo "<td align=center>".$row['groupSet']."</td>"; echo "<td align=center>".$row['price']."</td>"; echo "<td align=center>".$row['releaseDate']."</td>"; echo "</tr>"; } echo "</table>"; ?> </td> </tr> </table>
The code from line 23 - 26 is not functioning. Please help.
"I might not be the BEST but I'm not like the REST!"
•
•
Join Date: Apr 2006
Posts: 66
Reputation:
Solved Threads: 11
first of all ... where do you use $bg ? i don't see something like
echo "<td bgcolor='".$bg."'> .. if your rows are all white (or #eeeeee) this might be the problem.
echo "<td bgcolor='".$bg."'> .. if your rows are all white (or #eeeeee) this might be the problem.
•
•
•
•
<?php
@ $rpp; //Records Per Page
@ $cps; //Current Page Starting row number
@ $lps; //Last Page Starting row number
@ $a; //will be used to print the starting row number that is shown in the page
@ $b; //will be used to print the ending row number that is shown in the page
$q="Select SQL_CALC_FOUND_ROWS * from tablename";
$rs=mysql_query($q) or die(mysql_error());
$nr = mysql_num_rows($rs); //Number of rows found with LIMIT in actiong r
$q0="Select FOUND_ROWS()";
$rs0=mysql_query($q0) or die(mysql_error());
$row0=mysql_fetch_array($rs0);
$nr0 = $row0["FOUND_ROWS()"];
$i=$nr0;
while ($line=mysql_fetch_array($rs))
{
if($i %2 == 0)
{
echo "<tr>";
echo "<td>";
echo "<table bgcolor='#fefefe' width='73%' align='center' border='0'>";
echo "<tr><td width='25%'></td></tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
}
else if($i %2 == 1)
{
echo "<tr>";
echo "<td>";
echo "<table bgcolor='#e5e1e1' width='73%' border='0' align='center'>";
echo "<tr><td width='55%'></td></tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
}
$i--;
}
}
![]() |
Similar Threads
- Overloaded + operator not working correctly. (C++)
- Extract MS Excel Data embedded in MS Word (Visual Basic 4 / 5 / 6)
- Code Snippet Size (DaniWeb Community Feedback)
- web form not working please help (ASP.NET)
- New C/C++ Source Code Search Website (C++)
- code seems to stop executing (C++)
- JRadioButtons not working in JMenu (Java)
- this code isn't working...why..plz help (C++)
- RE: Leaked Windows Source Code (IT Professionals' Lounge)
Other Threads in the PHP Forum
- Previous Thread: hyperlink and upload in PHP
- Next Thread: img not displayed
| Thread Tools | Search this Thread |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip javascript joomla limit link login mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem protocol query radio random recursion recursiveloop remote script search server sessions sms smtp soap source space sql strip_tags support! survey syntax system table template tutorial update upload url validator variable video virus web window.onbeforeunload=closeme; youtube






