Jump to content

cmattoon

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

About cmattoon

  • Birthday 10/20/1987

Profile Information

  • Gender
    Male
  • Location
    Pittsburgh, PA

cmattoon's Achievements

Member

Member (2/5)

0

Reputation

  1. Ahhhhhhhh. That's strange, I believe I've used "to" as a field before with no problems.. And yeah, those quotes were just me trying different arrangements out of frustration. Thanks!
  2. I'm using a PM script from here: http://www.pixel2life.com/publish/tutorials/608/simple_private_messaging_system/ and can't get the messages to send. This is the relevant section of code (from the PHP class), along with the mysql_error() output. function sendmessage($to,$title,$message) { $to = $this->getuserid($to); //$sql = "INSERT INTO messages SET 'to' = '".$to."', 'from' = '".$this->userid."', 'title' = '".$title."', 'message' = '".trim($message)."', 'created' = NOW()"; $created = time(); $sql = "INSERT INTO messages ('to,from,subject,message,created') VALUES ('$to','$this->userid','$title','".trim($message)."','$created')"; return (@mysql_query($sql)) ? true : false; } 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 ''to,from,subject,message,created') VALUES ('5','1','test','This is a test Messag' at line 1 I have tried the original code (commented out), as well as the subsequent two lines with several variations in quotes. Each one results in this message. The trim() on the second one was also attempted with just '$message', and did not work. The values in the INSERT statement are correct, as far as I can tell. The only potential difference is the integers are actually strings, being put into an INT(11) field on the DB...but I've never had a problem with this before. I've also tried re-ordering the query to match the order of fields in the database (title,message,to,from,created). $sql = "INSERT INTO messages (title,message,to,from,created) VALUES ('$title','".trim($message)."','$to','$this->userid','$created')"; This results in the error showing: 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 'to,from,created) VALUES ('test','This is a test Message','5','1','1318345125')' at line 1 It appears to be a problem with the "to"? I've never had this problem before...am I missing something?
  3. I have a checkbox with an ID and NAME of "noexpire", and a Spry textbox with an ID and NAME of "expiration". When the user checks the "noexpire" checkbox, I want the date "12/31/2099" to automatically populate the textbox. I've tried several different arrangements of: document.frmPass.expiration document.getElementById('expiration') document.getElementById("expiration") as well as a few others, but for some reason, nothing appears to work. I'm not even getting a JavaScript error! (I've also tried ".value" for both the checkbox and textbox..) I tried an alert box, and the function is being accessed, but it won't do anything. function doExpire(){ document.getElementsByName("expiration").text=(document.getElementByName("noexpire").checked)?"12/31/2099":""; } Any ideas? Thanks!
  4. There's probably an easier way to do this, but here's what I do.. Suppose we have a table of stocks: ID Symbol Name 1 ABC ABC, Inc. 2 XYZ XYZ, Inc. ... Use the unique identifier (whatever that may be in your case).. in the example i'll use ID <select name="stockToModify"> while ($row = loop to pick all valid options) { echo "<option value=\"".$row[id]."\">".$row[symbol]."</option>"; } </select> Then, in your 2nd script (which processes form data): $id = $_POST['stockToModify']; $sql = mysql_query("SELECT * FROM stocks WHERE id='$id'"); ...perform operation, etc... Hope that helps!
  5. I borrowed a free script to make a basic news scroller with the use of an XML file. Basically, it loads the XML file, then does: document.all.write('<div id="news_panel"></div>'); Later on in the script, it does: document.all.getElementById(news_panel).innerHTML = '.......'; Up until recently, this has worked fine because it was on a test page by itself. However, when I integrate into the existing main page, I can't seem to put it where I want it. When I code the DIV as HTML, it doesn't want to write into that DIV using the 2nd line of code (above). It only seems to write when the DIV is written through the document.all.write() method. The other thing I tried was to code (in HTML) a <div id="mainNewsFrame"></div> and then write the news_panel DIV into the mainNewsFrame DIV, but that doesn't work either. I'm not sure what the document.ALL.getElementById() means either.. in previous JavaScript code I've seen, it's simply "document.write" or "document.getElementById()".. any idea what the "all" is for? (If you can't tell, I'm not very familiar with JavaScript!) Thanks!
  6. Let me preface this with "I know next to nothing about JavaScript, and usually can't even get a simple, pre-written JS function to run properly". What I'm trying to do is develop a series of HTML templates that provide pseudo-dynamic data on a local machine. For example, you could write a text file, name it "config.txt" and place it in the same directory as this template, zip it, and email it to me, and i open up the HTML file as a local file, and can view your content. Sample "config.txt" BACKCOLOR FFFFFF; TXTCOLOR 000000; :1: TXT "Hello World! This is a page of text."; IMG picture.png; CLICK next [2]; :2: TXT "This is page 2."; IMG picture2.png; CLICK back [1]; CLICK next [3]; I guess it is like Powerpoint meets batch files or QBASIC. I know it's a lot of work for something really silly, and if there's an easier way to do it, by all means - let me know. JavaScript is just the only client-side script I know of, and I'm even worse at Flash (IIRC, it has this capability with XML files). The question is, can you (how do you...) import this file with JavaScript, parse it, and somehow make the browser know which content to load. My hopes are to do something like PHP does: <img src="<?=$image;?>"> <a href="<?=$url;?>"><?=$linkText;?></a> .... Any thoughts? Thanks!
  7. Hi all, I recently put a live search box on a website, and it was working fine for the past few weeks. Suddenly, I receive the following error when the page is accessed via a link (after it's accessed, 'refresh' cures the problem) - but I'm not sure why it's showing up suddenly. The search box does not work when the error is shown. Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDC; .NET4.0C; InfoPath.3; Zune 4.0) Timestamp: Sat, 22 Jan 2011 12:39:58 UTC Message: Object doesn't support this property or method Line: 3 Char: 3 Code: 0 URI: http://wwww....com/ajax_search.js Lines 1-9 of "ajax_search.js": function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your Browser Sucks!"); } } I've tried deleting the whitespace and replacing it, in hopes that character 3 was an invalid 'invisible' character, but that didn't work. I also uploaded the backup copy, in case it was the other guy who messed it up (which I doubt, since neither of us touch JS files that are working...purely for this reason..) Any thoughts? Thanks!
  8. +1 I've been working with lots of linked tables recently, where each tables' data is pertinent to each other (personnel records)... that does make it a lot easier though, and what i was starting at with part 1. Out of curiousity, why four separate tables? (I may be missing something obvious here... lol)
  9. Try using regex. This site has a few examples on URL regexes. I'm still not very good with them though.
  10. Simple Solution: -Products -------------- Colors --------------- Sizes -Foo --------------- Red ------------------ Small -Foo ---------------- Red ------------------ Med -Foo ---------------- Red ------------------ Large -Foo ---------------- Blue ------------------ Small -Foo ---------------- Blue ------------------ Med .....etc (SELECT * FROM table WHERE products='foo') Better: Products Table -- ID --- Description 1 Foo 2 Bar Colors Table -- ID --- Color 1 Blue 1 Red 2 Blue 2 Red Sizes Table -- ID --- Size 1 Small 1 Medium 2 Small 2 Medium Let's say we're on 'products.php?id=1'... shopping for "foo". We create dropdown boxes by: <select name="color"> <?php $sql = mysql_query("SELECT * FROM colors WHERE id='$id' ORDER BY color ASC"); while($row = mysql_fetch_assoc($sql)){ echo "<option value=\"".$row[color]."\">".$row[color]."</option>"; } ?> </select> then........... <select name="size"> <?php $sql = mysql_query("SELECT * FROM sizes WHERE id='$id' ORDER BY size ASC"); while($row = mysql_fetch_assoc($sql)){ echo "<option value=\"".$row[size]."\">".$row[size]."</option>"; } ?> </select> You may also want to add a numerical value for sizes, so they show up in a logical order, not alphabetical: ID size sizetxt 1 1 Small 1 2 Medium 1 3 Large 2 1 Small 2 2 Medium 2 3 Large This would show Sm/Med/Lg in that order... not "Large/Medium/Small"... or worse "Large/Medium/Small/X-Large/X-Small/XX-Large/XX-Small" In this case, you would do echo "<option value=\"".$row[size]."\">".$row[sizetxt]."</option>"; The 2nd method makes it easier to update your inventory... say you now offer Purple "foo".. just add a row to the "colors" table, and the sizes will pre-populate. This doesn't take into account that Red foo doesn't come in 2XL, only yellow and blue, etc... Disclaimer: There is probably a better/more efficient way to do this... but this is just my 0.02. (I'm no SQL expert, but I do use it quite a bit)
  11. ReCaptcha may be different than the Captcha script I've been using... but I dont see any code in your PHP script to check a value... it appears that you're only checking to see if they filled in a value. This may help: http://code.google.com/apis/recaptcha/docs/verify.html And This: http://code.google.com/apis/recaptcha/docs/php.html
  12. If you mean "dynamic" as in "live search" (think: google - updates as you type), you'll most likely want a PHP/AJAX/MySQL solution. Google "live search php", and you'll get a handful of tutorials. I have very limited experience with AJAX, and it took a few tries, but it's not too hard to do. If you're good with AJAX/JavaScript, it'll probably be a lot easier. On the other hand, if you mean 'dynamic', in the sense that clicking "Email Us" from the tech support page inserts "techsupport@domain.com", while clicking "Email Us" from the sales page inserts "sales@domain.com", that's a pretty easy chunk of PHP code. Lastly, and I've only ever needed this once, if you want a "dynamic" feature where there are checkboxes (Sales, Support, Billing), and you want the email addresses updated with the proper email addresses depending on the checkboxes that are checked, that can be done relatively easy with JS.
  13. Awesome, thanks! Cant believe that didn't turn up in the search or the stack of books here!
  14. I've searched around the internet and can't find a good method to do this. To start, I have a database with a field called 'fpath' that stores the filepath (root-relative) to uploaded PDF's. In this case, they're scanned personnel files. What I'd like to do is be able to download relevant PDF's based on a generated report... such as all PDF's of a certain category or all PDF's for a certain user. If there's a specific PEAR package or other script out there that you know works well, I can research it on my own.. but each search result is bringing up a different method to do it, which makes me nervous. Thanks!
  15. Its hard to say without knowing specifics of your SMS system. Typically, we use the mail() for our in-house projects (0000000000@vtext.com). If you're using a commercial SMS gateway, it really depends on how the program works. I don't have much experience with them. To handle incrementing a value that's stored in the database, I'd probably set up a "listener" script that uses a GET request to increment the number. (pseudocode)... SMS gateway visits "listener.php?val=inc" $val=$_GET['val']; if($val == "inc"){ $sql = mysql_query("SELECT value FROM database"); $sql ++; $result = mysql_query("UPDATE value IN database"); if($result){ //Success }else{ //Fail } }else{ //Do nothing, invalid 'val' value. } Again, I have no idea what your SMS gateway supports.... this is just a general idea from what I've used with other listener scripts.
×
×
  • 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.