Jump to content

ScrewLooseSalad

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by ScrewLooseSalad

  1. I have an array containing the users input of 14 strings, I want to search this array to find duplicates, but I'm not sure how to go about it efficiently... there isn't already a function that does this by any chance is there? Thanks
  2. I've written a basic bash script to test SSMTP, SSMTP works fine, but the script I wrote doesn't send the message correctly clear echo "sending mail" echo "who are you sending it to?" read $to echo echo "excellent, now what is the subject?" read $subject echo echo "marvelous, now write a quick message:" read $message echo To: $to > mail.txt echo From: emailbox >> mail.txt echo Subject: .$subject >> mail.txt echo $message >> mail.txt clear echo "ok, I will send this message for you..." ssmtp $to < mail.txt echo "message sent successfully!" thsi just creates the file without the variables in it for some reason can anyone spot where I've gone wrong? thanks
  3. Oh yeah, I forgot about that, I might well end up using $_SESSION; It doesn't matter, I'm only using functions to break down a large task I'm having difficulty getting my head around
  4. I wrote a long explaination, but then the page was refreshed an I lost it... essentially I can't get variables to work between functions, resorted to globals, I can get away with it, but I can't even get that to worl... code: <?php global $checkvar; //get the 'checkvar' this is an array of strings $checkvar = $_GET['checkvar']; checkvariable(); function checkvariable() { var_dump($checkvar); } ?> the dump of $checkvar comes up NULL in the function, but fine right after its been called.
  5. I need to increase the session length for my app, it keeps timing out on the people using it.. just changing the default in my php settings would be great but I haven't found anything that's worked for me on-line, is anyone able to help?
  6. UPDATE ----------- Now every variable on every page of the site is an undefined variable :S this is a serious problem for me, as this app is currently being used... SECOND UPDATE ----------------------- Started working again, it seems the loop must have had an effect on the server.... I had to reboot the system
  7. I've narrowed down my problem to this function... The page won't load, I suspected it was because it was stuck in a loop, but I couldn't see why, checking the error log confirmed this, as there were hundreds of errors for an undeclared variable.... I can't figure out why it is stuck in this loop, and I can't get the undeclared variable to go away, I even renamed it and it is still saying the old name of the variable is undeclared even though it isn't mentioned in the code anywhere I've renamed it.... Can anyone spot what is causing me grief? The only thing that would make sense would be if I wasn't updating the files when I uploaded them, but I am completely certain that I am... error log: code: while ($i<=14) { if($replacement_company_PartNo[$i] = NULL) { //this isn't an item from the database, simply print the description $replacement_Description //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A031-$i. This isn't an item from the database, skipping write to 'fullnotestock'; however, 'delnoteitems' could not be written to. Round $i."; exit;} } else { //this is an item from the database, the stock listings must be updated as the item is listed onto the delivery note //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A032-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} //update the stock listing in 'fullstocklist' $sql = "UPDATE `fullstocklist` SET `Stock`='$stockfromdatabase[$i]' WHERE `company_PartNo`='$replacement_company_PartNo[$i]';" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A033-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} } $i++; }
  8. I want to click the clients name, then have the address and phone numbers filled in, in the other inputs of the form
  9. I have a form with elements of the jquery autocomplete, it is possible to look up clients this way. however, I'd like other form elements below such as address or telephone number to be filled in automatically when a client is selected. Is this possible with jquery? I can't seem to find anything documenting it.. Thanks
  10. Chrome and Firefox, I'll be sure to remember to check the console in future!
  11. when I view the source in my browser I get something like this: //........................ <link rel='stylesheet' href='http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css' /> <script src='http://code.jquery.com/jquery-1.9.1.js'></script> <script src='http://code.jquery.com/ui/1.10.3/jquery-ui.js'></script> <link rel='stylesheet' href='/resources/demos/style.css' /> <script> /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableCust = [ 'contact1 - address1', 'contact2 - address2', 'contact3 - address3', //....etc ]; $( '#recipient' ).autocomplete({ source: availableCust }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableTags = [ 'code1 - part1', 'code2 - part2', 'code3 - part3' //....etc ]; $( '#tags1' ).autocomplete({ source: availableTags }); $( '#tags2' ).autocomplete({ source: availableTags }); $( '#tags3' ).autocomplete({ source: availableTags }); $( '#tags4' ).autocomplete({ source: availableTags }); $( '#tags5' ).autocomplete({ source: availableTags }); $( '#tags6' ).autocomplete({ source: availableTags }); $( '#tags7' ).autocomplete({ source: availableTags }); $( '#tags8' ).autocomplete({ source: availableTags }); $( '#tags9' ).autocomplete({ source: availableTags }); $( '#tags10' ).autocomplete({ source: availableTags }); $( '#tags11' ).autocomplete({ source: availableTags }); $( '#tags12' ).autocomplete({ source: availableTags }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// </script> <style> //.... </style> <div id='editableform'> <!-- panel one - top left - delivery information --> <div id='topleftpan'> <table class='letabl'> <tr> <td>Deliver To:</td> <td><input id='' size='40' id='recipient' value='recipient'/></td> </tr> <tr> <td rowspan='6' style='vertical-align:text-top;'>Address:</td> <td><input id='' size='40' /></td> </tr> <tr> <td><input id='' size='40' /></td> </tr> <tr> <td><input id='' size='40' /></td> </tr> <tr> <td><input id='' size='40' /></td> </tr> <tr> <td><input id='' size='40' /></td> </tr> <tr> <td><input id='' size='40' /></td> </tr> <tr> <td>Contact</td> <td><input id='' size='40' /></td> </tr> </table> </div> <!-- panel two - top right - address information --> <div id='toprightpan'> <table class='letabl2'> <tr bgcolor="#EDEDED" style='border: 2px solid Gray;'> <td>Deliver To:</td> <td><input id='' size='40'/></td> </tr> <tr style='height:32px;'> </tr> <tr bgcolor="#EDEDED" style='border: 2px solid Gray;'> <td>Date:</td> <td><input id='' size='40'/></td> </tr> <tr style='height:32px;'> </tr> <tr bgcolor="#EDEDED" style='border: 2px solid Gray;'> <td>Order No:</td> <td><input id='' size='40'/></td> </tr> <tr style='height:32px;'> </tr> <tr bgcolor="#EDEDED" style='border: 2px solid Gray;'> <td>Telephone:</td> <td><input id='' size='40'/></td> </tr> </table> <input type="submit" name="clear1" value="Clear" style="margin-top:10px; float:right;"> </div> <!-- panel three - bottom - package content information --> <div id='bottompan'> <table class='letabl'> <tr align=center> <td>Item no</td> <td colspan='2'>Item Description</td> <td>Quantity</td> </tr> <tr align=center> <td>1</td> <td><input name='itemIden1' size='55' id='tags1' /></td> <td><input name='itemDesc1' size='55'/></td> <td><input name='quantity1' size='6'/></td> </tr> <tr align=center> <td>2</td> <td><input name='itemIden2' size='55' id='tags2' /></td> <td><input name='itemDesc2' size='55'/></td> <td><input name='quantity2' size='6'/></td> </tr> <tr align=center> <td>3</td> <td><input name='itemIden3' size='55' id='tags3' /></td> <td><input name='itemDesc3' size='55'/></td> <td><input name='quantity3' size='6'/></td> </tr> //etc.................
  12. as far as I can tell the Java is exactly the same either way, and the php is working fine... I really don't get it
  13. There are no single quotes or anything that should break out the syntax, these are all mysql databases used in other apps I've written that all work fine over there. What do you mean 'post the output of your form'? What do you want me to post?
  14. I'm trying to get to grips with javascript, while conjuring up a form with suggestions built in; the form has two parts that autofill, the second part (var availableTags) of the script works fine, but the first part (var availableCust) doesn't, can anyone point out where I may have gone wrong? Thanks code: <script> /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableCust = [ <?php $sql = "SELECT * FROM `companyuser`.`customerDetails` ORDER BY `customerDetails`.`Account_Name` ASC "; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $value2 = $row['Address1']; $value1 = $row['Account_Name']; echo "'$value1 - $value2',\n"; } echo "'other'\n"; ?> ]; $( '#recipient' ).autocomplete({ source: availableCust }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// $(function() { var availableTags = [ <?php $sql = "SELECT * FROM `fullstocklist`"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $value4 = $row['Part_Name']; $value3 = $row['company_PartNo']; echo "'$value3 - $value4',\n"; } echo "'other'\n"; ?> ]; $( '#tags1' ).autocomplete({ source: availableTags }); $( '#tags2' ).autocomplete({ source: availableTags }); $( '#tags3' ).autocomplete({ source: availableTags }); $( '#tags4' ).autocomplete({ source: availableTags }); $( '#tags5' ).autocomplete({ source: availableTags }); $( '#tags6' ).autocomplete({ source: availableTags }); $( '#tags7' ).autocomplete({ source: availableTags }); $( '#tags8' ).autocomplete({ source: availableTags }); $( '#tags9' ).autocomplete({ source: availableTags }); $( '#tags10' ).autocomplete({ source: availableTags }); $( '#tags11' ).autocomplete({ source: availableTags }); $( '#tags12' ).autocomplete({ source: availableTags }); }); /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// </script>
  15. Having just barely got to grips with PHP, I have made a PHP app that can be used to fill out out forms, at the moment it is a step by step process, loading a different function from a PHP file full of functions, loaded one at a time; when filling in an address, it is possible to load an address previously used, this is simply done by reloading the same PHP function with a MySQL lookup, it works great as is, but to make the app work more dynamically, I'd need to allow the user to fill in the whole form in one go. However, to write the whole form in one go I'd need to load this address into a possibly half completed form... As far as I can tell this isn't something suited to PHP, I believe JavaScript is the way to go; however I have never worked with JavaScript before, I was hoping someone could point me toward some tutorials and some relevant sample code for me to read through. Thanks!
  16. Wonderful, That almost seems a bit too straightforward!
  17. I'm fairly certain that I've installed mysqli, I know I have installed it, as the warning flag that said it wasn't installed in phpMyAdmin dropped at the time I installed it; I've been using the mysql_ functions, do I understand correctly that mysqli functions have different names, and I will have to go back and change all my functions?
  18. I have a MySQL database of addresses that has worked well up to now, however adding an Irish address with a.... ' .... symbol in it has thrown it off completely, I can see why this would happen, but is there a simple solution to avoid this problem in future? I was thinking this must be a common enough problem for there to be a function to fix inputs or something, I noticed phpMyAdmin doubles up the symbol and the entry is entered correctly...
  19. I've written a basic php application with a login feature, using $_SESSION, but it times out after 20 minutes, how can I change the length of a session? Either in php on the page or in the php files whichever is simpler.
×
×
  • 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.