Jump to content

pacchiee

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pacchiee's Achievements

Member

Member (2/5)

0

Reputation

  1. Is there any PHP class/plugin available to set margin, page width, page height and other settings for a printer?
  2. Hello, I have a table with the following structure and entries: id|score1|score2|grade 1|90|100|A 2|75|89|B 3|60|74|C 4|40|59|D 5|0|39|E Now, given a score how can I fetch the grade? Example: Given score as 85, I should fetch 'B'. Or is that I need to change the structure of the table altogether? Am new to MySQL; please help. Thanks in Advance!
  3. Can you please add the number of days too? Something like this : 2 Years 4 Months 12 Days Thanks in Advance!
  4. Further, how to select data from this table by matching only date or month or year? For instance, lets assume $today = date('Y-m-d'); SELECT * FROM tableName WHERE product = 'foobar' AND MONTH(date) = MONTH($today) Is that correct?
  5. Oh! Okay, I will change it. It is in YYYY-MM-DD format.
  6. Hello, I have a table with three columns - id, product, date. id is unique + auto increment. Entries of many products go into the same table along with date. Now, I need to fetch the latest entry from this table for a given product based on date, which am not able to do. Please help. Thanks in Advance.
  7. Since everything else seems to be fine, assuming there is no password for the user root, try editing your Line 4 to mysql_connect ("localhost","root",""); If you have set a password for user root, it should be something like this mysql_connect ("localhost","root","password");
  8. Page1.php <?php session_start(); echo 'Session ID is '.session_id().'<br>'; echo '<a href="Page2.php">Go to Page 2</a>'; ?> Page2.php <?php session_start(); if (session_id()=''){ echo 'Session ID is empy??'; }else{ echo session_id(); } ?> That should solve the problem. Always session_start() should be at the top of anything else in a php file when using Sessions.
  9. Function to round the result to two decimal points: <?php function seventyFive($bag) { echo round($bag * .75,2); } ?> You can call the function like below: <?php seventyFive(2500.98); ?> Output will be 1875.74
  10. Can you please give an example how to use explode() and foreach() to get an ordered list as I mentioned above?
  11. Hello, I wanted to convert a string to an ordered list. Something like below: EX-1 $string = "a,b,c,d,e,f"; The above string should be listed as 1. a 2. b 3. c 4. d 5. e 6. f EX-2 $string = "a,b"; The above string should be listed as 1. a 2. b EX-3 $string = "a"; The output should be 1. a I thought of using list(), but the number of variables may differ in the string and don't know how to handle it. Please help. Thanks in Advance.
  12. Hello nbarone, Thanks so much for you help. I got it working with the above function. Cheers!
  13. Hello nbarone, Thanks. That function rounds an integer to the nearest specified SINGLE number. But I want to round an integer to its nearest 5 or 10 BOTH.
×
×
  • 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.