Jump to content

Fearpig

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by Fearpig

  1. Thank you Barand! I've been looking at that for hours scratching my head, tested and all working.
  2. Hello, I need help updating multiple rows at once Table Columns: Model_ID, Image I want to update all rows where the image field is empty to have a value of: 'data/Products/' . $model . '.jpg' I can update one row at a time but I want to upload things in a batch! I've written a select page <html> <body> <?php //Conntect to Database include 'Database_Connection.php'; if ($db_found) { //print "<i>Database Found (" . $db_handle.")</i></br></br>"; $SQL = "SELECT * FROM `oc_product` WHERE image = ''"; $result = mysql_query($SQL); $x = 1; echo "<table class='Data'><thead><tr><th>Model</th><th>Image</th><th>Image Should Be...</th></tr></thead><tbody>"; while ($db_field = mysql_fetch_assoc($result)){ $model = $db_field['model']; $image = $db_field['image']; $image_should_be = 'data/Products/' . $model . '.jpg'; if ($x < 0){ $Table_Row = 'Row_Style1'; } else { $Table_Row = 'Row_Style2'; } print " <tr class='$Table_Row'> <td>$model</td> <td>$image</td> <td>$image_should_be</td> </tr>"; $x = $x * (-1); } echo "</table>"; } else { echo "Whoops!"; } echo "<a href=Update_Images.php>Update</a>"; ?> </body> </html> My database connection is fine as the user has the correct permissions but when I try to update the images I'm getting something wrong and the records are not updating or giving me an error message. My idea was to loop through the records using a select query and then update each record. <html> <body> <?php //Conntect to Database include 'Database_Connection.php'; if ($db_found) { //print "<i>Database Found (" . $db_handle.")</i></br></br>"; $SQL = "SELECT * FROM `oc_product` WHERE image = ''"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)){ $model = $db_field['model']; echo "$model<br>"; $image_should_be = 'data/Products/' . $model . '.jpg'; $SQL_UPDATE = "UPDATE `oc_product` SET image = '$image_should_be' WHERE model = $model"; $result_update = mysql_query($SQL_UPDATE); } } else { echo "Whoops!"; } echo "<a href=test.php>Test</a>"; ?> </body> </html> I added in the... echo "$model<br>"; ...just to see if the page was doing anything and I now get a list of model numbers but no updates in the table.
  3. You could set your adverts to link something like: www.yoursite.com/index.php?page=1234ABC&product=5678DEF then have your spalsh page grab the variables and pass it on as either a hidden field or insert the variable as part of the target URL for the Enter button. Here's roughly the code for using the variables in the URL..... <?php //---your splash page---- $page = $_GET['page']; $product = $_GET['product']; $page_url = $Page . '.php?product=' . $product ; echo "<form action='$page_url' method='POST'><input type='submit' name='Submit' value='Enter'></form>"; ?> there are probably a few typos but the enter button should then take you to the page: 1234ABC.php?product=5678DEF Let me know if that helps!
  4. Thanks rhodesa, I think I'll just set up a drop-down box where they can select who is filling out the form. Seems a cop-out though!
  5. Hi Guys, Can someone advise me on how to capture an Active Directory username? I have an intranet form and I want to capture who submits it without them having to log-on. The form doesn't need to be secure but if there is an issue I want to be able to easily track who submitted the form. I've had a look at... getenv('REMOTE_IDENT'); getenv('REMOTE_USER'); But they both seem to refer to already secured pages, unless I've got it back to front! I would appreciate any help as this has been bugging me for days and is possible the last step before this project can go live. ??? Thanks in advance for your help.
  6. If you know a friendly domain you might be able to route to their SMTP server for outgiong mail. (I'm assuming you are developing and testing a site on your laptop?)
  7. It all depends on the software you are editing with! Some software will insert a carridge return instead of a blank line, the problem with this is that NOTHING should be sent before the header even if it is junk! I'm fairly sure thats right but I'll wait a while and see if I get corrected. Hope that helps.
  8. Corbin had good advice... Use a Unix Timestamp to record you date/time and that should correct your problem.
  9. A simple fix would be to populate a different table with order history details, the histroy table would contain something like - History Line ID (autogen integer to define seperate lines as 1 order may have many products) Customer ID Order Number Product ID Purchase Date Item Description Price That way the contents of your product table would be irrelevant to the customer history. Is that any help?
  10. Just make sure the variable can be declared where you want, you can either do this by just wrapping the variable in php tags where-ever it is in the code or don't drop out of php after the select query. I prefer staying in php and echoing all the html otherwise you might end up going in and out of php all over the page... This might not be the best method but it works for me! <?php $sql="SELECT * FROM table WHERE field = 'filter'"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} while (odbc_fetch_row($rs)) { $Field1=odbc_result($rs,"field1"); $Field2=odbc_result($rs,"field2"); $Field3=odbc_result($rs,"field3"); echo " <form action='your_target' method='POST'> <select name='select_box' id='select_box'> <option value='$Field1'>$Field1</option> <option value='ol'>Ozone Layer</option> <option value='ae'>Alternative Energy</option> </select> ...and so on with the rest of your form... </form> "; } Its not in your code but I hope that helps.
  11. Fenway wrote this sticky which might help.... http://www.phpfreaks.com/forums/index.php/topic,126096.0.html
  12. ... 500 simultaneous users, all performing uploads! Not sure if mySQL would handle that very well as I run any larger sites on MSSQL and I just don't have any experience with high volume mySQL sites. - Sorry! :-\ Does anyone else know?
  13. Not quite sure what you mean by 500 each but I would think mySQL would handle 500 users. It all really depends on the complexity of your queries as this is a big factor in determining the speed of the response. (I find mySQL a LOT slower at running hugely complex queries but then I have an SQL server to play with and they aren't cheap if you are paying!)
  14. Just a minor point on the navigation... When you click onto Advice Center you would usually expect the sub-links to be directly below their parent link and slightly indented: e.g. Home > About Us > Jobs > Advice Center > - CV Tips > - CV Layout > - Interview Tips > - Medical Sales Tips > Contact Us > Its a good site and seems clean and easy to use.
  15. Hi guys, I've just about finished my first CSS based site... its fairly simple and was just something to build to try out CSS. Please take a look and let me know what you think the next round of improvements could be. Cheers! http://www.FireFlyz.co.uk/MotherShip
  16. It looks as though its coming on! In the gallery section the right-hand column of images are under the column to the right, just cutting off the edge of the images and borders. The forum should match the rest of the site. I'd loose the nark files, it looks petty and immature! (sorry just an opinion but I think it drags the rest of the site down). The overall design I like. Keep going!
  17. Thank you guys. I've been using PHP for site designs for a while now and was after a bit of paper that says that! Also my company is covering the costs so I might as well!! Incase anyone else is looking I also found this course but I think I'll have a look into this Zend course first: HoTT: http://www.traininghott.co.uk/Courses/PHP-Programming-Hands-On-Training-Course-PHP-Class-Seminar-PHP-Script-Language.htm?source=aduk&gclid=CIe5opiOrZICFSOTMAodOg9vqg Zend: http://www.zend.com/en/store/php-training/certification
  18. Hi Guys, Can anyone recommend a good PHP qualification for me to take? I've had a look at a few web sites but they all look a bit cheesy! Is there an industry recognised standard? Cheers Tom.
  19. Just a content suggestion... do you need the flash movie on every page? It takes up a lot of space.
  20. Thanks pocobueno1388, Any advice or constructive critisim?
  21. you could just move the navigation so that it starts under the site title ("Myths blah blah"), next to the site logo. That would instantly give you a bit more space without a great rework...
  22. Nice and clean... If I were you I'd change the image fades to javascript or animated gif which would allow you to loose flash and any of the associated security warnings.
  23. Thats a HUGE top banner to have, if its just for that one logo... on a low res screen your are going to loose half of every page to the banner.
  24. Hi guys, Thanks to various people on here and tutorials from all over, I am redoing our website and would love to know what you guys think... www.FireFlyz.co.uk Please let me know your thoughts on the colours, content, feel, useability and all the usual junk! Many thanks again to all the people who have put up with my stupid questions and who have been willing to step down several mental gears to teach me! Cheers Tom FireFlyz Performer / Tech.
  25. Please ignore me!! I think it was a case of me looking at it for so long I just couldn't see the error! "HAVING is applied AFTER the aggregation, WHERE is applied BEFORE the aggregation." Correct Solution: SELECT TOP (100) PERCENT Area, Pacode, SUM(CurrentMonth) AS Sum_CurrentMonth FROM dbo.qry_Travis_by_Area_Summary WHERE (Area = N'0010') OR (Area = N'0011') OR (Area = N'0019') GROUP BY Pacode
×
×
  • 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.