Re: [PHP-DB] Help with a query
Why not use: SELECT a.item_id, a.subtotal, a.quantity FROM shopping_cart a, orders b WHERE b.session_id = session_id() AND b.customer_id = $customer_id AND a.order_id = b.border_id ? !Exclude Disclaimer! Jonathan Villa wrote: I can't figure this query out. I want to pull data from 2 tables but using a primary key from one. Here is what I think it should look like. SELECT item_id, subtotal, quantity from shopping_cart WHERE order_id = (SELECT order_id FROM orders WHERE session_id = session_id()) AND customer_id = $customer_id; -Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing images in MySQL table
Milan, The only disadvantage i've had of storing images in DB instead of Filesystem, is that when you use a PHP script to output the image to a client browser, MSIE doesn't always accept a suggested filename so it might try and save it as your-script.php?img=2. Other then that, keeping images in DB is a lot easier since you don't have to keep your DB in sync with Filesystems ie. Deleted records in DB, but images still exist. [EMAIL PROTECTED] wrote: Hi everybody, i want to store some articles and images to them in MySQL db. could you just give advice if it is better to store the image in BLOB or if to save on server and in db just have it's URL. Hi Milan =Disclaimer and Confidentiality=== This message contains information intended for the perusal, and/or use (if so stated), by the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon he information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] More help with mysql
Yo Evan, Have you got an '@' in front of the mysql_query() to supress errors ? Evan Morris wrote: Hi all I have successfully managed to connect to the mysql database, using the following code: mysql_connect('localhost','php','***') || die (Unable to connect to MySQL server.); $db = mysql_select_db(DB_NAME) || die (Unable to select requested database.); I then issue the following command: $result = mysql_query(SELECT * FROM SOME_TABLE) || die(mysql_error()); This does not result in any error. Now, of course, I want to work with the data returned, so I go: if (mysql_num_rows($result) 0) { // do some stuff } else { // do some other stuff }; However, this gives me: Supplied argument is not a valid MySQL result resource. If I go: echo $result, I get '1', so I know $result actually has some value. What am I doing wrong? Basically, I want to do the simplest thing: get data out of a table and step through the results, displaying them one by one. Why is this hard? Evan Morris [EMAIL PROTECTED] Tel: +27 11 792 2777 Fax: +27 11 792 2711 Cell: +27 82 926 3630 =Disclaimer and Confidentiality=== This message contains information intended for the perusal, and/or use (if so stated), by the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon he information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple select box using mysql
You have to give the Mutli select box a name as an array. eg: SELECT NAME=experts[] MULTIPLE SIZE=5 OPTION VALUE=key1val1/OPTION /SELECT then in PHP, you can access $experts as an array. while (list ($key, $val) = each($experts)) { print $key = $valBR\n; } Jason End wrote: I writing a software catalog that features experts, who a people especially skilled in a piece of software. My db, has a software table and an experts table. I need to have a page that generates 2 multiple select boxes, each on with the data from each table. From there one will be able to choose the software program and the experts, which will then record the software-expert relationship in the DB. The problem is that I don't really understand how to populate multi select boxes with db data, and then have the selections passed back as inserts. Can someone clue me in? thanks, Jay __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com =Disclaimer and Confidentiality=== This message contains information intended for the perusal, and/or use (if so stated), by the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon he information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php