Home Tutorialhelp Comment PHP help ....

 
 

Comment

pree
PHP help ....,
March 29, 2010 at 1:16 PM

The table in phpmyadmin database having fields as follows:

Loguser, date, time, action (kommen OR gehen), IP address.

Loguser Account Date Time Action IP address
User1 Employee 2010-02-26 11:40:36 Coming 127.0.0.1
User1 Employee 2010-02-26 12:50:26 Gehen 127.0.0.1
User1 Employee 2010-02-26 12:30:00 Coming 127.0.0.1
User2 Admin 2010-02-27 09:40:00 Coming 129.0.0.1

I am getting the output as:
For User1

Date Kommen Gehen
2010-02-26 11:40:36 12:50:26 12:30:00



I want output in the form of HTML table as below :

Date Kommen Gehen
2010-02-26 11:40:36 12:50:26
12:30:00


My code for above programme is as follows:

Array3.php

<?php

$host="localhost";
$username="my_user";
$password="password";
$db_name="ict";

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");




echo "<TABLE border='1'>";

echo "<TR>";
echo "<TH id='a1'>Date</TH>";
echo "<TH id='a2'>Kommen</TH>";
echo "<TH id='a3'>Gehen</TH>";
echo "</TR>";

echo "<TR>";
echo "<TH id='a5' axis='month'>March</TH>";
echo "<TH></TH>";
echo "<TH></TH>";
echo "</TR>";

echo "<TR>";

echo "<TD id='a4'>2010-03-01</TD>";


$query1 = "SELECT COUNT(*) AS count FROM entry WHERE loguser='user1' and date='2010-03-01'";
$results1 = mysql_query($query1) or die ("Error reading from database");
$existingusername1 = mysql_fetch_array($results1);

if ($existingusername1['count'] = 3)
{

$query = "SELECT * FROM entry WHERE loguser='user1' and date='2010-03-01' ORDER BY date,time";

$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result))
{

echo "<script language='javascript'>
result = document.getElementById('a4').innerHTML";
echo "</script>";


if($row['action'] == 'kommen' && $row['action'] == 'gehen')
{

echo "<TD headers='a5 a4 a2'>";
echo $row['time'];
echo "</TD>";

echo "<TD headers='a5 a4 a3'>";
echo $row['time'];
echo "</TD>";
}


else if($row['action'] == 'kommen')
{

echo "<TD headers='a5 a4 a2'>";
echo $row['time'];
echo "</TD>";

}

else if($row['action'] == 'gehen')
{
echo "<TD headers='a5 a4 a3'>";
echo $row['time'];
echo "</TD>";
}

else
{
echo "<TD headers='a5 a4 a2'>&nbsp;</TD>";
echo "<TD headers='a5 a4 a3'>&nbsp;</TD>";
}


}

}

echo "</script>";
echo "</TR>";


echo "<TR>";

echo "<TD>&nbsp;</TD>";



$query2 = "SELECT COUNT(*) AS count FROM entry WHERE loguser='user1' and date='2010-03-01'";
$results2 = mysql_query($query2) or die ("Error reading from database");
$existingusername2 = mysql_fetch_array($results2);

if ($existingusername2['count'] = 0)
{

$query3 = "SELECT * FROM entry WHERE loguser='user1' and date='2010-03-01' ORDER BY time";

$result3 = mysql_query($query3) or die(mysql_error());

while($row3 = mysql_fetch_array($result3))
{




if($row3['action'] == 'kommen')
{

echo "<TD headers='a5 a4 a2'>";
echo $row3['time'];
echo "</TD>";



}

else if($row3['action'] == 'gehen')
{
echo "<TD headers='a5 a4 a3'>";
echo $row3['time'];
echo "</TD>";
}

else
{
echo "<TD headers='a5 a4 a2'>&nbsp;</TD>";
echo "<TD headers='a5 a4 a3'>&nbsp;</TD>";
}
}
}



echo "</TR>";




echo "<TR>";

echo "<TD id='a6'>2010-03-02</TD>";

$query = "SELECT * FROM entry WHERE loguser='user1' and date='2010-03-02' ORDER BY date, time";

$result = mysql_query($query) or die(mysql_error());


while($row = mysql_fetch_array($result))
{

echo "<script language='javascript'>
result = document.getElementById('a6').innerHTML";
echo "</script>";



if($row['action'] == 'kommen')
{

echo "<TD headers='a5 a6 a2'>";
echo $row['time'];
echo "</TD>";

}

else if($row['action'] == 'gehen')
{
echo "<TD headers='a5 a6 a2'>";
echo $row['time'];
echo "</TD>";
}

else
{
echo "<TD headers='a5 a6 a2'>&nbsp;</TD>";
}


}

echo "</TR>";



echo "</TABLE>";


?>

Need an urgent help.



View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
PHP Questions

PHP
PHP  I want to create Calendar Event in PHP. Could u help me 

PHP Questions

php
php  how to set email remainder in php?can you help me pls 

Ajax Questions

php
php  How to catch a image and link click counters using Ajax php can any one help me 

PHP Questions

php
with error.Query was empty plz help me how to remove... can learn php mysql connectivity examples from the given link: PHP Mysql Connectivity 

PHP Questions

Ask PHP Questions
Ask PHP Questions       PHP Questions and Answers Ask PHP Questions and get answers from.... In your questions and answers section you can ask PHP questions and get 

PHP Questions

database and php
database and php   suppose i have five tabels and i must form them html then link them database and php then i want to make query between them these five tabels and data in each one pleaze help me Table of suppliers Source 

PHP Questions

Pagination in PHP code - PHP
Pagination in PHP code  3.Pagination in PHP codeIs it possible to get the paging in PHP without database call? How will I show the image instead of numbering? any code that can help 

PHP Questions

PHP MYSQL Interview Questions
PHP MYSQL Interview Questions  What kind of questions can be asked in an PHP, MYSQL interview? Can anyone post the PHP interviews questions with well explained answers?   PHP, MYSQL Interview Questions Please tell me 

PHP Questions

php escape hyphen - PHP
php escape hyphen  Just confuse if a regular expression also escape the hyphen.. can any one help me to better understand the regular expression in PHP 

PHP Questions

php
php   what is php   PHP Tutorials 

PHP Questions

PHP Get Average - PHP
PHP Get Average  I am writing a method to calculate the average rating of the posted answers? can anyone help me with the method to calculate rating in PHP. In my code, we are providing maximum four options to the user to rate 

PHP Questions

php
php  what is php 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one 

Programming Tutorials

PHP
was its tight integration with the Apache web server with the help of PHP Apache...PHP PHP stands for Hypertext Preprocessor; PHP is server-side scripting language for development of web applications. PHP powerful and robust programming 

PHP Questions

php
php using javasript  how to set timer in php using javasript 

PHP Questions

php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database 

PHP Questions

php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database 

Java Interview Questions

PHP - Java Interview Questions
. Wanted the coding in PHP.  Hello sir, I tried to using this code 

PHP Questions

PHP
PHP  How to work in drupal with PHP 

PHP Questions

php
php  show the constructor overloading in php 

PHP Questions

Strings in PHP
in PHP and different ways to print a string. Can someone help me in this regards?   Following tutorials will help you in details about strings in PHP... the links which will exemplify the concept of string in PHP. http 

PHP Questions

php
php  how to write a program in php to create pdf file 

PHP Questions

php
php  what is php   PHP is one of the most used open source server-side scripting language, which runs on almost all the platform. PHP... and Solaris. To know more about PHP, Visit Here 

PHP Questions

PHP
PHP   hii, Define PHP?   Hello, The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web 

PHP Questions

problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials 

PHP Questions

php programs
php programs  I need 15 programs on arithmetic operators with comments. Please help me 

PHP Questions

php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me 

Date Calendar

php date function - Date Calendar
php date function  Hi, I am new to PHP. I am trying to get...: 1960-12-02 (type is date ) In PHP : $dob= " 1960-12-02... the output of $dobYear will be "1970". Please help me. regards, sakthi   

PHP Questions

php
php  retrieve data from mysql in php   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select-where.shtml 

PHP Questions

php
php  plz tell me code for PHP SQL Insert,delete,update,view is used to insert the record from HTML page to Mysql database using in single PHP form 

PHP Questions

PHP
PHP  How to check whether a username exists on a website using php and cURL and not MySQL 

Development process Questions

PHP help needed - Development process
PHP help needed  This is my code that I am using for search engine, can any body answer how to cheange the code if I want limited and per page result display??? code Career Search result Yami says <?php 

PHP Questions

php
Write a simple PHP program that display the days of week as per the system date using switch case statement.  Write a simple PHP program that display the days of week as per the system date using switch case statement 

PHP Questions

PHP
PHP  I would love to do PHP project with the title of "Hospital Management System". I want to know how to make validation using jquery 

PHP Tutorial

PHP Examples
In this section of PHP examples, the new bees will learn the basic examples of most common used functions. These examples will help to the experts too.... In this PHP example section, we have tried to cover the whole range of PHP 

PHP Questions

setrawcookie() in PHP
setrawcookie() in PHP  Hi, How can i set cookie like setcookie() function in PHP to send to the browser. So, please help me or suggest any reference. Thanks 

PHP Questions

PHP form
PHP form  Hi Sir/Madam, I am developing an attendance form using php, which displays the name and ID of a Employees which are fetched from Db and I... form and update them to respective coloumn... Please any one help mo out please 

PHP Questions

PHP Dynamic CheckBox
PHP Dynamic CheckBox  Help with Dynamic Checkbox in PHP 

HTML Questions

php
shortcut method in php like in javscript seletedIndex 

PHP Tutorial

PHP Installing PHP LAMP - Linux Apache MySQL and PHP Tutorial
some questions and then install PHP on your machine. Once PHP...PHP Installing PHP LAMP - Linux Apache MySQL and PHP Tutorial In this tutorial we will learn how to install Linux, Apache, MySQL and PHP. This guide 

PHP Questions

PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt 

PHP Tutorial

PHP Functions, PHP Functions Tutorials
PHP Functions In this section we will understand important PHP functions with the help of example code. What is Functions? Function is a block of code...; } Functions in PHP PHP provides many built-in functions to do the real job 

PHP Questions

PHP Question
PHP Question  I am trying to make php Readline where it reads from line 2 and loops to the end. > if (isset($_POST['oldpass'])) { > >...; fclose($file1); That is what I got so far. Please help. Thank you 

PHP Questions

PHP Question
PHP Question  I am trying to make php Readline where it reads from line 2 and loops to the end. > if (isset($_POST['oldpass'])) { > >...; fclose($file1); That is what I got so far. Please help. Thank you 

HTML Questions

project on php
project on php   suppose i have five tabels and i must form them html then link them database and php then i want to make query between them these five tabels and data in each one pleaze help me Table of suppliers Source 

PHP Questions

php
php  im beginner to php. i faced problem with creating form and data stored into mysql <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> < 

PHP Questions

php
php  im beginner to php. i faced problem with creating form and data stored into mysql <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> < 

Development process Questions

Help needed for J2me and PHP - Development process
Help needed for J2me and PHP  Hello Sir I am a degree student. I have a small CRM application using J2me and PHP. I want to do cryptography using bouncy castle and decrypt the same in php with mcrypt extension. I did try 

Blog

Sitemap PHP Tutorial
Questions | Site Map | Business Software Services India PHP Tutorial Section PHP Index | PHP for beginners | PHP Date Functions | Starting PHP | PHP Cookies | File Manipulation in PHP | PHP displaying the time 

PHP Tutorial

PHP ini
PHP ini       PHP provides us so many facilities, php.ini file is one of them, with the help of it we can customize the behavior of php. Using this file maintaining PHP will be as easy 

PHP Questions

PHP
 

PHP Questions

PHP
 

PHP Questions

php
 

PHP Questions

PHP
 

PHP Questions

PHP
 

PHP Questions

php
 

PHP Questions

php login and logout code
php login and logout code  Hi, Can anyone share there code for creating a user login and logout page in PHP?or any useful tutorial that can help to create a login and logout application in PHP.. Thanks in Advance 

PHP Questions

Best PHP tutorial for beginners
will help you in learning PHP from beginning. These PHP tutorials are best...Best PHP tutorial for beginners  Hi Friends, I want to learn PHP... want to know: a) How to install PHP? b) How to create simple program and test? c 

PHP Questions

php date input calendar
php date input calendar  I'm having an issue while writing the date input calendar function in PHP.. any help? Thanks 

Ajax Questions

php - Ajax
php  hi i need ajax registration form validation coding   Hi friend, I am sending you a link. This link will help you. Visit for more information: http://www.roseindia.net/ajax/ajaxlogin/ajax-registration 

PHP Questions

PHP Open Excel File in browser - PHP
PHP Open Excel File in browser  How we can open an excel file using PHP code. I don?t want to let the user to download it rather I would like to get it open in the web browser. Any help would be great. Thank you very much 

PHP Questions

current date in php
current date in php  PHP script to get current date.   Hi, You can use the following code to print the current in PHP: <?php echo date('y m d'); ?> With the help of following code you can get the current date 

PHP Questions

PHP idate() Function
PHP idate() Function  Hi, Can anybody suggest me or provide online help related to PHP idate() Function. I waiting for your valuable suggestion. Thanks,   Hi, The idate() Function in PHP will returns a string 

PHP Questions

Create Directory in PHP
Create Directory in PHP  Hi, I want to create a small php program like how to create directory in PHP. I need the help of PHP programmer, who could.... Thanks,   Hi, For creating Directory in PHP is not so tough task. I 

PHP Questions

array_merge null - PHP
null error...any help?  Hi Friend, Please visit the following links: http://www.roseindia.net/tutorial/php/phpbasics/PHP-Array-Merge-Recursive.html http://www.roseindia.net/tutorial/php/phpbasics/PHP-Array-Merge.html 

PHP Questions

Line Breaks in PHP
Line Breaks in PHP  Hi, I am beginner in PHP language. How to do the line-break in PHP? Does somebody help me in this regard. Thanks 

PHP Questions

Array Sizeof Function PHP
Array Sizeof Function PHP  Hi, How to count the number of elements in an array using the PHP Array sizeof() function? Please provides me online help links or example of array sizedof() PHP. Thanks 

PHP Tutorial

PHP Introduction
The quick introduction to the PHP programming language PHP is server... for their website. The PHP stands for PHP: Hypertext Preprocessor. The php program is simple text file with the .php or .php5  extensions. You can use 

Swing AWT

Java/PHP Developer
Java/PHP Developer  please help me to bring cell values of jtable to a text file 

Swing AWT

Java/PHP Developer
Java/PHP Developer  help me with passing data from jframe to text file please 

PHP Questions

Mysql-Php code
Mysql-Php code  I want to mysql script for query data from two tables in the mysql database trough php code. Can you help me   Hi Friend, Please visit the following link: Php Mysql Thanks   Hi Friend 

General

Ask PHP Questions online
Ask PHP Questions online       Hypertext Preprocessor in short PHP is a popular... of problems, ask PHP Questions to us. We will solve all your queries regarding PHP. Our 

PHP Tutorial

PHP Beginners Guide, Free PHP Beginners Guide
This PHP Beginners Guide will help and educate all the programmers especially... to build any site using dynamic pages, prefers to PHP language and take the help of Roseindia’s PHP Beginners Guide. This PHP Beginners Guide not only help 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box 

PHP Tutorial

Setting up the database in PHP
some questions about how to use database information into PHP. Let's take... of PHP Script. 1. With the help of PHPMyAdmin : In PHPMyAdmin we can create...PHP DATABASE Setup Part-5(a) : Setting up the database In this chapter, we 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, can u help me to embedd time on java frame and it should be independent of operating system time..if we change system time it should'nt be changed.. Thank you sir 

WebSevices Questions

php coding - WebSevices
php coding  hello sir, I'm doing a project on web search optimization using php.I want to extract the results from the google search results.How can I do that using php.Please help me 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, how to create radio buttons on one pannel and should change when pressed ok... can u help me htrough this sooner... THANK U 

PHP Questions

rotate image in php - PHP
rotate image in php   Function to rotate image in PHP 

PHP Questions

PHP Property Management - PHP
PHP Property Management  PHP Property Management.. any idea 

Programming Questions

Questions and Answers Help
Questions and Answers Help      ... features of the questions posting form You can ask questions in and provide... program. Providing the details description of the problem help the other 

Programming Questions

Questions and Answers Help
Questions and Answers Help      ... features of the questions posting form You can ask questions in and provide... program. Providing the details description of the problem help the other 

Software Services

Outsourcing PHP Projects, Outsource PHP Projects
Outsourcing PHP Projects - Outsource your PHP development projects Outsource your PHP projects to our PHP development in India. We have dedicated team of PHP developers, designers and analysts to cater your PHP project 

PHP Tutorial

PHP WAMP Server Installation
Installation of the server: To run a PHP program we need a web server... of the server which is widely used with PHP, there are many more web servers... collectively has Apache web server, MySQL, and PHP and W stands for Windows. Generally 

PHP Questions

php means
php means  php means 

PHP Tutorial

PHP Basics Tutorial Index
PHP Basic Tutorial: Learn the Basics of PHP scripting through our PHP Basic Tutorial series. The PHP Basic Tutorial is design for new programmers who want to learn the PHP program ASAP. These tutorials will help you grasping the PHP 

PHP Questions

PHP and jQuery Tutorial
PHP and jQuery Tutorial  Hi, I have to develop web application using PHP programming language. In my program I have to add Ajax support with the help of jQuery. Let's know which Ajax framework is very good? Shall I learn 

WebSevices Questions

php script - for change the cusror - WebSevices
php script - for change the cusror  i want to change mouse cursor on my website. My web host server only support php scripting. So i want to this in php scripting. please help me how to change mouse cursor using php script 

Swing AWT

Java/PHP Developer
Java/PHP Developer  Hi, can u please help me with this, I have a text file with 3 sentences separated by delimiters and i want to get each sentence in different JFrames when press ok button on first frame it should close 

PHP Tutorial

The fgets function example in PHP, fgets php, fgets in php
Syntax of fgets() Function using PHP fgets ( file_handler [,length... for fgets() Function in PHP <?php $file1=fopen("c:/rose1/ram...;; ?> Output welcome to roseindia welcome to roseindia Code <?php 

PHP Tutorial

PHP Date Examples, PHP Date functions
The PHP Date function provides many options to the PHP programmer. It allows the developers to manipulate PHP Date in easy way. You will find many methods to help you quickly manipulate the Date in your PHP program. In this section of PHP 

PHP Tutorial

PHP Array
Array in PHP Almost every language supports array, which is a collection of similar data type, but in PHP language it could be or could not be the same. An array could be a collection of similar or dissimilar datatype.  PHP Array 

PHP Tutorial

PHP PHP Triad Tutorial
PHP-Triad Tutorial      ... on the PHPTriad server. PHPTriad is a software package which installs PHP.../projects/phptriad/. To download the latest version visit the office website of the PHP 

Programming Questions

Software Questions and Answers
any software development related questions ask it now. You can also help... questions. PHP - Ask your PHP Questions here. Flex... and Answer page. Ask the Questions and provide your help to solve the questions 

PHP Questions

$_get php example - PHP
$_get php example  Explain the $_get method in php with a simple example. m a beginner 

PHP Questions

php text encoding - PHP
php text encoding  How to encode the text editor text in PHP...how can it be done 

PHP Questions

php generate link - PHP
php generate link  How can i generate links in PHP for my photo gallery app 

PHP Questions

PHP MVC Framework - PHP
PHP MVC Framework   Which is the best & latest PHP MVC Framework... and where can i download it. Thanks 

PHP Questions

PHP duplicate file - PHP
PHP duplicate file   i wanted to duplicate a PHP file resides in different directory on submission 

Advertisements Advertisements
 

 

 

DMCA.com