MYSQL and PHP + HTML table

Codes here !

Moderators: egami, macek, gesf

Post Reply
Wyciokazz
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Apr 08, 2011 5:53 am

Thu Apr 03, 2014 1:43 pm

Hello i have a question i have a table but i don't know how to generate text to fill in from mysql Image

I'm thinking about this code but it doesn't work.

Code: Select all

			<table style="width: 100%" cellspacing="3" cellpadding="3">
					<tr>
					<td></td>

				<?php
					$result=mysql_query("SELECT * FROM ".DB_PREFIX."dalykai ORDER by dalykas");
					while($r = mysql_fetch_array($result)) {
				echo "<td>{$r['dalykas']}</td>";
					$result2 = mysql_query("SELECT * FROM ".DB_PREFIX."pazymiai where studentas = '6' AND dalykas = '{$r['id']}' ORDER by dalykas") or die(mysql_error());
					print("SELECT * FROM ".DB_PREFIX."pazymiai where studentas = '6' AND dalykas = '{$r['id']}' ORDER by dalykas  <br />");
					}
					?>
				</tr>
				<tr>
					<td>Aidas</td>
				<?php
				while($w = mysql_fetch_array($result2)) {
				echo "<td>{$w['pazymys']}</td>";
				}
				?>
				</tr>
				<tr>
					<td>Vardas</td>
					<td>5</td>
					<td>6</td>
				</tr>
				</table>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests