Jump to content

Recommended Posts

As above,

 

i have a page that pulls down information from the database and graphs said information using the google graph code.

 

next i want to make a page with 2x date selectors, and the page shows information from database within that range.

 

problem is i dont know a great deal about PHP so im after some sample coding snippets i can use, or if somone can help me out with where to look.

 

not sure if i should use the from and to date in the URL and when running the sql query to fetch the data from the URL to perform the sql commands.

Mmmm, so I tried it up on my Linux server and not so good!~ What can this mean?

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php  on line 12

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 17

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php:12) in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 20

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php:12) in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 20

Mmmm, so I tried it up on my Linux server and not so good!~ What can this mean?

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php  on line 12

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 17

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php:12) in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 20

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php:12) in /home1/oninacom/public_html/concierge/scripts/authenticate/auth.php on line 20

 

confused... wrong post?

jacko_162, which part of this do you need help with?

 

It is not a php problem until the form has been submitted and the two date values have been received on the server.

 

Once the two values are on the server, the php form processing code would need to validate them, format them as yyyy-mm-dd values to match your column values in your database table, escape them to prevent sql injection, and put them into a WHERE clause in a query using the BETWEEN ... AND ... comparison.

 

If the problem is creating the form to input or select them, you must define what method you went to use to enter or pick them and also what format they will be entered as.

thank you for reply,

 

i have the form made and upon selecting the date range and clicking submit it enters the URL as follows:

 

test.php?graph_start=November+9%2C+2009&graph_end=May+9%2C+2010

 

i can then echo the variables just fine.

 

i enter the date format into the database across the site as: $todaydate = date("F j, Y"); which outputs May 9, 2010 when echo'd.

 

problem i need help with is the mysql query.

 

i need to select * from table "BETWEEN HE ABOVE VARIABLES IN URL"

 

i also need a helping hand with echoing the variable;

<?php echo $graph_start; ?> - WORKS FINE

 

but if i echo $graph_start and it returns nothing, i.e nothing in URL can i echo "NO DATE"

 

i fixed my echoing variable command;

 

<?php
$end = $_GET['graph_end'];
if ($end)
{
echo "$end";
}
else
{
echo "$todaydate";
} ?>

 

all i need now is help creating a SQL command to pull data between the 2x date variables.

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.