PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 12th, 2009, 08:46 AM
aarontb aarontb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 1 aarontb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 52 sec
Reputation Power: 0
General - Help!?!?

I am currently working on a project, I am a student but I think that I am well over my head. Here's what I need the program to do.
  • I will have multiple entries for multiple people.
  • There needs to have a daily limit constrained to $dmax and within 24 hours.
  • There should maintain a running count that will be constrained to $mmax and continue even after $dmax
It should look like this (copy and paste into html editor):
Code:
<table width="640" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="87"><div align="center">idnum</div></td>
    <td width="76"><div align="center">Date</div></td>
    <td width="78"><div align="center">Time</div></td>
    <td width="89"><div align="center">Name</div></td>
    <td width="65"><div align="center">qty </div>
    <div align="center"></div></td>
    <td width="68"><div align="center">mgs</div></td>
    <td width="79"><div align="center">Total</div></td>
    <td width="80"><div align="center">valid</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/11/09</div></td>
    <td><div align="center">18:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">1800</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654312</div></td>
    <td><div align="center">5/11/09</div></td>
    <td><div align="center">18:40</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">2</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">1200</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/11/09</div></td>
    <td><div align="center">18:50</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">3600</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/11/09</div></td>
    <td><div align="center">18:55</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">3000</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/11/09</div></td>
    <td><div align="center">19:00</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">3600</div></td>
    <td><div align="center">DENY:DMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">12:15</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">5400</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">12:20</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">4800</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">12:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">7200</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">13:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">7200</div></td>
    <td><div align="center">DENY:DMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">14:30</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">6600</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/12/09</div></td>
    <td><div align="center">18:30</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">6600</div></td>
    <td><div align="center">DENY:DMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/13/09</div></td>
    <td><div align="center">15:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">9000</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/13/09</div></td>
    <td><div align="center">16:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">2</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">9000</div></td>
    <td><div align="center">DENY:MMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/13/09</div></td>
    <td><div align="center">17:30</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">8400</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/13/09</div></td>
    <td><div align="center">18:30</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">2</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">8400</div></td>
    <td><div align="center">DENY:MMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/13/09</div></td>
    <td><div align="center">18:31</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">1</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">9000</div></td>
    <td><div align="center">Approved</div></td>
  </tr>
  <tr>
    <td><div align="center">987654321</div></td>
    <td><div align="center">5/14/09</div></td>
    <td><div align="center">18:30</div></td>
    <td><div align="center">John Doe </div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">9000</div></td>
    <td><div align="center">DENY:MMAX</div></td>
  </tr>
  <tr>
    <td><div align="center">123456789</div></td>
    <td><div align="center">5/14/09</div></td>
    <td><div align="center">18:30</div></td>
    <td><div align="center">Test</div></td>
    <td id="qty"><div align="center">3</div></td>
    <td id="mgs"><div align="center">600</div></td>
    <td><div align="center">9000</div></td>
    <td><div align="center">DENY:MMAX</div></td>
  </tr>
</table>

and here is the code that i've been beating my head against the wall to get to freakin' work!
PHP Code:
<?php
//CONNECTION AND DATABASE SELECTION
$con mysql_connect("localhost","root",""); 
if (!
$con) { die('Could not connect: ' mysql_error()); }
mysql_select_db("iDeny"$con); //END CONNECTION
//VARIABLES
        
$datedate('m/d/Y'); 
        
$timedate('h:i A');
        
$bizid=mysql_real_escape_string($_POST['bizid']);
        
$idnum=mysql_real_escape_string($_POST['idnum']);
        
$name=mysql_real_escape_string($_POST['name']);
        
$dob=mysql_real_escape_string($_POST['dob']);
        
$address=mysql_real_escape_string($_POST['address']);
        
$city=mysql_real_escape_string($_POST['city']);
        
$state=mysql_real_escape_string($_POST['state']);
        
$zip=mysql_real_escape_string($_POST['zip']);
        
$qty=mysql_real_escape_string($_POST['qty']);
        
$mgs=mysql_real_escape_string($_POST['mgs']);
        
$dmax 3600;
        
$mmax 9000;
        
$Total $qty $mgs;
//GET INFORMATION PREVIOUSLY ENTERED
mysql_query ("SELECT Total FROM sales WHERE idnum = $idnum");
    
$qty_new mysql_real_escape_string($_POST['qty']); // what ever makes this go up 
    
$mgs_new mysql_real_escape_string($_POST['mgs']); // what ever makes this go up  
    
$Total_new $qty_new $mgs_new;
    
$Total2 $Total Total_new;
//DAILY MAX CALCULATIONS
$date_day date("H");   ///date function to see if its a day or not
$date_month date("t");   ///amount of days in this month so far :)
if ($Total $dmax) {
    
$valid="Denied: Max";
    } else {
    
$valid="Approved"; }
if (
$Total2 >= $dmax && $date_day <= 23 && $Totals <= $mmax && $date_month <= 23) {  
    
$valid="Denied: Max";  
    } else {  
    
$valid="Approved"; }
//Insert into database
$sql="INSERT INTO sales (date, time, bizid, idnum, name, dob, address, city, state, zip, qty, mgs, Total, valid) VALUES ('$date','$time','$bizid','$idnum','$name','$dob',  '$address','$city','$state','$zip','$qty','$mgs','  $Total2','$valid')"/*form_data is the name of the MySQL table where the form data will be saved.  name and email are the respective table fields*/
$Total3 $Total2 $Total_new;
mysql_query("UPDATE sales SET Total = $Total3 WHERE idnum = $idnum") or die(mysql_error()); 
echo 
"<br><a href='http://localhost/iDeny/'>Return</a>";
if (!
mysql_query($sql,$con)) { die('Error: ' mysql_error()); }
echo 
"The form data was successfully added to your database." ;
mysql_close($con); ?>


Hope someone can help me hash out this frustrating code!

Thanks,
Aaron

Reply With Quote
  #2  
Old May 28th, 2009, 01:42 PM
baruchMenachem baruchMenachem is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 4 baruchMenachem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 50 sec
Reputation Power: 0
It would be helpful to know what the error you are getting is, and what line number the error is at. Are you getting a parse error, or an error in reporting back the information, or are you not getting a connection, or what?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > General - Help!?!?


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap