Jump to content

solarisuser

Members
  • Posts

    122
  • Joined

  • Last visited

    Never

Everything posted by solarisuser

  1. Maybe you need to escape the " around the filename, as you have four double quotes per line?
  2. Hello All, I have incorporate a little javascript to show a confirm dialog box.  The problem I have is when the user clicks on the Cancel button (instead of the OK button), the page seems to do the URL transfer, but it still processes the rest of the PHP page.  I'd like to abort the page if the user clicks on cancel. I put in an "exit(0);" like I would do in PHP, but it still processes the rest of the code. One way I can think of getting around this is to set a variable like $abort to '1' after window.location(), but how do I get PHP to read the JS variable? Thanks Here is my code: [code] $sol = "testname"; if(isset($sol) && ($sol != '')) { echo " <SCRIPT type=\"text/javascript\"> <!-- hostname = '$hostname'; var answer = confirm (\"Your hostname is \"+hostname+\".  Is this correct?\") if(!answer) { window.location = (\"index.php\"); exit(0); } //--> </script> "; } [/code]
  3. [quote author=thorpe link=topic=119688.msg490427#msg490427 date=1166836413] A bit OT but, any reason your not using php's [url=http://php.net/ssh]ssh[/url] extension? [/quote] I tried using php_ssh2.dll from the latest version of PHP (I can't upgrade PHP) but the version mismatch prevented it from loading.
  4. Hi All, After a bit of searching, I'm at a loss. If I run system('dir ssh.exe', $retval); I get the output of dir showing me the ssh.exe file, the size, date, etc along with a retval of 0. If I run system('ssh.exe -v', $retval); (an example just to see if ssh is going to work before putting in my long syntax), I get no response back and the retval is 1. I have error_reporting(E_ALL); set on top, but nothing shows up in the error logs. Huh This is PHP 5.1.4 on a Windows 2K3 box.
  5. just a guess, but <b>set</b> is a built-in MySQL function, so if you use ' then you are telingl MySQL not to use it as a function [quote author=jdubwelch link=topic=118042.msg482022#msg482022 date=1165738047] I have to use the ` around sets like this: `set` otherwise i get an error that says: [quote]#1064 - 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 'set , plays . play_name  FROM plays  LEFT JOIN sets ON plays . set_id = sets . s' at line 1 [/quote]  Why is that? [/quote]
  6. thanks for the suggestion, but it didn't seem to work. If I use the MySQL Query Browser, and edit the field, it actually shows the "pilcrow" expressed as a paragraph and if I just backspace to get rid of the newline it makes, and save the field, the pilcrow go away. I can't use any PHP magic because I need to stop duplicate entries from going to PHP.  Here's the issue: One field has "Data", and another field has "Data¶". When I do a "SELECT DISTINCT * from data", it shows both of those in a <select> dropdown, effectly showing two of the same names. (The select dropdown seems to ignore the pilcrow). Any help is very much appriciated as I can't find any info on google about it! Thanks [quote author=artacus link=topic=117678.msg481212#msg481212 date=1165597972] A pilcrow huh? I learned something new today. See if this works: UPDATE mytable SET myfield = REPLACE(myfield,'¶','') If it doesn't you'll have to do it in PHP using str_replace(chr(182),'',$row['myfield']); you can use ord() and chr() to get to wierd non-printable characters. [/quote]
  7. bump because i edited initial question quite a bit
  8. [quote author=artacus link=topic=117678.msg480295#msg480295 date=1165466989] I'm not sure but it sounds like you've got the wrong character set. Try SELECT CONVERT(field USING latin1) FROM table and see what that does. [/quote] It doesn't work -- it might be because I'm using an old version of mysql.. 4.0.X.... Any other suggestions? =(
  9. Hello All, I have a field that has a few thousand lines of data with a ¶ after the data (like "John¶").  It happened after I imported a lot of data.  I tried using "select rtrim(field) from table" but it doesn't seem to remove it. Does anyone know what MySQL statement will remove it? Thanks!!
  10. Thanks I can see a few problems with this so I think I'll not do this. I have "Sun" listed, but not "Sun Microsystems". [quote author=bholbrook link=topic=108075.msg434482#msg434482 date=1158271780] I have successfully inplemented something quite like this. You need to compare values of the same length if DELL is in and you are entered DELL INC, you only want to try to match the first 4 letters and see if they're the same. you can also use the similar_text function whic takes two values and gives you the percent that is the same, and throw new entries at a sertain threshold. While DELL and DELL INC are the same, DELL INC and DELL FINANCIAL are not, so throwing the last part will not help. [/quote]
  11. O.K Thanks.  I might just split things by a space, then compare each piece.  [quote author=effigy link=topic=108075.msg434433#msg434433 date=1158266064] This is challenging in a few ways. If  "Dell Inc" was already in the database, it's easy to match "Dell" in "Dell Inc." The reverse is not--it will never match. The next approach would be to split the string by whitespace and look for each piece, but how do you know which parts are valid to the company name? We know "Inc" can be dropped from "Dell Inc", but what about longer company names such as "Johnson and Johnson"? My only thought at the moment is to make a list of known prefixes and their variations--e.g., Corporation, Corp., Inc., Incorporated, etc.--and strip these from the end of the string before running the match. [/quote]
  12. I need to compare a db's results before I add a new entry, and prevent something similar from being added. For example, I already have "Dell" in the database, and someone wants to enter "Dell Inc".  I tried using MySQL's LIKE and REGEXP functions but it was not helpful. My goal is to compare "Dell Inc" to "Dell" and if there is a similarity. Thanks
  13. Hello, I am writing code for CPU Speed detection, and then inserts it into a MySQL DB.  I have finished this part. What I need help with: I need to look at my speed variable, which will be something like 500, 800, or 3000. For example, if the CPUspeed variable is set to 1700, I want it to be modified to 1800.  If its 1800, then leave it alone (or modify to 1800).  If its 1690, I want it to be 1600. If its 3000, I want it to be 3000.  If its 3110, I want it to be 3200. I will do the Mhz and Ghz distinction later. Thanks!
  14. Hello, I am writing code for CPU Speed detection, and then inserts it into a MySQL DB.  I have finished this part. What I need help with: I need to look at my speed variable, which will be something like 500, 800, or 3000. For example, if the CPUspeed variable is set to 1700, I want it to be modified to 1800.  If its 1800, then leave it alone (or modify to 1800).  If its 1690, I want it to be 1600. If its 3000, I want it to be 3000.  If its 3110, I want it to be 3200. I just need it for the number, I do the Mhz and Ghz distinction later. Thanks!
  15. Hello All! I have a comma delimited file and I want to remove the start of the line until it hits the first comma. For example: 23-28331,Blah,Blah Blah, Blah 27-442-9,Blah2, Blahhhh, Blah Blah Blah I would like to end up with: Blah, Blah Blah, Blah Blah2, Blahhhh, Blah Blah Blah Should I look into preg_replace, split, or something else? Any ideas or code would be greatly appriciated!
  16. Hello All, I am trying to echo a field that has "\\192.168.1.1\blah\blah" in an <A HREF> tag. So for example: [code] $path = "\\192.168.1.1\blah\blah"; echo "Path is <A HREF=\"$path\">Go Here</A>"; [/code] The problem is, when you put your mouse over it the link, you'll notice that the server root was added to the beginning. The only way I know to fix it is to put "http://" in front of $path, but that doesn't make any sense. Anyone know how I can get around this?
  17. Hello, I use fputs to write to a file, but I can only find documentation stating this function writes to the bottom of the file. I'd like to add text to the beginning of a file. Anyone out there have some code to do such a thing? Thanks
  18. I can't seem to the array to give me any values. Below is the code I have... FYI : the values of first, second, third, fourth, and fifth are Y,N, Y, Y, N [code] $idnum = 1; $statement = "SELECT first,second,third,fourth,fifth FROM maindb where id=$idnum"; $result = mysql_query($statement); $data=array();         while($row=mysql_fetch_array($result,MYSQL_NUM)){         $data[]=array(         'first' => $row[0],         'second' => $row[1],         'third' => $row[2],         'fourth' => $row[3],         'fifth' => $row[4]); extract($data, EXTR_PREFIX_SAME, "wddx"); } print "$first is first"; [/code] When I do a print_r($data), I get this: [code] Array (      [0] => Array            (                   [first] => Y                   [second] => N                   [third] => Y                   [fourth] => Y                   [fifth] => N            ) ) [/code] I'm so confused! =(
  19. I have a PHP page with a few dropdown menus. Next to the dropdown menus, I have hyperlinks to other PHP pages that add data to the DB associated with each dropdown, incase the information needed in the dropdown is not there, someone can add it by going to the hyperlink next to the dropdown. The problem is when the user is 90% down the page, and then has to add something to the last dropdown (so he has to add to the DB by clicking on a hyperlink and submitting a new record), but the new information is not in the dropdown unless the user refreshes the page, since refreshing the page would rerun the SELECT query. Is PHP able to deal with this somehow, or should I be looking at JavaScript or something else?
  20. I have five checkboxes that I'd like to put in an array only if they have been checked. I'm not sure exactly how to do that. PHP Code: [...snip...] <INPUT TYPE=CHECKBOX VALUE="field1" NAME="field1">Field1BR> <INPUT TYPE=CHECKBOX VALUE="field2" NAME="field2">Field2BR> <INPUT TYPE=CHECKBOX VALUE="field3" NAME="field3">Field3BR> <INPUT TYPE=CHECKBOX VALUE="field4" NAME="field4">Field4BR> <INPUT TYPE=CHECKBOX VALUE="field5" NAME="field5">Field5BR> [...snip...] If I have field2, field3, and field5 checked, I'd like to put them in an array, and then use implode() to print them out later.
  21. [code] $var = trim($var); [/code] [!--quoteo(post=352697:date=Mar 7 2006, 04:53 PM:name=DallasNYC)--][div class=\'quotetop\']QUOTE(DallasNYC @ Mar 7 2006, 04:53 PM) [snapback]352697[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, I spend alot of my time over at flashkit.com dealing mostly with flash. But I was recently involved with a thread dealing with PHP adding unwanted white space to a string. It turns out that if an extra line is left after the PHP closing tag, a space could get added to the string... [a href=\"http://flashkit.com/board/showthread.php?t=675912\" target=\"_blank\"]http://flashkit.com/board/showthread.php?t=675912[/a] Ive only done a little PHP coding, but this interest me because I never read anything about this. I'm curious if someone can enlighten me more about this issue? Is there more documentation/articles about what other things could result in whitespace being added to a string? (I did a search for 'white space' etc, but came up with too many results) Recently there is a new thread with another person having problems with added whitespace to thier strings.. [a href=\"http://flashkit.com/board/showthread.php?t=676326&page=2&pp=20\" target=\"_blank\"]http://flashkit.com/board/showthread.php?t...26&page=2&pp=20[/a] I notice that in this particular issue, the author follows the echo tag with a "//" remark tag, but was not certain if that would cause the same white space issue? Thanks so much, Dallas [/quote]
×
×
  • 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.