473,667 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Script for Datepicker to slect and display database from Mysql required

1 New Member
After spending 3 days on internet and struggling with so many different forums , i have found a match and similar case of my problem here.

Friends, I am zero in PHP, but still i have managed to do something to fulfill my requirement.

I am stuck with one thing now..So i need help on....

I am using one html+php form to submit database into mysql.
I created a display of that table through php script on a webpage.
Now i want a datepicker option on that displayed page by which i should able to select the date range and display the data of that date range from my mysql table.
And then take a export of data displayed of selected date range in excel.

This displayed page is login protected, so i want after login the next thing comes in should show a sate selection option which should be fromdate to to date , and then records should displayed from the database and i can take export of those displayed results in excel file.
The code i am using on this page is below which do not have any thing included for excel export and datepicker script, I am pasting the code here and request you to please include the required code in it as required.

Thanks In advance

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     //database connections
  3.     $db_host = 'localhost';
  4.     $db_user = '***********';
  5.     $db_pwd = '*************';
  6.  
  7.     $database = 'qserves1_uksurvey';
  8.     $table = 'forms';  
  9.     $file = 'export';
  10.     if (!mysql_connect($db_host, $db_user, $db_pwd))
  11.         die("Can't connect to database");
  12.  
  13.     if (!mysql_select_db($database))
  14.         die("Can't select database");
  15.  
  16.     // sending query
  17.     $result = mysql_query("SELECT * FROM {$table} ORDER BY date desc");
  18.     if (!$result) {
  19.         die("Query to show fields from table failed");
  20.     }
  21.     $num_rows = mysql_num_rows($result);
  22.     $fields_num = mysql_num_fields($result);
  23.  
  24.     echo "$num_rows"; 
  25.     echo "<h1></h1>";
  26.     echo "<table border='1'><tr>";
  27.     // printing table headers
  28.     for($i=0; $i<$fields_num; $i++)
  29.     {
  30.         $field = mysql_fetch_field($result);
  31.         echo "<td>{$field->name}</td>";
  32.     }
  33.     echo "</tr>\n";
  34.     // printing table rows
  35.     while($row = mysql_fetch_row($result))
  36.     {
  37.         echo "<tr>";
  38.  
  39.         // $row is array... foreach( .. ) puts every element
  40.         // of $row to $cell variable
  41.         foreach($row as $cell)
  42.             echo "<td>$cell</td>";
  43.  
  44.         echo "</tr>\n";
  45.     }
  46.     mysql_free_result($result);
  47.     ?>
  48.     </body></html>
Apr 3 '11 #1
0 1348

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1752
by: * Tong * | last post by:
or I have to be in some mlist in order to post? thanks -- Tong (remove underscore(s) to reply) *niX Power Tools Project: http://xpt.sourceforge.net/ - All free contribution & collection
6
34136
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of the relevant infomation, in a binary format. SQL Enterprise manager offers no way to script out those diagrams, so I have created two Transact SQL components, one User Function and one User Procedure, which together provide a means to script...
1
1349
by: Richard Galli | last post by:
I have a shopping cart with an automatic installation script. Add a new database without tables, configure the script with the table's user/password, and it's supposed to set up all the tables in the database. Yet each time I call the setup program, I get this error: DataBase Error, mySQL Error Reason : Access denied for user: 'username@domain.com' (Using password: YES) at /home/webadmin//cgi-bin/.pm line 109
0
1236
by: Administrator | last post by:
Hello guys Just wanted to let you know that we added a new web gateway t *mailing.database.mysql* at TechieGroups.co From our web site you can read and reply to messages posted in thi group and you can also see old messages from 06-26-2003 to the presen day The url to the web gateway for this forum is
3
2989
by: SS | last post by:
Hi, I don't want to refresh a web page to query and display database. I want the page shows information immediately when database changes. What kind of technology or method would be able to perform this action? Sean
2
2302
by: Parasyke | last post by:
A new problem has me puzzled. I have what appears to be a very stable database but suddenly I can't find my Database Window. I tried the Startup option of Display Database Window and hit the toolbar button for Database Window, but nothing shows. When I hit that button on the toolbar, that button and several other momentarily go away but then come back as I hit another part of the screen..... Any clues? Thanks!
6
5880
by: Ted | last post by:
I am construvcting a number of databases, some of which contain sensitive data and most of which do not. I am attempting to handle the security issues involved in protecting sensitive data in part by putting it in its own database. If the sensitive data is in a database called d_SensitiveData, and in that database there is a table called 't_A' (I know, not very informative, but this is only a trivially simple example :-), and I have a...
1
2188
by: ariel gons | last post by:
This is one of my project and also my thesis in school. How can I get data on database MYSQL using javascript function? Is there anybody here can help me with this problem.. Can anyone give me a sample code for this.. Please help me with this.
1
1664
by: Niraj175 | last post by:
How we can insert a value in database using database MySql for datatype LongText?
7
9349
by: Surag | last post by:
Hello Guys, I have a datbase with userid,username and password. I Need to display database values in textboxes say for eg(Name and password) and redirect to login page based on the UserID please need a help Thanks Surag
0
8458
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8366
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.