Jump to content

shutat

Members
  • Posts

    30
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

shutat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I had no idea; you don't know how frustrating that was to see no such table when I knew it wasn't true. Thank you.
  2. I'm trying to conditionally add a table to a select query using the join, but I always get an "no such table" error. I'm not at all sure if the syntax is correct, so I decided to ask. I'm using the sqlite C API interface and my tables and query were constructed using sprintf, so please ignore any %d, %s that may appear CREATE TABLE IF NOT EXISTS tbl_master ( id INTEGER PRIMARY KEY AUTOINCREMENT, volume TEXT(16) UNIQUE NOT NULL DEFAULT '', note TEXT(%d) NOT NULL DEFAULT '', items INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS tbl_file ( id INTEGER PRIMARY KEY AUTOINCREMENT, volume_key TEXT(16) NOT NULL DEFAULT '', name TEXT(%d), size TEXT(20), type TEXT(4), path TEXT(%d), file_id INTEGER ); CREATE TABLE IF NOT EXISTS tbl_hash ( id INTEGER PRIMARY KEY AUTOINCREMENT, hash TEXT(33) NOT NULL DEFAULT '', volume_key TEXT(16) NOT NULL DEFAULT '', file_key INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS tbl_media ( id INTEGER PRIMARY KEY AUTOINCREMENT, runtime TEXT(10) NOT NULL DEFAULT '', frame TEXT(12) NOT NULL DEFAULT '', type_key TEXT(4) NOT NULL DEFAULT '', hash_key TEXT(33) NOT NULL DEFAULT '', volume_key TEXT(16) NOT NULL DEFAULT '', file_key INTEGER NOT NULL DEFAULT 0 ); I milled over a few JOIN tutorials, but I'm still unclear on the exact usage of JOIN; I'm trying to add the media table if the file type is a vid, snd, or pix, but I need file information regardless. I've tried various flavors of the following query, but each time I get the table doesn't exist error. Selects, deletes, updates, inserts work on all tables, so I'm guessing my syntax is wrong with the JOIN. SELECT tbl_file.*, tbl_hash.hash FROM tbl_file AS f, tbl_hash AS h LEFT OUTER JOIN tbl_media AS m ON ((f.type='VID' OR f.type='SND' OR f.type='PIX') AND m.file_key=f.file_id) WHERE ((f.volume_key=tbl_master.volume AND (h.volume_key=tbl_master.volume AND h.file_key=f.file_id))) ORDER BY f.path ASC; Any ideas on how to pull off what I'm trying to do would be greatly appreciated. Thank you for your time.
  3. shutat

    text login?

    You can use styling properties to alter the appearence of the button. <input style="background-color: same as default background; color: desired text color; border: 0px" ...> Not sure how you would go about passing input using a hyperlink alone.
  4. If the image needs to change as the user types, then I *think* something like below may work. onChange is triggered when the textbox loses focus and its value was changed. "this" contains properties of the target. For example, you could add another parameter to your function that includes the "name" parameter of the input box by adding onkeypress="isCorrect(this.name, this.value, 'actual_text');" <input type='text' name="random_letters" onkeypress="isCorrect(this.value, 'some_actual_value');"> HTH
  5. I had the exact same issue, and after a bit of research, I discovered it was a synchronous / asynchronous problem. Try modifying your code as function ajaxPost(params, url){ var XMLHttpRequestObj = false; if (window.XMLHttpRequest){ XMLHttpRequestObj = new XMLHttpRequest(); } else if (window.ActiveXObject){ XMLHttpRequestObj = new ActiveXObject("Microsoft.XMLHttp"); } if (XMLHttpRequestObj){ XMLHttpRequestObj.open("POST", url, false); XMLHttpRequestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); XMLHttpRequestObj.setRequestHeader("Content-length", params.length); XMLHttpRequestObj.setRequestHeader("Connection", "close"); XMLHttpRequestObj.send(params); var requestResponse = XMLHttpRequestObj.responseText; delete XMLHttpRequestObj; return (requestResponse); } } HTH
  6. I was toying around with that same idea, but got frustrated with the whole project since I'm more of a hobbyist than a programmer. It's been a while since I last worked on it, but here's the link if you're interested.
  7. If you want, you can use php to serve the form as well as process it. You should always check your variables before using them; empty is just a simple check to see whether or not a user filled them in. You'd want to make sure any input was valid for the field you expect before processing it. <?php if(isset($_POST["submit"]) && $_POST["submit"] === "send") { if(empty($_POST["name"]) || empty($_POST["replymail"]) || empty($_POST["subject"]) || empty($_POST["body"])) { // one or more post vars had an empty field } else { // validate input // assign post vars as needed // call mail function // mail returns a boolean value, true indicates it was sent, but // does not indicate whether or not it will actually arrive } } else { ?> <pre> <form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> Name: <input type="text" name="name" size="30"> From: <input type="text" name="replyemail" size="30"> Subject: <input type="text" name="subject" size="30"> Body: <textarea rows="6" cols="54" name="body"></textarea> <input type="submit" name="submit" value="send"> </pre> <?php } ?> HTH
  8. I don't mind the ads and whatnot, but now the site tends to stall out making it hard to post / reply sometimes... for slow internet connections like mine, that sort of thing makes the site less appealing, which is a shame because it's been a fun place to mill about in since I signed up.
  9. Don't know if it will help, but one thing you *might* try is something like below. If you need to unhide it again, place the input stuff back as innerHTML. <html> <head> <script language="javascript"> function fifty() { var docs = document.getElementById("opt1"); docs.innerHTML = " "; } </script> </head> <body> <form> <div id="opt1">XHTML <input name="answer" value="xhtml" type="radio"><br></div> <div id="opt2">CSS <input name="answer" value="css" type="radio"><br></div> <div id="opt3">PHP <input name="answer" value="php" type="radio"><br></div> <input value="50 / 50" type="button" onclick="fifty();"> <input value="submit" type="submit"> </form> </body> </html> The downside is having to rely on client support being enabled. If you want straight html, then you could pass along the request in your link and regenerate the page. HTH
  10. I'm working on a basic login routine where I'd like to replace a "guest" once a member logs in, but ran into a snag with syntax. Right now, I have something like below just to try things out, but it isn't really what I need. $res = mysql_query("update tbl_users set laston='" . $time . "' where ID='" . $n . "' limit 1;"); $res = mysql_query("update tbl_guests set laston='0' where ip='" . $_SERVER["REMOTE_ADDR"] . "' limit 1;"); I tried various ways at an attempt for just one query, and my last try was something like $n = user's ID $time = time(); $res = mysql_query("update tbl_users, tbl_guests, set tbl_users.laston='" . $time . "', tbl_users.ip='" . $_SERVER["REMOTE_ADDR"] . "' where tbl_users.ID='" . $n . "', set tbl_guests.laston='0' where tbl_guests.ip=tbl_users.ip limit 1;"); However, I got nothing but dreaded syntax errors with all attempts. I haven't done much work at all with joins, but was wondering if it's possible to update two tables in such a way? If so, what am I not getting right? TIA
  11. if(document.cookie.length > 0 && document.cookie.substr(0, document.cookie.indexOf("=")) == cname) { if(document.cookie.substr(document.cookie.indexOf("=") + 1) == "no") { location.href = "index.php"; } else { // cookie data was something other than no } } else { location.href = "index.php"; // cookie wasn't set } I *think* that would do assuming the cookie format is just cname=no. Things to lookout for are indexOf is case sensitive, and it returns -1 if the match string isn't found. HTH
  12. To check if a user exists, you could try something like ... $res = mysql_query("select ID from users where username='$username' limit 1;"); if(mysql_num_rows($res) == 1) { // username already exists } else { // insert form data // delete form data } ... There's probably better methods, but that's what I usually do. HTH
  13. I've never used it, but while milling about here, I saw bluefish, which claims to support OSX HTH
  14. Check to see if your host supports the gd library; if it does, you can generate images on the fly including resizing. The downside is it's somewhat static, so you could use an iframe, and or javascript along with $_GET to "dynamcially" change each image, or try ajax. Here's a link to gd and here's one to some thumbnails page using php and js. I don't know if either will meet your need, but thought I'd throw it out there. HTH.
  15. I'm working a game actually, where each of the selects will represent commands the player can take. The first select is static, but the others will be filled once conditions are met. The first item in each select is just a moniker of sorts to show what each of the commands are, so element 0 wouldn't ever be acted upon. Thanks a lot for the great tips; I was looking for a way to compact my version of the switch that you did within your version of the keyB function, and your method is nice and clean. I think your select handler is going to help out a lot too. I'm going to go ahead and marked this as solved; I really appreciate your help! Thank you.
×
×
  • 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.