Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Is there a query to create an sql dump of the database as a backup. My web host dosnt have this feature. I need to back it up once a week automatically
  2. Is there a function to print a html page so it fits within printing diameters At the moment its only printing a third of the width the rest is trunicated
  3. Ok i rewrote the query to get the total of cost, but this is my first time using sum() and it doesnt seem to be working: $result = mysql_query("SELECT SUM(cost) AS total FROM table ") or die(mysql_error()); $row = mysql_fetch_array( $result ); $total = number_format($row['SUM(cost)']/100,2); echo $total;
  4. Your right, Thanks. I didnt think of doing it this way, this will get rid of half my code
  5. I need to recalculate a whole column based on another columns row change Database structure: id | cost | total 1 | 20 | 20 2 | 40 | 60 3 | 10 | 70 4 | 70 | 140 5 | 60 | 200 etc... Say i use a form to edit a value from cost like this (in bold) id | cost | total 1 | 20 | 20 2 | 40 | 60 3 | 20 | 70 <-----New value from 10 to 20 in cost 4 | 70 | 140 5 | 60 | 200 etc... How can i recalculate the rest of the total column so it ends up like this: id | cost | total 1 | 20 | 20 2 | 40 | 60 3 | 20 | 80 4 | 70 | 150 5 | 60 | 210
  6. I kow nuber format can seperate numbers by thousands but how can i get a decimal point? number_format(54634) becomes: 54,634 But i also need decimals as well Example number: 5463454 what im looking for is 54,634.54
  7. Thanks. Although this might get sticky if theres alot of html in the page. Ill use some templates to split the code
  8. I want to redirect the page after i post a form so i can post another <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Insert Receipt</title> </head> <body> <?php $insert = $_POST['insert']; if ($insert !=""){ //database stuff here //**FINSHED THE WHOLE PROCESS**// echo '<p align="center">All Done!!!!!!!!!<br>'; //redirect after update so i can insert another reciept cost header("Location: index.php"); }else{ echo "You havent inserted a value"; } ?> </body> </html> The header("Location: index.php"); is showing an error: Warning: Cannot modify header information - headers already sent by (output started at ABSOLUTE_PATH/index.php:19) in ABSOLUTE_PATH/index.php on line 122
  9. I dont know why this still isnt working: $result = mysql_query("SELECT * FROM example WHERE total IS NOT NULL ORDER BY id DESC LIMIT 1") or die(mysql_error()); Throw this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE total IS NOT NULL ORDER BY id DESC LIMIT 1' at line 1
  10. I finally finished this. Some of the code nearly blew my fragile little senior-script-kiddie mind. But i did it This is gonna save me 10 hours a week of adding up receipts by hand....Thats 520 hours a year or 43 extra awake days/ year
  11. I need to select the last row from a column with a value, so thought something like this: $result = mysql_query("SELECT * FROM example WHERE cost !='' ORDER BY id DESC LIMIT 1") or die(mysql_error()); But it doesnt work, Im guessing change to this but i need to make sure its right first before i try it $result = mysql_query("SELECT * FROM example WHERE cost NOT NULL ORDER BY id DESC LIMIT 1") or die(mysql_error());
  12. I cant figure out how to alter the table name Ive tried ALTER TABLE table_name IM lost.....
  13. Sweet. $sql = "SHOW TABLES FROM $dbname"; $result = mysql_query($sql); while ($row = mysql_fetch_row($result)) { echo "Table: {$row[0]}\n"; }
  14. Is it possible to select all table names from the database and echo them in a while loop like you can with rows
  15. Ok gonna ask something simple... Ive seen a few sites with subdomains of subdomains Example: http://sub.mainsub.site.com What is there significance? Are they used for organizing files within the subdomian or do they serve the same purpose as a normal subdomain - faster file loading for dominant domain Just curious......
  16. Ohh yes.....thats funny. Im not smart enough to get a hint, but this was obvious. Let me see: Means: "Go find it yourself" Yes. Very clever. Anyways the restaurant script is pathetic, its supposed to be advance menu creation script but, its very basic
  17. Thought i would ask around first
  18. You dont understand.....I can do it But it would take me 2 days to properly code it I want a script or program that is already built....im just too lazy to do it atm If someone here wants to do it for me ill pay them $30 by paypal
  19. I need a simple script/program for updating and selecting database info for petty cash receipts. Basically i put in receipt cost and it updates the database and tallys the totals up. Any suggestions????
  20. Im trying to trim a search query but its adding a space to each end of the query $search= $_REQUEST['search']; $search= trim($search); So a search with a whitspace "_" at the beginning _search here after the trim it would be __search here_
  21. Thanks. But its not relivent to the subdomain. Ill try absolute path
  22. I want to include my header and footer across all my subdomains. So my dominant domain will have the header and footer template stored there: http://www.site.com/templates/footer.tpl Now i need to include this file into my subdomain pages: http://sub.site.com/index.php So in index.php i want to include the footer.tpl page from my main domain Ive tried : include('http://www.site.com/templates/footer.tpl'); But it dosnt work
  23. Dont know if that will work, that will only take off the similar endings not the whole line Each line is different except for the ending : line 1 description| example ending line 2 has separate description but same ending | example ending line 3 is different to line 1 &2 also has a different ending | dont delete this line I just want to delete the whole line that contains "example ending"
×
×
  • 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.