Jump to content

powerpants

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

powerpants's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, I tried it using full stops, but I am still getting the error editPicturesInfo.imageId is not defined! Don't these statements define it? var editPicturesInfo = {}; for(imageId in currentlyDisplayedPicturesData) { editPicturesInfo.imageId.selectionStatus = "selected"; //This is the line that Firebug catches. editPicturesInfo.imageId.caption = "caption"; editPicturesInfo.imageId.deleteStatus = "true"; editPicturesInfo.imageId.indexStatus = "true"; editPicturesInfo.imageId.peopleToAdd = "2"; } Thanks for looking at this.
  2. Can you please explain to me what this means? I'm still learning Javascript. Sorry....
  3. Hi, I'm attempting to create an associative array in Javascript for a bunch of images that my page is displaying. I already have an associative array called currentlyDisplayedPicturesData which is keyed by [imageId]. I want to make a new associative array called editPicturesInfo keyed by imageId's from currentlyDisplayedPicturesData and make a new associative array called editPicturesInfo, with each imageId associated with some information taken from forms in the document. var editPicturesInfo = new Object(); for(imageId in currentlyDisplayedPicturesData) { editPicturesInfo[imageId]["selectionStatus"] = currentlyDisplayedPicturesData[imageId]["selectionStatus"]; editPicturesInfo[imageId]["caption"] = document.getElementById("caption" + imageId).value; editPicturesInfo[imageId]["deleteStatus"] = document.editPicturesForm.deleteBox.value; editPicturesInfo[imageId]["indexStatus"] = document.editPicturesForm.indexNow.value; editPicturesInfo[imageId]["peopleToAdd"] = document.editPicturesForm.people.value; } Firebug keeps telling me that editPicturesInfo[imageId] is not defined! Shouldn't it be automatically defined as I am making the above statements?
  4. Turns out what I was describing was a JOIN. I JOIN'd the tables that I wanted to query based on common image_id's. I'm learning as I go along.....
  5. Hi everyone, I'm trying to build a little web app that returns images from my database based on sorting constraints selected by the user from some pull down html menus. Here's my table layout...... I've got a table called 'image' which contains relevant issue to images stored on the server. Each record in 'image' has attributes 'image_id,' (primary key) 'batch_id,' 'photographer_id,' and 'image_path,' among others. I have another table called 'person,' which includes primary key 'person_id.' I have a third table called 'image_person' wherein each record has two attributes: 'image_id' and 'person_id,' which are foreign key'd to the 'image' and 'person' tables, respectively. This table is how I keep track of the multiple people in each image. On the web interface, I want the user to be able to select images from a "Batch," "Photographer," and "Person" drop down menus. Obviously, this would be very easy if I only wanted to choose "Batch" and "Photographer," as they are found in the same table as 'image_id' and 'image_path,' but adding the "Person" part is kind of throwing me for a loop. Is there some way to first query the 'image_person' table with a 'person_id' retrieved from the drop down, and then use the resulting set of 'image_id's to immediately SELECT FROM image WHERE image_id=(the ones i got from image_person table) && batch_id=(from drop-down) && photographer_id=(from drop-down)? Or is there a better way of doing this? This is my first mySQL project, and I'm kind of learning as I go along, so feel free to assume that I know nothing when formulating your responses to me....... Thanks very much for your help, this is driving me crazy!
  6. Hello! I have a page where the user enters data into a form, and the form POST's that data to another php page where data from the form is inserted into the database. I want to make so that if all the database queries do not produce any errors, the second page then redirects and re-POST's some of the original form data to a third page for use in a php script there. So, how can I automatically POST data and redirect to another PHP page at the end of my script on the second page? Thanks!
  7. Ok, thanks. I looked into InnoDB, and here's my new query: CREATE TABLE image_person( image_id int NOT NULL, person_id int NOT NULL, FOREIGN KEY (image_id) REFERENCES image(image_id), FOREIGN KEY (person_id) REFERENCES person(person_id) ) ENGINE=INNODB; And, here's the error I get: ERROR 1005 (HY000): Can't create table './davidland/image_person.frm' (errno: 150) From what I've been reading, InnoDB and not-InnoDB tables are freely mixable in databases, right? Or could this problem be that I'm trying to foreign key to a table which is not InnoDB? Thanks for your reply!
  8. Hi everyone, I'm setting up my first MySQL database, but none of my foreign keys seem to be getting configured correctly according to my SHOW CREATE TABLE output. For example, I have a table called image_person which has two attributes that should be foreign keyed to two different tables which hold the image_id's and person_id's. I set up the table using the following command: CREATE TABLE image_person( image_id int NOT NULL, person_id int NOT NULL, FOREIGN KEY (image_id) REFERENCES image(image_id), FOREIGN KEY (person_id) REFERENCES person(person_id) ); But, when I SHOW CREATE TABLE image_person, I get...... | image_person | CREATE TABLE `image_person` ( `image_id` int(11) NOT NULL, `person_id` int(11) NOT NULL, KEY `image_id` (`image_id`), KEY `person_id` (`person_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | Shouldn't I see the foreign key information? What am I doing wrong? I'm running MySQL 5.0.45 Thanks!
  9. Thanks for catching that for me! I don;t have IE so I haven't tested my page in IE yet. Also, www.phpbyexample.com is not responding. Would it be possible for you to post your example here? Thanks!
  10. Cool, thanks! I am working based on the w3schools PHP/AJAX tutorial, which does not show that you need the header and the xml element! One more question - Since there are multiple files in my directory that I want to show, what's the best way to put line breaks between them when I have my javascript insert them into the "filecontents" span since I cannot have <br /> tags in the xml file itself? Thanks again for your help!
  11. Hi, I'm trying to make a part of a site I'm building scan a directory and display some information about it when the user selects it from a select box. I have a php function to make an xml file and javascript script to insert the data in different parts of the page. I think that what I have should work, but it doesn't! Could someone look at what I've done and point out my silly newbie mistake? Thanks! Here's my JavaScript: var xmlHttp; function showFolderInfo(str) { xmlHttp = GetXmlHttpObject(); if(xmlHttp == null) { alert("Your browser sucks and does not suport AJAX"); return; } document.getElementById("folderName").innerHTML = str; var url = "getFileInfo.php"; url = url + "?q=" + str; url = url + "&sid=" + Math.random(); xmlHttp.onreadystatechange = stateChanged; xmlHttp.open("GET", url, true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { xmlDoc = xmlHttp.responseXML; document.getElementById("lastModified").innerHTML = "Hebbo!"; //xmlDoc.getElementsByTagName("lastmodified")[0].childNodes[0].nodeValue; document.getElementById("folderContents").innerHTML = xmlDoc.getElementsByTagName("filecontents")[0].childNodes[0].nodeValue; } } function GetXmlHttpObject() { var xmlHttp = null; try { //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.HMLHTTP"); } catch(e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } And here's my getFileInfo.php script: <?php $folderName = $_GET["q"]; $picturesDirectory = "./pictures"; $files = array(); if ($handle = opendir($picturesDirectory . "/" . $folderName)) { for($i = 0; false !== ($file = readdir($handle)); $i++) { if ($file !== "." && $file !== "..") { $files[$i] = $file; } } echo '<?xml version="1.0" encoding="ISO-8859-1"?>'; echo "<filedata>"; echo "<filecontents>"; foreach($files as $file) { echo $file; } echo "</filecontents>"; echo "</filedata>"; closedir($handle); } ?> EDIT: For some reason, the code block refuses to show the opening ' mark on the '<?xml version="1.0" encoding="ISO-8859-1"?>'; line. But it's in my code.
×
×
  • 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.