creating an tab

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!

Moderator: General Moderators

User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: creating an tab

Post by Jonah Bron »

jhaustein wrote:... but i don´t know how to change the php code...
Post what you have.
jhaustein
Forum Newbie
Posts: 11
Joined: Fri Sep 17, 2010 1:40 am

Re: creating an tab

Post by jhaustein »

only this code

<table>
<tr>
<td></td>
<?php
$mysql = mysql_connect('localhost', 'root', '');
mysql_select_db("test");


$query = mysql_query('SELECT * FROM dates', $mysql);

echo mysql_errno() . ": " . mysql_error(). "\n";
$count = 0;
while ($row = mysql_fetch_assoc($query)) {
echo '<td>' . $row['datum'] . '</td>';
$count += 1;
}
?>
</tr>
<?php
$query = mysql_query('SELECT * FROM member', $mysql);
while ($row = mysql_fetch_assoc($query)) {
echo '<tr>' . PHP_EOL . '<td>' . $row['name'] . '</td>' . PHP_EOL;
for ($i = 0; $i < $count; $i++) {
echo '<td><input type="checkbox" name="checkbox[]" value="???" /></td>' . PHP_EOL;
}
echo '</tr>' . PHP_EOL;
}
?></table>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: creating an tab

Post by Jonah Bron »

Are you asking just how to get the availability of all members and display it?
jhaustein
Forum Newbie
Posts: 11
Joined: Fri Sep 17, 2010 1:40 am

Re: creating an tab

Post by jhaustein »

hi jonah

yes the availability with checkboxes in the table

and the possibilty for the members to change the status of the checkboxes
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: creating an tab

Post by Jonah Bron »

To view the availability, use the code above. Populate the table you made with some fake info just to fill it up. Then, as you loop through the dates, do another loop inside of that looping through members. If that member is available on that date, put ' checked=""' into the checkbox. If not, then don't.
jhaustein
Forum Newbie
Posts: 11
Joined: Fri Sep 17, 2010 1:40 am

Re: creating an tab

Post by jhaustein »

Hi jonah
THx for your help but i don't Know Code for this Task

Sorry
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: creating an tab

Post by Jonah Bron »

You don't have to know the code. Almost everything I do on my own projects I've never done before. You just try to work through the logic and start typing.
Post Reply