Jump to content
Killersites Forums

cool

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by cool

  1. Another one: DATE_FORMAT(`secondgirld`,'%d-%m-%Y') AS secondgirld
  2. column Name: secondgirld Datatype:date To echo the date in "d-m-Y" format i am using the below code echo date("d-m-Y", strtotime($row['secondgirld'])); There is no problem when secondgirld is not equal to empty (secondgirld!='') when secondgirld field is empty (that is:secondgirld=='') it stores value as 0000-00-00 in mysql. But echo date("d-m-Y", strtotime($row['secondgirld'])); shows 01-01-1970. please help to fix this problem. I just want to display a blank field or 00-00-0000
  3. i have3 Table block table id,block (total 9 blocks based on cityname ex:london,mumbai....) users table id,username,password,block,access (this is registration form fields.Select your block from drop down menu) total 3 acess levels 0 for admin,1 for editor and 2 for regular user form table id,block,scheme,status. (Select your block from drop down menu) i have a working login registration system also successfully get the results from the Form table. But i need if a user is from london block then show only london block results of Form table and if from mumbai show only mumbai results of Form table. Please help friends my code <?php include '../include/functions.php'; if(!loggedin()) { header("Location: login.php"); exit (); } $per_page = 3; $pages_query = mysql_query("SELECT COUNT('id') FROM form"); $pages = ceil(mysql_result($pages_query, 0) / $per_page); $page = (isset ($_GET['page'])) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $per_page; $result = mysql_query("SELECT * FROM form"); echo "<table> <tr> <th>ID</th> <th>Block</th> <th>SCHEME NAME</th> <th>Status</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['block'] . "</td>"; echo "<td>" . $row['scheme'] . "</td>"; echo "<td>" . $row['status'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "Page: "; if($pages>=1 && $page<=$pages) { for($x=1; $x<=$pages; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> ' ; } } ?> i tried below code but it returns only one row <?php include '../include/functions.php'; if(!loggedin()) { header("Location: login.php"); exit (); } $user = $_SESSION['username']; if($user) { $queryget = mysql_query("SELECT block FROM users WHERE username='$user'") or die("Query is not working"); $row = mysql_fetch_assoc($queryget); $block = $row['block']; if($row) { $result = mysql_query("SELECT * FROM form WHERE block='$block'"); $row1 = mysql_fetch_array($result); echo "<table> <tr> <th>ID</th> <th>Block</th> <th>SCHEME NAME</th> <th>Status</th> </tr>"; echo "<tr>"; echo "<td>" . $row1['id'] . "</td>"; echo "<td>" . $row1['block'] . "</td>"; echo "<td>" . $row1['scheme'] . "</td>"; echo "<td>" . $row1['status'] . "</td>"; echo "</tr>"; echo "</table>"; } } ?>
  4. thanks ben. now my view link also working.
  5. great info.thanks for this. i have some other questions? how to view only one row data? Example:- Add a VIEW link after EDIT and DELETE. when click on view show only that id values. (with code) thanks
×
×
  • Create New...