keloa Posted November 19, 2013 Share Posted November 19, 2013 Hi I'm working in a project and I just finished the pagination system (in every page 2 results) but my problem is that I want to add some options beside every result.For example I have to resut which are (john,katy)I want them to be like this : John (Edit) (Delete) Katy (Edit) (Delete) This is my code : <?php include("wasata/inc/config.php"); mysql_query('SET NAMES "UTF-8"'); if(!isset($_GET['page'])){ $page = 1; }else{ $page = (int) $_GET['page']; $records_at_page = 2; $q = mysql_query('SELECT * FROM serv'); $records_count = @mysql_num_rows($q); @mysql_free_result($q); $page_count = (int) ceil($records_count / $records_at_page); if(($page > $page_count) || ($page <= 0)){ mysql_close($con); die('No More Pages'); } $start = ($page - 1) * $records_at_page; $end = $records_at_page; if($records_at_page != 0){ $q = mysql_query("SELECT * FROM serv ORDER BY id ASC LIMIT $start,$end"); while($o = mysql_fetch_object($q)){ echo $o->title .'<br />'; } } echo '<br />'; for($i = 1; $i<= $page_count; $i++){ if($page == $i){ echo $page; }else{ echo '<a href="m.php?page=' .$i . '">' .$i . '</a>'; if($i != $page_count){ echo ' - '; } } } } mysql_close($con); ?> So can any one Help please. Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted November 20, 2013 Share Posted November 20, 2013 your question isn't specific enough. We can't answer accurately without more information of what exactly you would like to do and how you would like it to be done. What I will say though is: Stop suppressing your database interactions and stop using SELECT * Quote Link to comment Share on other sites More sharing options...
martov Posted November 20, 2013 Share Posted November 20, 2013 From your question i understand this: while($o = mysql_fetch_object($q)){ echo $o->title.'(edit)(delete)<br />'; } Quote Link to comment Share on other sites More sharing options...
keloa Posted November 20, 2013 Author Share Posted November 20, 2013 From your question i understand this: while($o = mysql_fetch_object($q)){ echo $o->title.'(edit)(delete)<br />'; } Will, I need this (edit)and (delete) to be buttons and when I click on edit I'm going to be able to edit some data from the database.and if I clicked on delete it will delete this row. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted November 20, 2013 Share Posted November 20, 2013 the point of programming help isn't to find or to write code for you. other than posting your current code and a statement of what you want, what have you tried? (hint: this is a common assignment and there are countless examples posted on the Internet that you could find and examine to see how others have done this.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.