This is the code, and as written in the title, I'm trying to have each column with the same width:
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>N°</th>
<th>Data</th>
<th>Compratore</th>
<th>Venditore</th>
<th>Merce</th>
<th>Quantita'</th>
<th>Prezzo</th>
<th>Pagamento</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
<?php
$result = query("SELECT numero_contratto, anno_contratto, data, C.denominazione as compratore, V.denominazione as venditore, merce, quantita, info_quantita, prezzo, info_prezzo, pagamento FROM Contratti, Societa V, Societa C WHERE compratore = C.id_societa and venditore = V.id_societa ORDER BY data DESC", $conn);
foreach($result as $r)
{
?>
<tr>
<td>
<?php echo $r['numero_contratto']."/".$r['anno_contratto']; ?>
</td>
<td>
<?php
$data = explode("-", $r['data']);
echo $data[2]."-".$data[1]."-".$data[0];
?>
</td>
<td>
<?php echo $r['compratore']; ?>
</td>
<td>
<?php echo $r['venditore']; ?>
</td>
<td>
<?php echo $r['merce']; ?>
</td>
<td>
<?php echo $r['quantita']." ".$r['info_quantita']; ?>
</td>
<td>
<?php echo $r['prezzo']." ".$r['info_prezzo']; ?>
</td>
<td>
<?php echo $r['pagamento']; ?>
</td>
<td>
<span class="glyphicon glyphicon-remove"></span>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
And this is the output on my web page:
But if you see this Fiddle with static values putted into the table, the problem doesn't show!
http://jsfiddle.net/brVa9/1/
So the problem is inside the db schema or structure.
What I should do to have all the columns with the same width?
Related
I'm trying to add nested foreach Loop and want to show all the sub cats related to the to cat under the table row of the top cat and don't know how can I do exactly as the requirement
if any one can help much appreciated I search a lot but don't get the answer Please Have a look at my code and quid how can I do that.
Here is my view.
<div class="conatiner">
<br/>
<br/>
<button class="accordion">Top Category Name </button>
<div class="panel">
<p>Sub Catorgies list under this top category</p>
</div>
<br/>
</div>
<div class="pag">
<table class="table gap">
<thead>
<tr>
<th>Flag No.</th>
<th>Name</th>
<th>On/Off</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if ($subcats): ?>
<?php foreach ($subcats as $key => $row): ?>
<tr >
<td><?php echo $row->flag_no?></td>
<td><?php echo $row->cat_name?></td>
<td>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
</td>
<td class="action-cats">
<a style="margin-right: 30px; " href="<?= site_url('Products/delete_cat/' .$row->id);?>"><img src="<?php echo base_url('assets/images1/bin.png');?>" width="20px"> Delete </a>
<img src="<?php echo base_url('assets/images1/edit.png');?>" width="20px"> Edit
</td>
<td>
+
</td>
</tr>
</tr>
<?php foreach ($subt as $row): ?>
<tr>
<?php if ($row->cat_id == $row->cat_id): ?>
<td id="demo<?php echo $row->id?>" class="collapse"> <?php echo $row->sub_cat?></td>
<td id="demo<?php echo $row->id?>" class="collapse"><img src="<?php echo base_url('assets/images1/bin.png');?>" width="20px">
<img src="<?php echo base_url('assets/images1/edit.png');?>" width="20px"></td>
<?php endif ?>
</tr>
<?php continue;?>
<?php endforeach ?>
<?php endforeach ?>
<?php endif;?>
</tbody>
</table>
</div>
</div>
Here is my conroller.
public function categories()
{
$data['subcats']=$this->Pro_model->fetch_categories();
$data['subt']=$this->Pro_model->fetch_sub_categories();
$data['cat']=$this->Pro_model->fetch_cat();
$this->load->view('admin-new/categories.php', $data);
}
Here is my model.
function fetch_categories(){
$this->db->select('*');
$this->db->from('subcat');
$this->db->join('categories', 'subcat.sub_id = categories.id ');
$this->db->group_by('subcat.sub_id');
$this->db->order_by('sflag_no', 'asc');
$query = $this->db->get();
return $query->result();
}
function fetch_sub_categories(){
$this->db->select('*');
$this->db->from('subcat');
$this->db->join('categories', 'subcat.cat_id = categories.id ');
$this->db->group_by('subcat.sub_id');
$this->db->order_by('sflag_no', 'asc');
$query = $this->db->get();
return $query->result();
}
You need to have table structured like this:
<table border="2" bordercolor="green">
<tr>
<td>main cat 1
<table border="2" bordercolor="blue" id="cat-id-1">
<tr class="subRow">
<td>subcat 1 for table 1</td>
</tr>
<tr class="subRow">
<td>subcat 2 for table 1</td>
</tr>
<tr class="subRow">
<td>subcat 3 for table 1</td>
</tr>
</table>
</td>
<td><a herf="#" class="toggle" data-cat-id="1">+</a></td>
</tr>
<tr>
<td>main cat 2
<table border="2" bordercolor="blue" id="cat-id-2">
<tr class="subRow">
<td>subcat 1 for table 2</td>
</tr>
<tr class="subRow">
<td>subcat 2 for table 1</td>
</tr>
</table>
</td>
<td><a herf="#" class="toggle" data-cat-id="2">+</a></td>
</tr>
</table>
And then you can toggle the nested table using the jQuery:
<script type="text/javascript">
$(document).ready(function() {
$('.toggle').on('click', function() {
// Get the id of the table that is going to toggle
catId = $(this).data('cat-id');
// Select the sub-table to toggle
table = $('#cat-id-'+catId);
table.toggle();
});
})
</script>
Note: You'll need to set nested table's id as cat-id-{ID OF MAIN CAT} and data-cat-id attribute of toggle button as {ID OF MAIN CAT}.
Here is the working fiddle: https://jsfiddle.net/5vp9a24r/2/
As for the data part, not sure about your db structure, but I think you should initially get main categories and join subs on them. Something like this:
function getCategories() {
$this->db->select('*');
$this->db->from('categories');
$this->db->join('subcat', 'subcat.cat_id = categories.id ');
$this->db->group_by('categories.id');
$query = $this->db->get();
return $query->result();
}
Using this method in your Model, you should get categories that also have respective sub categories with them.
Update:
example of embaded foreach.
<table>
<?php foreach ($categories as $categoryItem) : ?>
<tr>
<td>main cat 1
<table id="cat-id-<?= $categoryItem->id; ?>">
<?php foreach ($categoryItem->subCats as $subcatItem) : ?>
<tr class="subRow">
<td><?= $subcatItem->title ?></td>
</tr>
<?php endforeach; ?>
</table>
</td>
<td><a herf="#" class="toggle" data-cat-id="<?= $categoryItem->id ?>">+</a></td>
</tr>
<?php endforeach; ?>
I am not sure what is going wrong. But the system is printing the same values again and again, where it should echo the value only once where it is matching student_id in the delivery table. The full code I have edited as requested. This is not executing the query but able display the Table headings.
The code is :
<?php $min = $this->db->get_where('academic_settings' , array('type' =>'minium_mark'))->row()->description;?>
<?php $running_year = $this->db->get_where('settings' , array('type' => 'running_year'))->row()->description; ?>
<div class="content-w">
<div class="conty">
<?php include 'fancy.php';?>
<div class="header-spacer"></div>
<div class="content-i">
<div class="content-box">
<div class="row">
<div class="table-responsive">
<table width="100%" class="table table-striped table-lightfont">
<tbody>
<tr>
<td style="color:black !important; text-transform:uppercase; text-align:center;">
<?php echo get_phrase('Subject_Name');?> :
<span><?php echo $row['name'];?></span>
</td>
</tr>
<tr>
<td>
<table class="table table-padded">
<thead style="background-color:#90be2e; color:white;">
<tr style="padding-bottom:4px; padding-top:4px;">
<th style="color:white;"><?php echo get_phrase('Publish Date');?></th>
<th style="color:white;"><?php echo get_phrase('Assignment');?></th>
<th style="color:white;"><?php echo get_phrase('Faculty');?></th>
<th style="color:white;"><?php echo get_phrase('Last Date');?></th>
<th style="color:white;"><?php echo get_phrase('Submitted On');?></th>
<th style="color:white;"><?php echo get_phrase('Marks');?></th>
<th style="color:white;"><?php echo get_phrase('Feedback');?></th>
</tr>
</thead>
<tbody>
<?php
$uploader_id_student = $this->db->get_where('student', array('student_id' => $this->session->userdata('login_user_id')))->row()->student_id;
$invoices = $this->db->get_where('deliveries', array('student_id' => $uploader_id_student))->result_array();
foreach($invoices as $row2):
?>
<tr>
<td>
<?php echo $this->db->get_where('homework' , array('homework_code'=>$row2['homework_code']))->row()->upload_date;?>
</td>
<td>
<?php
$get_homework_data = $this->db->get_where('homework' , array('homework_code'=>$row2['homework_code']))->row();
echo wordwrap($get_homework_data->title,15,"<br>\n");
?>
</td>
<td>
<?php
echo $this->db->get_where('teacher' , array('teacher_id'=>$get_homework_data->uploader_id))->row()->first_name;
?>
<?php
echo $this->db->get_where('teacher' , array('teacher_id'=>$get_homework_data->uploader_id))->row()->last_name;
?>
</td>
<td>
<?php
$sampleDate1 = $this->db->get_where('homework' , array('homework_code'=>$row2['homework_code']))->row()->date_end;
$convertDate1 = date("d-m-Y", strtotime($sampleDate1));
echo $convertDate1;
?>
</td>
<td>
<?php
$sampleDate = $row2['date'];
$convertDate = date("d-m-Y", strtotime($sampleDate));
echo $convertDate;
?>
</td>
<td style="text-align:center;">
<?php echo $row2['mark'];?>
</td>
<td>
<?php echo wordwrap($row2['teacher_comment'],25,"<br>\n");?>
</td>
</tr>
<?php endforeach;?>
<!--<?php endforeach;?> -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
attached is screenshot of table Deliveries is there Deliveries Picture Download
Here is your code updated to fix the performance issues mentioned by Arnold Daniels.
<?php
$uploader_id_student = $this->session->userdata('login_user_id');
$invoices = $this->db->get_where('deliveries', array('student_id' => $uploader_id_student))->result_array();
foreach($invoices as $row2) {
$get_homework_data = $this->db->get_where('homework' , array('homework_code'=>$row2['homework_code']))->row();
$teacher = $this->db->get_where('teacher' , array('teacher_id'=>$get_homework_data->uploader_id))->row();
?>
<tr>
<td>
<?= $get_homework_data->upload_date ?>
</td>
<td>
<?= wordwrap($get_homework_data->title,25,"<br>\n") ?>
</td>
<td>
<?= $teacher->first_name . ' ' . $teacher->last_name ?>
</td>
</tr>
<?php
}
?>
It appears to be working fine as far as I could test it. Is there anything missing from the snippet you posted that could help reproduce your issue?
Edit:
So the complete code would be:
<?php
$min = $this->db->get_where('academic_settings' , array('type' =>'minium_mark'))->row()->description;
$running_year = $this->db->get_where('settings', array('type' => 'running_year'))->row()->description;
?>
<div class="content-w">
<div class="conty">
<?php include 'fancy.php'; ?>
<div class="header-spacer"></div>
<div class="content-i">
<div class="content-box">
<div class="row">
<div class="table-responsive">
<table width="100%" class="table table-striped table-lightfont">
<tbody>
<tr>
<td style="color:black !important; text-transform:uppercase; text-align:center;">
<?php echo get_phrase('Subject_Name'); ?> :
<span><?php echo $row['name']; ?></span>
</td>
</tr>
<tr>
<td>
<table class="table table-padded">
<thead style="background-color:#90be2e; color:white;">
<tr style="padding-bottom:4px; padding-top:4px;">
<th style="color:white;"><?php echo get_phrase('Publish Date'); ?></th>
<th style="color:white;"><?php echo get_phrase('Assignment'); ?></th>
<th style="color:white;"><?php echo get_phrase('Faculty'); ?></th>
<th style="color:white;"><?php echo get_phrase('Last Date'); ?></th>
<th style="color:white;"><?php echo get_phrase('Submitted On'); ?></th>
<th style="color:white;"><?php echo get_phrase('Marks'); ?></th>
<th style="color:white;"><?php echo get_phrase('Feedback'); ?></th>
</tr>
</thead>
<tbody>
<?php
$uploader_id_student = $this->db->get_where('student', array('student_id' => $this->session->userdata('login_user_id')))->row()->student_id;
$invoices = $this->db->get_where('deliveries', array('student_id' => $uploader_id_student))->result_array();
foreach ($invoices as $row2) :
$homework_data = $this->db->get_where('homework', array('homework_code' => $row2['homework_code']))->row();
$teacher = $this->db->get_where('teacher', array('teacher_id' => $get_homework_data->uploader_id))->row();
?>
<tr>
<td>
<?php echo $homework_data->title->upload_date; ?>
</td>
<td>
<?php
echo wordwrap($homework_data->title, 15, "<br>\n");
?>
</td>
<td>
<?php
echo $teacher->first_name;
?>
<?php
echo $teacher->last_name;
?>
</td>
<td>
<?php
$sampleDate1 = $homework_data->date_end;
$convertDate1 = date("d-m-Y", strtotime($sampleDate1));
echo $convertDate1;
?>
</td>
<td>
<?php
$sampleDate = $row2['date'];
$convertDate = date("d-m-Y", strtotime($sampleDate));
echo $convertDate;
?>
</td>
<td style="text-align:center;">
<?php echo $row2['mark']; ?>
</td>
<td>
<?php echo wordwrap($row2['teacher_comment'], 25, "<br>\n"); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
I would need to see the contents of the included file "fancy.php" to be sure. There was an extra endforeach statement, but I'm guessing that it came from somewhere beyond the scope of the snippet you updated. I would need to see the whole content of the file and the content of the included script in order to determine the true nature of the error.
<!--<?php endforeach;?> -->
Remove this Line
Need to display retrieved data from mysql table in table format, but not getting the right display i planned for. This is how i want it to look like
Target display
But this is what am getting based on my code
Current display
This is the html code
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Department</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$staff_set = find_all_employee();
while ($staff = mysqli_fetch_assoc($staff_set)) {
//display staff first name, last name, department and action (edit and delete links)
?>
<tr>
<td>
<?php
echo $staff["first_name"];
}
?>
</td>
<?php
$staff_set = find_all_employee();
while ($staff = mysqli_fetch_assoc($staff_set)) {
//display staff last name
?>
<td>
<?php
echo $staff["last_name"];
}
?>
</td>
<?php
$staff_set = find_all_employee();
while ($staff = mysqli_fetch_assoc($staff_set)) {
//display staff department
?>
<td>
<?php
echo $staff["department"];
}
?>
</td>
<td>
<span class="glyphicon glyphicon-pencil"> Edit</span>
 
<span class="glyphicon glyphicon-trash"> Delete</span>
</td>
</tr>
</tbody>
</table>
</div>
Here is the function that am using to find the list of all employee from the my staff table
function find_all_employee() {
global $connection;
$query = "select * from staff";
$staff_set = mysqli_query($connection, $query);
confirm_query($staff_set);
return $staff_set;
}
Is there a better way to write the loop and display my data in the right way? I have looked up similar threads but still not able to grasp.
I dont understand why you calling so much tie function and also why making so much loops. Let me try fi your code:
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Department</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$staff_set = find_all_employee();
while ($staff = mysqli_fetch_assoc($staff_set)) {
//display staff first name, last name, department and action (edit and delete links)
?>
<tr>
<td>
<?php echo $staff["first_name"]; ?>
</td>
<td>
<?php echo $staff["last_name"]; ?>
</td>
<td>
<?php echo $staff["department"]; ?>
</td>
<td>
<span class="glyphicon glyphicon-pencil"> Edit</span>
 
<span class="glyphicon glyphicon-trash"> Delete</span>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
Since OP asked for a varying technique in a comment:
<?php
// Select all staff first name, last name, and department info
$staff_set = find_all_employee();
$staff_results = array();
while ($staff = mysqli_fetch_assoc($staff_set)) {
$staff_results[] = $staff;
}
?>
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Department</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($staff_results)): ?>
<?php foreach($staff_results as $staff_member): ?>
<tr>
<td>
<?= $staff_member["first_name"]; ?>
</td>
<td>
<?= $staff_member["last_name"]; ?>
</td>
<td>
<?= $staff_member["department"]; ?>
</td>
<td>
<span class="glyphicon glyphicon-pencil"> Edit</span>
 
<span class="glyphicon glyphicon-trash"> Delete</span>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="4">No Staff Members Found.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
This also introduces the short tag syntax (<?=) for replacing calls to echo. Read this thread if your PHP version is < 5.4. This also introduces control structure alternate syntax, for better readability with HTML. The above approach separates the concern of selecting data from the DB from the presentation of the HTML. This allows for easier debugging, as well as future adaptation and modularization of your application.
I've been struggling these past days to export a table to PDF in PHP with mpdf, I finally solved most of the problems, however, I'm only able to create the pdf and store it in the server files automaticlly when opening the page, instead I would like to have the pdf only created after pressing a button. Here is my code:
<?php if ( have_posts() ) : while (have_posts() ) : the_post(); ?>
<h3><?php the_title() ?></h3>
<?php ob_start(); ?>
<div id="customers">
<table border='1'>
<thead>
<tr>
<td>
<h1 class="table2" >Periodo de Inversión</h1>
</td>
<td>
<h1 class="table2" >Saldo Inicial</h1>
</td>
<td>
<h1 class="table2" >Inversión en el Periodo</h1>
</td>
<td>
<h1 class="table2" >Interés Causado en el Periodo</h1>
</td>
<td>
<h1 class="table2" >Intereses Pagados</h1>
</td>
<td>
<h1 class="table2" >Intereses Reinvertidos</h1>
</td>
<td>
<h1 class="table2" >Saldo</h1>
</td>
</tr>
</thead>
<tbody>
<?php
if( have_rows('datos_especificos') ):
?>
<?php
while ( have_rows('datos_especificos') ) : the_row();
$icelpx = get_sub_field('interes_causado_en_el_periodo');
$cpx = get_sub_field('cantidad_pagada');
$crx = $icelpx-$cpx;
$sal1x = get_sub_field('saldo');
$ipx = get_sub_field('inversion_en_el_periodo');
$sal2x = $sal1x+$ipx+$crx;
$fech = get_sub_field('fecha');
$sal1 = get_sub_field('saldo');
$ielp = get_sub_field('inversion_en_el_periodo');
$icelp = get_sub_field('interes_causado_en_el_periodo');
$cp = get_sub_field('cantidad_pagada');
$cr = $icelp-$cp;
$crt = $crt+$cr;
$sal2 = $sal1+$ip+$cr;
$igalf = $igalf+$icelp;
$fech2 = $fech+100;
$ID= $the_query->ID;
?>
<tr>
<td>
<p class="table"> <?php the_sub_field('fecha') ?> </p>
</td>
<td>
<p class="table"> <?php the_sub_field('saldo') ?> </p>
</td>
<td>
<p class="table"> <?php the_sub_field('inversion_en_el_periodo') ?> </p>
</td>
<td>
<p class="table"> <?php the_sub_field('interes_causado_en_el_periodo'); ?> </p>
</td>
<td>
<p class="table"> <?php the_sub_field('cantidad_pagada'); ?> </p>
</td>
<td>
<p class="table"> <?php echo $crx; ?> </p>
</td>
<td>
<p class="table"> <?php echo $sal2x; ?> </p>
</td>
</tr>
<?php
endwhile;
else :
// no rows found
endif;
?>
</tbody>
</table>
</div>
<br>
<table>
<tr>
<td>
<p class="table"> Saldo Inicial <?php echo $fech; ?> </p>
</td>
<td>
<p class="table"> <?php echo $sal1; ?> </p>
</td>
</tr>
<td>
<p class="table"> Nuevas Inversiones </p>
</td>
<td>
<p class="table"> <?php echo $ielp; ?> </p>
</td>
<tr>
<td>
<p class="table"> Intereses Pagados </p>
</td>
<td>
<p class="table"> <?php echo $cp; ?> </p>
</td>
</tr>
<tr>
<td>
<p class="table"> Intereses Reinvertidos </p>
</td>
<td>
<p class="table"> <?php echo $crt; ?> </p>
</td>
</tr>
<tr>
<td>
<p class="table"> Total Intereses Generados a la fecha</p>
</td>
<td>
<p class="table"> <?php echo $igalf; ?> </p>
</td>
</tr>
<tr>
<td>
<p class="table"> Saldo Inicial <?php echo $fech2; ?> </p>
</td>
<td>
<p class="table"> <?php echo $sal2; ?> </p>
</td>
</tr>
</table>
<?php $tableVar = ob_get_contents();
$mpdf=new mPDF();
$stylesheet = file_get_contents(get_template_directory_uri() . 'style.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($tableVar,2);
$mpdf->Output('test8.pdf','F');
?>
Generate pdf //THIS BUTTON DOES NOTHING FOR NOW.
<hr>
<?php endwhile; else: ?>
<p>There are no posts or pages here</p>
<?php endif; ?>
To further explain my comment (and this isn't necessarily the best way to do this) you could change the link from this:
Generate pdf
To a form like this:
<form method="post"><input type="submit" value="Generate pdf"/></form>
And then wrap your PDF stuff in something like this:
if( 'POST' === $_SERVER['REQUEST_METHOD'] )
{
$mpdf=new mPDF();
$stylesheet = file_get_contents(get_template_directory_uri() . 'style.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($tableVar,2);
$mpdf->Output('test8.pdf','F');
}
There's some security things and edge cases you might want to consider but this is a good basic start
I get that error in php..And I have no idea why...
Here is how my connection is established:
<?php
$hostname_QASite = "localhost";
$database_QASite = "qasite";
$username_QASite = "root";
$password_QASite = "";
$QASite = mysql_pconnect($hostname_QASite, $username_QASite, $password_QASite) or trigger_error(mysql_error(),E_USER_ERROR);
?>
my query is the following:
mysql_select_db($database_QASite, $QASite) or die(mysql_error());
$query_get_all_topics = "SELECT topic_id, title FROM topic";
$get_all_topics = mysql_query($query_get_all_topics, $QASite) or die(mysql_error());
$row_get_all_topics = mysql_fetch_assoc($get_all_topics);
$totalRows_get_all_topics = mysql_num_rows($get_all_topics);
And then I iterate over the row_get_all_topics ...
What is wrong in the code ?
Edit:
I get that error, when I try to loop 2 times over different results in the database.
UPDATE:
<body>
<br/><br/><br/><br/><br/><br/><br/>
<div align="center">
<ul id="navlist">
<li> צור נושא</li>
<li> ראה קשרים</li>
</ul>
<?php do { ?>
<table border="1">
<tr>
<td>
<table width="100%" border="1" >
<tr>
<td width="90%" align="right">
<?php echo $row_get_all_topics['title']; ?>
</td>
<td width="10%">
:שם נושא
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
//$result=$mysql_query("SELECT title, sub_topic_id FROM sub_topic WHERE topic_id=".$row_get_all_topics['topic_id']) or die(mysql_error());
$result="";
if($row=mysql_fetch_array($result))
{
do
{
?>
<table >
<tr>
<td>
<?php echo $row['title']; ?>
</td>
<td>
:תת נושא
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td>
</td>
</tr>
<tr>
<td>
עדכן
</td>
<td>
מחק
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
**}while($row=mysql_fetch_assoc($result));** 1 FIRST LOOP
}//end suptopic search
?>
<?php **} while ($row_get_all_topics = mysql_fetch_assoc($get_all_topics)); ?>** 2ND LOOP
AS soon as I add this line, to query teh database inside the loop, the page shows the error..
$result=$mysql_query("SELECT title, sub_topic_id FROM sub_topic WHERE topic_id=".$row_get_all_topics['topic_id']) or die(mysql_error());