Jump to content

lucasjay

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

1 Neutral

About lucasjay

  • Rank
    Newbie
  1. In this case, specifically, because it's for a university assignment, and the requirement that's getting me is as follows:"Salesreps have an ID code of which the last four characters give their delivery_id". So while I could select them and get that result, I didn't want to write any queries and instead just have the answer on the table. Maybe you're right though, I guess I could just create a view that combines the two columns into a new one. Still, it truly baffles me that want I was trying to achieve isn't possible at all...
  2. Ok, well I gave that a go - here is my trigger: CREATE TRIGGER salesrep_id_create for insert ON salesrepsFOR EACH ROW set new.salesrep_id = concat(new.srid,new.delivery_id); Where salesreps is the table, srid is an auto-incremented column, and delivery_id is a foreign key. Unfortunately this doesn't work because srid is auto-incremented and doesn't have a value until after the row is inserted. I have tried all the various combinations with various errors as a result: Here I found someone who had the same problem: http://mysqldatabaseadministration.blogspot.com.au/2006/03/mysql-triggers-acc
  3. I cant believe how little success I have had in discovering the answer to my problem on Google over the last hours of trawling... I have an ID number (salesrep_ID) that I want to use as the primary key, and I want it to be comprised of another field (delivery_id) and an auto increment number. i.e. delivery id = 1234 salesrep_id = 0011234 ....HOW? Oh god how? It seems the thing to do would be to create a new field that is autoincremented and then make salesrep_ID the composite primary key of the incremented field and delivery_id. But I want this to be displayed when I query "select * from sales
  4. Holy crap it worked, using MAMP. Thankyou so much, that was driving me completely insane, and using a server didn't even vaguely occur to me. Hooray! Thanks again for the help
  5. Just tried it on my PC... it doesn't work in IE9 either. Only success in Safari so far...
  6. index.html <html><head></head><body><script type="text/javascript"> xhttp=new XMLHttpRequest(); xhttp.open("GET","books.xml",false); xhttp.send(); xmlDoc=xhttp.responseXML; x=xmlDoc.getElementsByTagName("title"); for (i=0;i<x.length;i++) { document.write(x[i].childNodes[0].nodeValue); document.write("<br />"); }</script></body></html> books.xml: <?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited by XMLSpy® --><bookstore><book category="cooking"><title lang="en">Everyday Italian</titl
  7. Sorry, yes, it works in the tryit editor in opera...
  8. It can't be the length property, as like i said I took away the for loop from the example just to test, and that's how I get opera to display an error, instead of nothing at all. The error is in this line: document.write(x[0].childNodes[0].nodeValue); in that for some reason the node from the xml file, which is simple text "cannot be converted to object". It works in the TryIt editor, and in Safari. I would try more browsers, but for my purposes I'm really mostly interested in Opera. Just to clarify, in the example, and in my code above, there is a simple xml file with some book information, a
  9. Must be an opera thing again, the code in its original form is on this page: http://w3schools.com/dom/dom_nodes_access.asp I've just put it all on the same HTML file.
  10. Hi everybody,I've been working my first website, and I came to a section where I wanted to get data from an XML file and display it on the web page. So I followed the XML and XML DOM tutorials, but I've hit a maddening wall, thanks to Opera. ?script?xhttp=new XMLHttpRequest();xhttp.open("GET","books.xml",false);xhttp.send();xmlDoc=xhttp.responseXML;x=xmlDoc.getElementsByTagName("title"); for (i=0;i?x.length;i++) {="" document.write(x.childnodes[0].nodevalue);="" document.write("?x.length;i++);{ document.write(x.childNodes[0].nodeValue); document.write("?br /?");}?/script? This is the code tak
  11. I don't know why that didn't post properly... seems this forum doesn't like tags? I'm going to rewrite, replacing all the tags with question marks...
  12. Hi everybody,I've been working my first website, and I came to a section where I wanted to get data from an XML file and display it on the web page. So I followed the XML and XML DOM tutorials, but I've hit a maddening wall, thanks to Opera. xhttp=new XMLHttpRequest(); xhttp.open("GET","books.xml",false); xhttp.send(); xmlDoc=xhttp.responseXML; x=xmlDoc.getElementsByTagName("title"); for (i=0;i
×
×
  • Create New...