XML link into a PHP array - php

I'm having trouble getting this page (http://ventrilostatus.net/xml/V98.DARKSTARLLC.COM:3789/) to array into php. I'm not very good with xml and I currently can only get it to display:
Server
Channel
Channel
Channel
(etc)
Could anyone help me get it to show the channel name and the users?
if there are not clients when you look at it it will be:
<client admin="1" cid="994" phan="0" ping="186" sec="56935" name="WHERE USER'S NAME HIS HERE" comm=""/>

U can use the simple_xml functions of PHP to load the xml file into a class.
http://php.net/manual/de/book.simplexml.php
Edit with an example:
// XML example
$xmlContent = '<server name="GuiltyofDestruction" phonetic="God" comment="http://guiltyofdestruction.com" auth="1" maxclients="25" uptime="137600" platform="Linux-i386" version="3.0.6" channelcount="36" clientcount="1" voicecodec="GSM 6.10" voiceformat="44 KHz, 16 bit"><channel cid="0" pid="-1" prot="0" name="Lobby" comm="">
<channel cid="1033" pid="0" prot="1" name="Admin" comm=""/>
<channel cid="1030" pid="0" prot="0" name="AFK Channel" comm="AFK">
<client admin="1" cid="1030" phan="0" ping="182" sec="67575" name="US_ChairForce" comm=""/>
</channel>
</channel>
</server>';
// Loading XML information as object
//$xml = simplexml_load_file('http://ventrilostatus.net/xml/V98.DARKSTARLLC.COM:3789/'); // for files
$xml = simplexml_load_string($xmlContent); // for strings
foreach($xml->channel->channel as $channel) {
if($channel->client)
echo $channel->client->attributes()->name; // returns "US_ChairForce"
}
I think it's clear now. You have to iterate through every channel and look for clients.

sorry this is the code I updated:
<?PHP
echo "<table width=\"209\" bgcolor=\"#0d0d0d\">";
$xml = simplexml_load_file('http://ventrilostatus.net/xml/V98.DARKSTARLLC.COM:3789/'); // for files
//$xml = simplexml_load_string($xmlContent); // for strings
foreach($xml->channel as $lobby) {
echo "<tr><td>";
echo "<img src='http://view.light-speed.com//images/s_vent2/server_icon.gif' />";
echo "<font color=\"#FFFFFF\">";
echo $lobby->attributes()->name;
echo "</font>";
echo "</td></tr>";
}
foreach($xml->channel->channel as $channel) {
if($channel->attributes()->prot == "0"){
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_0_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $channel->attributes()->name;
echo "</font>";
echo "</td></tr>";
}else{
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_1_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $channel->attributes()->name;
echo "</font>";
echo "</td></tr>";
}
if($channel->client){
for ( $i = 0; $i < count($channel->client); $i++ ){
$client = $channel->client[ $i ];
if ( $client->attributes()->cid != $client->attributes()->cid )
continue;
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/player.gif' /><font color=\"#009e1a\">";
if($client->attributes()->admin == "1"){
echo $client->attributes()->name;
echo " <font color=\"#ff0000\">(Admin)</font>";
}else{
echo $client->attributes()->name;
}
echo "</td></tr>";
}
}
foreach($channel->channel as $subchannel) {
if($subchannel->attributes()->prot == "0"){
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_0_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel->attributes()->name;
echo "</font>";
echo "</td></tr>";
}else{
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_1_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel->attributes()->name;
echo "</font>";
echo "</td></tr>";
}
if($subchannel->client){
for ( $i = 0; $i < count($subchannel->client); $i++ ){
$client = $subchannel->client[ $i ];
if ( $client->attributes()->cid != $client->attributes()->cid )
continue;
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/player.gif' /><font color=\"#009e1a\">";
if($client->attributes()->admin == "1"){
echo $client->attributes()->name;
echo " <font color=\"#ff0000\">(Admin)</font>";
}else{
echo $client->attributes()->name;
}
echo "</td></tr>";
}
}
foreach($subchannel->channel as $subchannel2) {
if($subchannel2->attributes()->prot == "0"){
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_0_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel2->attributes()->name;
echo "</font>";
echo "</td></tr>";
}else{
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_1_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel2->attributes()->name;
echo "</font>";
echo "</td></tr>";
}
if($subchannel2->client){
for ( $i = 0; $i < count($subchannel2->client); $i++ ){
$client = $subchannel2->client[ $i ];
if ( $client->attributes()->cid != $client->attributes()->cid )
continue;
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/player.gif' /><font color=\"#009e1a\">";
if($client->attributes()->admin == "1"){
echo $client->attributes()->name;
echo " <font color=\"#ff0000\">(Admin)</font>";
}else{
echo $client->attributes()->name;
}
echo "</td></tr>";
}
}
foreach($subchannel2->channel as $subchannel3) {
if($subchannel3->attributes()->prot == "0"){
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_0_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel3->attributes()->name;
echo "</font>";
echo "</td></tr>";
}else{
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/channel_1_empty.gif' />";
echo "<font color=\"#ffffff\">";
echo $subchannel3->attributes()->name;
echo "</font>";
echo "</td></tr>";
}
if($subchannel3->client){
for ( $i = 0; $i < count($subchannel3->client); $i++ ){
$client = $subchannel3->client[ $i ];
if ( $client->attributes()->cid != $client->attributes()->cid )
continue;
echo "<tr><td> ";
echo "<img src='http://view.light-speed.com//images/s_vent2/player.gif' /><font color=\"#009e1a\">";
if($client->attributes()->admin == "1"){
echo $client->attributes()->name;
echo " <font color=\"#ff0000\">(Admin)</font>";
}else{
echo $client->attributes()->name;
}
echo "</td></tr>";
}
}
}
}
}
}
echo "</table>";
?>
which shows
lobby
channel
subchannel
subchannel

Related

Ajax is not responding on remote server for Some PC's

*Ajax is not responding on remote server for Some PC's but working fine on mobile browsers and on PC which i have uploaded on. Please let me know whats the problem with that
This Ajax function.
<pre>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#selTrim').change(function(){
var trim_id1 = $(this).val();
if(trim_id1){
$.ajax({
type:'POST',
url:'<?= base_url();?>H1_specifications/h1_trim_detail',
data:'trim_id1='+trim_id1,
success:function(data){
$('#specContWrap').html(data);
}
});
}
});
});
</script>
</pre>
*This Php Code-igniter Controller response *.
I am using Code-igniter framework please also let me know is this a best practice to echo response .
<pre>
public function h1_trim_detail(){
$id = $_POST['trim_id1'];
if(isset($_POST['trim_id1']) !== NULL){
$this->load->model('Admin_panel');
$rows7 =$this->Admin_panel->select_h1_details_specification($id);
$rows =$this->Admin_panel->select_h1_Cargo($id);
$rows1 =$this->Admin_panel->select_h1_engine($id);
$rows2 =$this->Admin_panel->select_h1_exterior($id);
$rows3 =$this->Admin_panel->select_h1_feul_comsuption($id);
$rows4 =$this->Admin_panel->select_h1_weight($id);
$rows5 =$this->Admin_panel->select_h1_wheels($id);
$rows6 =$this->Admin_panel->select_h1_transmission($id);
echo "<div id='specContWrap'>";
if($rows7 !== false){
echo "<div id='overViewWrap' class='overViewTableCon'>";
echo "<div class='overViewTable on'>";
echo "<div class='tit'>Overview</div>";
echo "<table class='infoTableType'>";
echo "<caption>Overview Table</caption>";
echo "<tbody>";
echo "<tr>";
echo "<th scope='row'>Product label</th>";
echo "<td>Commercial</td>";
echo "</tr>";
foreach($rows7 as $row){
echo "<tr>";
echo "<th scope='row'>Product label</th>";
echo "<td>".$row['name']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th scope='row'>Model name</th>";
echo "<td>". $row['name_car']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th scope='row'>Seats</th>";
echo "<td>". $row['seats']."</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
echo "</div>";
}else{
echo "Not Found";
}
echo "<div class='togListWrap small sepcListWrap' id='overviewh1'>";
echo "<div class='togList'>";
echo "<button class='btnOpenClose'>Performance</button>";
echo "<div class='togCont' id='performanceWrap'>";
echo "<div class='performance on'>";
if($rows1 !== false){
echo "<dl class='specList'>";
echo "<dt>Engine Specification</dt>";
foreach($rows1 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['descriptions']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Engine Specification Not Found</dt><br>";
}
if($rows3 !== false){
echo "<dl class='specList'>";
echo "<dt>Feul Comsuption Specification</dt>";
foreach($rows3 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['description']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Feul Comsuption Specification Not Found</dt><br>";
}
if($rows6 !== false){
echo "<dl class='specList'>";
echo "<dt>Transmission Specification</dt>";
foreach($rows6 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['description']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Transmission Specification Not Found</dt><br>";
}
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='togList'>";
echo "<button class='btnOpenClose'>Dimension</button>";
echo "<div class='togCont' id='DimensionWrap'>";
echo "<div class='Dimension on'>";
if($rows2 !== false){
echo "<dl class='specList'>";
echo "<dt>Exterior Specification</dt>";
foreach($rows2 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['descriptions']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Exterior Specification Not Found</dt><br>";
}
if($rows4 !== false){
echo "<dl class='specList'>";
echo "<dt>Weight Specification</dt>";
foreach($rows4 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['description']."</dd>";
echo "</dl>";
echo "</dd><br>";
}
echo "</dl><br>";
}else{
echo "<dt>Weight Specification Not Found</dt><br>";
}
if($rows !== false){
echo "<dl class='specList'>";
echo "<dt>Cargo Specification</dt>";
foreach($rows as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['description']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Cargo Specification Not Found</dt><br>";
}
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div class='togList'>";
echo "<button class='btnOpenClose'>Wheels</button>";
echo "<div class='togCont' id='WheelsWrap'>";
echo "<div class='Wheels on'>";
if($rows5 !== false){
echo "<dl class='specList'>";
echo "<dt>Wheels Specification</dt>";
foreach($rows5 as $row){
echo "<dd>";
echo "<dl>";
echo "<dt>".$row['label']."</dt>";
echo "<dd>".$row['descriptions']."</dd>";
echo "</dl>";
echo "</dd>";
}
echo "</dl><br>";
}else{
echo "<dt>Wheels Specification Not Found</dt><br>";
}
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
}
</pre>

How to print username for each alphabet letter

I have script where I try to print names following its alphabetical letter:
$alphabets = 'abcdefghijklmnopqrstuvwxyz';
$usersResult = getUsersEmail();
echo "<div class='m0'>";
echo "<div id=woohoo class=hey_im_here>";
echo '<input class="search" placeholder="Enter a name">';
echo "<br><br>";
$c=26; //or count(alphabets)
$count = count($usersResult);
for ($ii=0;$ii<$c;$ii++){
echo "<div id='memberList$ii' style='display:inline-block;vertical-align:top'>";
echo "<fieldset class=fieldname style='display:inline'>";
echo "<legend class=name_legend>" . $alphabets[$ii] . "</legend>";
echo "<ul class='list'>";
while ($row_usrname = mysqli_fetch_array($usersResult)) {
if (strtolower(substr($row_usrname['username'],0,1)) == $alphabets[$ii]) {
echo '<li><label for="'.$row_usrname['username'].'">'
. '<input type="checkbox" id="'.$row_usrname['username'].'" class="empCheckBoxClass" name="employment[]" value="'.$row_usrname['staff_id'].'" />'.$row_usrname['username'].'</li> </label>';
}
}
echo "</ul>";
echo "</fieldset>";
echo "<br>";
echo "</div>";
}
echo "</div>";
echo "</div>";
I am able to print names only for A:
How can I print it for every letter?

How to get the highest value from a database row?

I have a problem. I have a one page website and if there is posted a message a posts shows up and below the post there needs to be an image, but on the last on the index page I don't want an image to show up. So it's like if the id from the database is the highest that post doesn't get a image below it.
Here is the code:
<?php
include 'functions/image/functions.php';
$countQuery = $db->prepare("SELECT paginaNummer AS max FROM pages ;");
$countRow = $countQuery->fetch();
$maxId = $countRow['max'];
$query = $db->prepare("SELECT * FROM pages");
$query->execute();
$num_cols = 1;
$i = 0;
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
while($row = $query->fetch()) {
if(isset($row)) {
echo "<section data-stellar-background-ratio='0.5'>";
echo "<div class='panelContainer'>";
echo "<div class='panel2'>";
echo "<div class='symbol3'></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</section>";
echo "<section class='wrapper'>";
echo "<div class='box'>";
echo "<div class='content'>";
echo $i++ % $num_cols == 0 ? '' : '';
echo "<div id='message'><h2> ", $row['berichtNaam'], "</h2>";
echo $row['paginaContent'], "<br />";
if (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 2) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
echo " <a class='delete' href='functions/admin/deletePost.php?id=" . $pageNumber . " '>Delete</a>";
} elseif (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 1) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
} else {
}
echo "</div>";
echo "</div>";
echo "</section>";
echo max($row);
if (count($row['paginaNummer']) == max($row)){
} else {
echo "<a href='/'><img src='<?php echo $path . $img ?>'alt=''/></a>";
}
echo "</section>";
}
}
echo "</div></div>";
?>
I won't get any further with this part I hope you can help me with this problem
It's hard to understand what you need. But try this query:
$countQuery = $db->prepare("SELECT paginaNummer AS max
FROM pages ORDER BY paginaNummer DESC LIMIT 1");
Or may be this:
$countQuery = $db->prepare("SELECT paginaNummer AS max
FROM pages ORDER BY id DESC LIMIT 1");
Update: this code changes instead of top:
<?php
include 'functions/image/functions.php';
$query = $db->prepare("SELECT * FROM pages");
$query->execute();
$maxrow = $query->rowCount();
$num_cols = 1;
$i = 0;
$imgList = getImagesFromDir($root . $path);
$img = getRandomFromArray($imgList);
$n = 0;
while($row = $query->fetch()) {
if(isset($row)) {
$n++;
echo "<section data-stellar-background-ratio='0.5'>";
echo "<div class='panelContainer'>";
echo "<div class='panel2'>";
echo "<div class='symbol3'></div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</section>";
echo "<section class='wrapper'>";
echo "<div class='box'>";
echo "<div class='content'>";
echo $i++ % $num_cols == 0 ? '' : '';
echo "<div id='message'><h2> ", $row['berichtNaam'], "</h2>";
echo $row['paginaContent'], "<br />";
if (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 2) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
echo " <a class='delete' href='functions/admin/deletePost.php?id=" . $pageNumber . " '>Delete</a>";
} elseif (isset($_SESSION['login']['5']) && $_SESSION['login']['5'] == 1) {
echo " <a class='edit' href='functions/admin/edit.php?id=" . $pageNumber . " '>Edit</a>";
} else {
}
echo "</div>";
echo "</div>";
echo "</section>";
echo max($row);
if ($n == $maxrow){
} else {
echo "<a href='/'><img src='<?php echo $path . $img ?>'alt=''/></a>";
}
echo "</section>";
}
}
echo "</div></div>";
?>

PHP Counting With Related Articles

my goal is to display related articles below a post (check if available, then loop through the ones that are there). It works fine if I have 3 or 6 setup but if I have only 5, it displays automatically the original post as the sixth related article.
echo "<div class='related-posts'>";
$related_articles = get_field('related_articles', false, false);
$id = $related_articles[0];
if($id) {
echo "<h5 class='related-posts_h'>Ähnliche Artikel, die du lesen musst</h5>";
echo "<ul class='related-posts_list clearfix'>";
for ($i=1; $i <= 6; $i++) {
$id = $related_articles[$i-1];
if ( has_post_thumbnail($id) ) {
echo "<li class='related-posts_item'>";
echo "<figure class='featured-thumbnail thumbnail large'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)." title='".get_the_title($id)."'>";
echo get_the_post_thumbnail( $id, 'medium-thumb' );
echo "<span class='zoom-icon'></span>";
echo "</a>";
echo "</figure>";
} else {
"<figure class='thumbnail featured-thumbnail'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)."' title='".get_the_title($id)."'>";
echo "<img src='".get_template_directory_uri()."/images/empty_thumb.gif' alt='".get_the_title($id)."' />";
echo "</a>";
echo "</figure>";
}
echo "<h6><a href='".get_permalink($id)."'>";
echo get_the_title($id);
echo "</a>";
echo "</h6>";
echo "</li>";
}
echo "</ul>";
echo "</div><!-- .related-posts -->";
Try this.. check after the for loop whether the related Post ID is not equals to the original post ID then only display the related Posts
that is
$id = $related_articles[$i-1];
if(get_the_ID() != $id){
//then do the stuff
}
I Hope you are in the details or single.php page so you will get the ID of original post by get_the_ID()
echo "<div class='related-posts'>";
$related_articles = get_field('related_articles', false, false);
$id = $related_articles[0];
if($id) {
echo "<h5 class='related-posts_h'>Ähnliche Artikel, die du lesen musst</h5>";
echo "<ul class='related-posts_list clearfix'>";
for ($i=1; $i <= 6; $i++) {
$id = $related_articles[$i-1];
if(get_the_ID() != $id){
if ( has_post_thumbnail($id) ) {
echo "<li class='related-posts_item'>";
echo "<figure class='featured-thumbnail thumbnail large'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)." title='".get_the_title($id)."'>";
echo get_the_post_thumbnail( $id, 'medium-thumb' );
echo "<span class='zoom-icon'></span>";
echo "</a>";
echo "</figure>";
} else {
"<figure class='thumbnail featured-thumbnail'>";
echo "<div class='hider-page'></div>";
echo "<a href='".get_permalink($id)."' title='".get_the_title($id)."'>";
echo "<img src='".get_template_directory_uri()."/images/empty_thumb.gif' alt='".get_the_title($id)."' />";
echo "</a>";
echo "</figure>";
}
echo "<h6><a href='".get_permalink($id)."'>";
echo get_the_title($id);
echo "</a>";
echo "</h6>";
echo "</li>";
}
}
echo "</ul>";
echo "</div><!-- .related-posts -->";

PHP select only one entry shows

how come when I use this code:
$emailc = 'thomas990428#me.com_classes';
$emaila = 'thomas990428#me.com_assignments';
$emailp = 'thomas990428#me.com_projects';
$resulty = mysqli_query($con,"SELECT * FROM `$emailc` ORDER BY period"); if (!$result) echo mysqli_error(); else // ok, do your thing.
$resulti = mysqli_query($con,"SELECT * FROM `$emaila` ORDER BY duehw"); if (!$result) echo mysqli_error(); else // ok, do your thing.
$resulto = mysqli_query($con,"SELECT * FROM `$emailp` ORDER BY dueproj"); if (!$result) echo mysqli_error(); else // ok, do your thing.
$classcount = 1;
while($row = mysqli_fetch_array($resulty))
{
$period = $row['period'];
$teacher = $row['teacher'];
$subject = $row['subject'];
$subjecto = strtolower($subject);
$subjecto = str_replace(' ', '', $subjecto);
$grade = $rowy['grade'];
echo "<section id='" . $subjecto . "'> \n";
echo "<p class='title'>" . $subject . "</p> \n";
echo "<a style='cursor:pointer;' onclick='homework" . $classcount . "()'>Homework </a>|<a style='cursor:pointer;' onclick='projects" . $classcount . "()'> Projects</a> \n";
echo "<div id='homework" . $classcount . "'><br /><a onclick='addassignment()'>Add Assignment</a><br />";
echo "<table class='homework'>";
echo "<tr>";
echo "<th class='title'>";
echo "Title";
echo "</th>";
echo "<th class='duedate'>";
echo "Due Date";
echo "</th>";
echo "</tr>";
while($row = mysqli_fetch_array($resulti))
{
$subjecthw = $row['subjecthw'];
$namehw = $row['namehw'];
$duehw = $row['duehw'];
echo "<tr>";
echo "<td class='title'>";
echo $namehw;
echo "</td>";
echo "<td class='duedate'>March ";
echo $duehw;
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div> \n";
echo "<div id='projects" . $classcount . "'><br /><a onclick='addassignment()'>Add Assignment</a><br />";
echo "<table class='homework'>";
echo "<tr>";
echo "<th class='title'>";
echo "Title";
echo "</th>";
echo "<th class='duedate'>";
echo "Due Date";
echo "</th>";
echo "</tr>";
while($row = mysqli_fetch_array($resulto))
{
$subjectproj = $row['subjectproj'];
$nameproj = $row['nameproj'];
$dueproj = $row['dueproj'];
echo "<tr>";
echo "<td class='title'>";
echo $nameproj;
echo "</td>";
echo "<td class='duedate'>March ";
echo $dueproj;
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div> \n";
echo "</section> \n";
$classcount += 1;
}
I only get the hw and proj in one section. Am I doing it wrong? Thanks! I know that it probably will never work, but how do I fix it? I have 3 tables and I need to get data from all of them.
Don't use $row within the while loop.
e.g
while($row = mysql_fetch_row($resulti)){
while($row2 = mysql_fetch_row($resulto)){
}
}
Also didn't have time to go through the code but it's never a good idea to run SQL in a loop.

Categories