Jump to content

Fearpig

Members
  • Posts

    195
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.FireFlyz.co.uk

Profile Information

  • Gender
    Not Telling

Fearpig's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  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
×
×
  • 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.