Jump to content

expects parameter 1 to be resource


xanie

Recommended Posts

can you help me with this one guys?? tnx..

<?php
include("../../config/db.php");
								
							$tableName="leave";		
							$targetpage ="index.php"; 	
							$limit = 10; 
							
							$page = mysql_real_escape_string($_GET['page']);
							if($page){
								$start = ($page - 1) * $limit; 
							}else{
								$start = 0;	
								}		
						
									$query 	= "SELECT COUNT(*) as num FROM $tableName ";
									$query1 = "SELECT * FROM $tableName ORDER BY l_id ASC LIMIT $start, $limit";	
						
							
	
							$total_pages = mysql_fetch_array(mysql_query($query));
							$total_pages = $total_pages[num];
							
							$stages = 3;
						
							
							// Get page data
							
							$result = mysql_query($query1) or die(mysql_error());
							
							// Initial page num setup
							if ($page == 0){$page = 1;}
							$prev = $page - 1;	
							$next = $page + 1;							
							$lastpage = ceil($total_pages/$limit);		
							$LastPagem1 = $lastpage - 1;					
							
						
						?>
						
								<table frame='box' rules='rows' align='center' width='100%'   cellpadding="10px">
								<tr bgcolor="#E8E7DA" style="border-width:5px;border-style:ridge;">
										<th width='30px'></th>	
										<th>L_id</th>
										<th>Type of Leave</th>
										<th>Date of Leave</th>
										<th>Name</th>
										<th>Position</th>
										<th>Year Hired</th>
										<th>Kind of Leave</th>
										<th>Reason</th>
										<th>Date Approval</th>
										<th width='30px'></th>
									</tr>
									
										
									<?php 
						
								
										while($rows = mysql_fetch_array($result))
										{
											$id			=	$rows['l_id'];
											$type		=	$rows['type_leave'];
											$d_leave	=	$rows['date_leave'];
											$name		=	$rows['name'];
											
											$position	=	$rows['position'];
											$year		=	$rows['year_hired'];
											
											$kind		=	$rows['kind_leave'];
											
											$reason		=	$rows['reason'];
											$approval	=	$rows['date_approval'];
						
											echo "
														<tr>
															<td><a href='edit_form.php?l_id=".$id."' style='color:red;font-size:11px;' onclick='return edit()'> EDIT</a></td>
															<td> ".$id."</td>
															<td> ".$type."</td>
															<td> ".$d_leave."</td>
															<td> ".$name."</td>
															<td> ".$position."</td>
															<td> ".$year."</td>
															<td> ".$kind."</td>
															<td> ".$reason."</td>
															<td> ".$approval."</td>
															
													<td><a href='delete.php?l_id=".$id."' style='color:red;font-size:11px;' onclick='return del()'>DELETE  </a></td>
												</tr>
												";
										}
									
								
							
							?>
Edited by xanie
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.