The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > PHP


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 11-30-2007, 07:27 AM
mikejkellyuk mikejkellyuk is offline
Novice
Join Date: Nov 2007
Posts: 8
iTrader: (0)
mikejkellyuk is on a distinguished road
[SOLVED] hlep with mysql between function

can anybody body tell me why this code is not working it is ment to seach between two date and bring back all the data between though dates

PHP Code:
<?php
$link 
mysql_connect("localhost","username","password");
if (!
$link)  {  die('Could not connect: ' mysql_error());
  }
mysql_select_db("mikejkel_addressbook"$link);
$result mysql_query("SELECT date, firstname, mon, tue, wed, thu, fri, workaweek FROM hoursworked WHERE date BETWEEN '2007/11/04' AND '2007/11/30'");
echo 
"<table border='1'>
<tr>
<th>date</th>
<th>firstname</th>
<th>mon</th>
<th>tue</th>
<th>wed</th>
<th>thu</th>
<th>fri</th>
<th>hours worked that week</th>
</tr>"
;
while(
$row = @mysql_fetch_array($result));  
{  
echo 
"<tr>";
echo 
"<td>" $row['date'] . "</td>";
echo 
"<td>" $row['firstname'] . "</td>";
echo 
"<td>" $row['mon'] . "</td>";
echo 
"<td>" $row['tue'] . "</td>";
echo 
"<td>" $row['wed'] . "</td>";
echo 
"<td>" $row['thu'] . "</td>";  
echo 
"<td>" $row['fri'] . "</td>";  
echo 
"<td>" $row['workaweek'] . "</td>";   
echo 
"</tr>";
  }echo 
"</table>";
 
 
mysql_close($link);
?>
any help would be good
thanks
mike

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 11-30-2007, 12:46 PM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
What error is it throwing?
The Following 2 Users Say Thank You to ccoonen For This Useful Post:
mikejkellyuk (11-30-2007), TeraTask (11-30-2007)
  #3 (permalink)  
Old 11-30-2007, 12:49 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Staff*
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 417
iTrader: (0)
TeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enoughTeraTask will become famous soon enough
First, thanks for using code tags. I wish more people did. Second, there is no such statement as "not working" when it comes to programs failing to meet expectations. What is the error? What's happening? Provide details. Third, dates in sql are not of the form yyyy/mm/dd, but yyyy-mm-dd.

With more information on what your definition of "not working" is in this particular case I may be able to provide further assistance.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
The Following User Says Thank You to TeraTask For This Useful Post:
mikejkellyuk (11-30-2007)
  #4 (permalink)  
Old 11-30-2007, 01:38 PM
mikejkellyuk mikejkellyuk is offline
Novice
Join Date: Nov 2007
Posts: 8
iTrader: (0)
mikejkellyuk is on a distinguished road
i have got the code working the problem was it was showing the table but no data i fix that there was an error on this line of code
while(
$row = @mysql_fetch_array($result));
it should have read

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

thanks for the help it is much appreciated
mike


__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 10:55 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50