Jump to content

acp26b

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Contact Methods

  • ICQ
    1070232

Profile Information

  • Gender
    Not Telling

acp26b's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I ask because i don't know, what do serious users of PHP use? Text editor?
  2. [code]else { if ( $delete ) { $mode = 'delete'; } else if ( $move ) { $mode = 'move'; } else if ( $lock ) { $mode = 'lock'; } else if ( $unlock ) { $mode = 'unlock'; }[/code] you are missing the "}" to close the else
  3. Always got to one up everyone huh jesirose? :P
  4. run your form variables through this: [code]function format($text) { $text = preg_replace("/\W/", " ", $text); return $text; }[/code] it will take out special chars to prevent injection, but it will also take out the @ symbol so be careful if you are using email address to as username or allowing special chars in password, if so you will need to tweek the reg expression a little
  5. Nice, forgot about AS :) Thanks!
  6. $form_password = ($_POST['password']); $form_login = ($_POST['login']); $mysqlquery = "Select * from admin a where a.login = '$form_login' and a.password = '$form_password'"; $mysqlresult = mysql_query($mysqlquery);
  7. Here is my query: [code]$clientsquery = "Select COUNT(DISTINCT(c.clientid)) from clients c, accountbalances ab, accounts a, clientaccounts ca where ab.quarteryear = 'form_qy' and ab.accountid = a.accountid and a.accountid = ca.accountid and ca.clientid = c.clientid"; $clientsresult = mysql_query($clientsquery); if(!$clientsresult){ $error_details = mysql_error(); errorhandler($error_details); } [/code] but i can not seem to pull the number out of the result i have tried: $db_clientnumber = mysql_result($clientsresult,0,"clientid"); and $db_clientnumber = mysql_result($clientsresult,0,"COUNT(DISTINCT(c.clientid))"); and $db_clientnumber = mysql_result($clientsresult,0,"COUNT(DISTINCT(clientid))"); but i keep getting: Warning: mysql_result() [function.mysql-result]: COUNT(DISTINCT(clientid)) not found in MySQL result index 16 in C:\WEB_ROOT\clientpro\fta_summary.php on line 33 (of course the error, looks a little different for each one i tried, but i did not copy them all over, same error though) Any ideas?
  8. acp26b

    Page Break?

    Is there an html command that when the page is printed it will cause a page break? What i am trying to do is print statements that will be mailed to clients.  The statements are generated with php and are echoed out to a blank doc,  not every statement will be the exact same so it would be difficult to hard code the formatting, i would much rather just page break after each statement, so no matter how much white space there is the next statement will print on a new page from the printer
  9. got it! [code] $balancefeenumber = mysql_numrows($balancefeeresult); if(!$balancefeenumber){ $charge = 0; }else{ $db_percent = mysql_result($balancefeeresult,0,"percentcharge"); $db_amount = mysql_result($balancefeeresult,0,"amount"); $db_percent = ($db_percent * .01); $charge = ($db_percent * $db_amount); }[/code]
  10. Dang, any suggestions for this? [code] try {     $db_percent = mysql_result($balancefeeresult,0,"percentcharge");     $db_amount = mysql_result($balancefeeresult,0,"amount"); }catch (Exception $e) { $exception = "true"; } if($exception != "true"){ $db_percent = ($db_percent * .01); $charge = ($db_percent * $db_amount); }else{ $charge = NULL; }[/code] What i want to do, is if no amount comes out of db then set charge to null
  11. Does PHP version 4.4.4 have try catch blocks? Or are they not untill PHP 5?
  12. Thanks little guy, worked perfect! One more newbie question for today, where is the solved button?  I read the thread on top of board and it said to mark them solved when they are, but i think i am either dumb or blind cause i cant find it, neither can firefox (Ctrl +f)
  13. dang cause the real world use will be to find clients that are over 70.  Oh well i guess i can just display the birthday and not age... thanks again for all the help
  14. Thanks for all the fast replies! SemiApocalyptic, the funtion seems to top out at 37 all the clients that are over 37 return an age of 37, kind of weird and i can not figure out why. I am in the process of trying dgiberson's suggestion right now (working on tokenizing my date down to $year, $month, $day), when i tried the floor method explained by obsidian it retuned 0 for all ages, i think it has to to with a format issue.  Thanks again for the replies, this gives me some stuff to work with
  15. Hi,   I am sure this is pretty easy i just can not figure it out.  I have a from where i submit an age range and it pulls all the clients out of the database within that age range that is accomplished with this: [code]         $year = date(Y); $year1 = $year - $form_age1 ; $year2 = $year - $form_age2 ; $monthday = date("m-d"); $date1 = $year1 . "-" . $monthday; $date2 = $year2 . "-" . $monthday;         $searchquery = "SELECT c.clientid, c.lname, c.fname, c.dateofbirth FROM clients c WHERE  DATE(`DateOfBirth`) BETWEEN '$date2' and '$date1' and c.active = 'y' "; [/code] so then i have all the clients within a cretin age range and i have their birthday that i store in a variable called $db_dateofbirth, when i display the the list of results i want to display their age not their date of birth, how would i go about deriving the age? when i have todays date [ $today = date("yyyy-mm-dd") ] and their date of birth in the same format?
×
×
  • 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.