Jump to content

danep

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

danep's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ah, I think I solved part of it... I was only editing httpd.conf to do virtual hosting. What I didn't realize was that there was a default configuration file loaded in sites-enabled that had a virtual host with DocumentRoot /var/www. I changed this default virtual host DocumentRoot to /var/www/live and the problem is solved. However, I still don't understand why the problem existed in the first place- i.e., why everything worked when browsing from another machine but not when using Lynx from the local machine.
  2. Sorry for the somewhat obscure title, I don't know how to describe this problem succinctly. Basically, I run a "live" and "development" version of my website on my server using name-based virtual hosts, so example.com has DocumentRoot /var/www/live while dev.example.com has DocumentRoot /var/www/dev. I can get to both websites fine from other machines. However, if I use Lynx or Curl on the server to try to get to example.com, I get the directory listing for /var/www instead. Does anybody know why that might be? Let me know if you would like me to post Apache config files. I appreciate the help, this has been driving me absolutely nuts.
  3. Thanks!  Wish I had thought of that sooner!
  4. I noticed my hosting company is running MySQL 3.23.58, which I gather is pretty behind the times.  Could this be the problem?  Sorry, probably should've mentioned this earlier but didn't notice until now.
  5. So, once again, this is the query I am using: [code] SELECT inventory.item_name FROM cart INNER JOIN inventory ON inventory.item_id=cart.item_id WHERE cart.session='$user_session' UNION ALL SELECT inventory.item_name FROM invoice_details INNER JOIN inventory ON inventory.item_id=invoice_details.item_id WHERE invoice_details.invoice_id=$invoice_id [/code] And I'm getting a syntax error.  Each select by itself runs fine, it's something to do with the Union that's causing an error.
  6. You're correct, the only column they have in common is "id".  So instead of selecting all columns I tried "(SELECT inventory.name FROM cart......) UNION ALL (SELECT inventory.name FROM invoice.....)" , and it throws the same error.  Now it seems to me, that since the column being returned in both selects is identical, that this should work.  Do all columns have to match even if they're not being selected?  Or is this just bad syntax on my part? Update: sorry, edited for clarity
  7. Hi everyone!  Okay, here's my problem in a nutshell: I know how to combine tables "vertically" (using UNION), and "horizontally" (using JOIN)... but what if I need to do both?  Let me explain. I have three tables: a shopping cart (containing, among other things, a product ID and session id), a product inventory (containing a product ID and product name/info), and a list of previously purchased items (containing the product ID and associated invoice number).  What I need to do is basically create a data set of all items currently in the user's shopping cart, plus all items on one of their previous orders, and then order all of that by product name.  I've tried using a join like so: "SELECT * FROM cart, invoice_details INNER JOIN inventory ON inventory.id=cart.id OR inventory.id=invoice_details.id WHERE cart.session='$user_session' OR invoice_details.invoice_id=$invoice_id ORDER BY product_name" Dunno if that makes sense... anyway, this query returns hundreds of results, basically everything from invoice_details and the user's cart - not at all what I was aiming for.  So then I tried "(SELECT * FROM cart INNER JOIN inventory ON inventory.id=cart.id WHERE cart.session='$user_session') UNION ALL (SELECT * FROM invoice_details INNER JOIN inventory ON inventory.id=invoice_details.id WHERE invoice_details.invoice_id=$invoice_id) ORDER BY class" This throws and error, a la Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource. Can anybody offer an alternative or point out what's wrong?
×
×
  • 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.