Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by techker

  1. techker

    if question

    its giving me Parse error: syntax error, unexpected T_STRING in /home/techker/public_html/PUNCH/index2.php on line 70
  2. techker

    if question

    nice thx!i have a hard time with the mixing of html and php..
  3. techker

    if question

    when there is no row(no results,nothing in there)
  4. techker

    if question

    ok small question for me to understand once and for all!lolsorry that querry is in the top of my page.now in my page were the echo is i put this <? while($row = mysql_fetch_array($result9)) {?> <? echo $row['Totalhours'] ." H"; ?> <? }?> now do i put that if there? <? while($row = mysql_fetch_array($result9)) {?> if (mysql_affected_rows == 0) { echo "Off"; } else { <? echo $row['Totalhours'] ." H"; ?> }
  5. techker

    if question

    well ok.. my querry: $query9 = "SELECT COUNT(*) AS TotalCount, `to_t1` - `from_t1` + `to_t2` - `from_t2`+ `to_t3` - `from_t3`+ `to_t4` - `from_t4`+ `to_t5` - `from_t5`+`to_t6` - `from_t6`+ `to_t7` - `from_t7` AS TotalNumber, SUM( `to_t1` - `from_t1` + `to_t2` - `from_t2`+ `to_t3` - `from_t3`+ `to_t4` - `from_t4`+ `to_t5` - `from_t5`+`to_t6` - `from_t6`+ `to_t7` - `from_t7`) AS Totalhours FROM `week1`GROUP BY `from_t1` "; $result9 = mysql_query($query9) or die(mysql_error()); when when my db is empty it shows nothing.now i want it so when it is empty it shows off
  6. techker

    if question

    hey guys i have a query that retreives hours from my database.now i want to put an if on the query that if empty returne off..
  7. so if $color = ($Totalhours > 40) ? 'red' : 'blue'; echo 'Total hours: <font color="', $color, '">', $Totalhours, '</font>';
  8. hey is there a way that if the total hours pass 40 it shows in red? i added up all the sums and it works a1! now in the query can i add something like an if Totalhours is over '40' show in red
  9. that did it.did it ask for a group since we added to fileds in one? now i just need to add all the filds up.thx
  10. that should be it but it gives me this? Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
  11. see i want to calculat how many hours i have done in a day.and a week. they bust my balls over over time..lol i dont understand the sum part?
  12. i tried this $query2 = "SELECT COUNT( `to_t1` )-( `from_t1`) AS Totalhours FROM `week1`; "; but it gives me -7h
  13. hey guys so i got this going but there sum is wrong?? $query2 = "SELECT COUNT( `to_t1` )-( `from_t1`)AS TotalNumber, SUM( `to_t1` )-( `from_t1`) AS Totalhours FROM `week1`; "; $result2 = mysql_query($query2) or die(mysql_error()); while($row = mysql_fetch_array($result2)) { echo $row['Totalhours'] ." H"; } 21H to_t1 is 17:30 and from_t1 is 9:30 how does it get 21?i need 8h
  14. problem.. every thing is working fine now..the only thing is that in my table time, i created field from_m1,from_m2..that represents from.. and 7 more to_m1,to_m2.. that represents the to in the days.. so i have this monday input filed(from_m1) to input filed(to_m1) now if i have more then one entry it screws up cause it show both. i need to assosiate monday to form_m1 and to_m1 and tuesday to form_m2 and to _m2...... i make one table week 1 and put the fields in that one. so the second time would go in week 2..... the only thing is for that to be associated ?(guess something like a drop down menu with week 1 week2 week 3 week 4 week 5..) the place that i would jam is how to determine if he selected week 1 to insert the data in that table..
  15. so SELECT sum( `time` ) AS TotalNumber, SUM( `time` ) AS Totalhours FROM `fc`;
  16. ya but what would be the php formula?cause lets say i make a database with monday input filed from to input field and it puts it in the database. to pull it out SELECT COUNT( `time` ) AS TotalNumber, SUM( `time` ) AS TotalPrice FROM `fc`;
  17. well i was more thinking of input forms.from time to what time and lunch for every day.
  18. hey guy im looking in to making a small web site that i can access from my blackberry to log my hours i do at work.. can somebody guide me in the write direction fro the calculations?
  19. i think im getting there.i forgot to close my div tag
  20. sorry the cell name i put this it works put the space between the pics is to mutch? div.thumb { float: vertical; width: 25%; border: thin silver solid; margin: 0.5em; padding: 0.5em; }
  21. featured is the table name..
  22. i got it going.but i need to space them out evenly.. see front page you see fetured cars i want 4 pics. in my admin panel when he adds a car i added a field feature or not. if it is he puts 1 to 5 SELECT * FROM employees WHERE featured ORDER BY RAND() LIMIT 1 , 4 http://canada-auto.com/site/view_test.php
  23. hey guy im making a car website for my buddy and i have a featured cars on the front page. now in my database i added a field featured im using this SELECT * FROM db WHERE featured ORDER BY RAND() on my page i added 4 boxes with code but i replicates it 4 times each featured car..all i one is 4 diffrent featured cars...
  24. aha!thx dude what i don't understant it was working yesthurday..lol anyways fixed and works!
  25. ok so i change it to mysql_query("INSERT INTO `employees`( name, email,phone,photo,thumb,numero,description,pics,pics2,kilometers,year) VALUES ('$name', '$email','$phone','$pic','$thumb','$num','$desc','$pics','$pics2','$kilo','$year')") ; mysql_query($query) or die('Error, add album failed : ' . mysql_error()); and get Error, add album failed : Query was empty
×
×
  • 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.