RE: Getting Images in and out of a Blob
You might find this helpful - I did. http://www.phpbuilder.com/columns/florian19991014.php3 Has anyone done any work with getting images into and out of a MYSQL database? I have used mysql for some time, but never stored an image in a blob field. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: MySql, PHP and Javascript
Absoulutely. Since PHP is server-side you can write javascript dynamically on the fly which are then executed client-side. Here's a simple example: !-- yourpage.php-- script language=Javascript var today = '?php echo date(Y-m-d, time()); ?'; /script -Original Message- From: Steve Davies [mailto:[EMAIL PROTECTED]] Sent: Friday, January 31, 2003 1:27 AM To: [EMAIL PROTECTED] Subject: MySql, PHP and Javascript Hi All Is it possible to mix javascript and PHP in the same script?? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Need nulls in my join
Unfortunately I tried to implement what you suggested, but in my case it didn't work. I have stories that can have zero or more photos, one or more author, one or more sections, and one or more active dates. Trying to join all those items together using your suggestion actually did return stories with no photo, but I would then get 3 copies of a story that had 3 photos, and 6 copies of a 2-photo story that appears on 3 days. What I really need is mysql 4's SELECT blah WHERE (SELECT blah) subselect feature, but that's not an option either due to the host I'm using. I ended up writing a simpler query get all the unique story id's for a section, then doing a foreach loop in PHP to query for all the additional data for the story where ID = $loopindex. I'm sure there's a supermysqlguru out there who cringes when you issue a bunch of queries in a PHP loop, but it works fine for now. Thanks though - I'm sure I'll use your suggestion somewhere in the app I'm working on. Geoff -Original Message- From: Loren McDonald [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 1:41 PM To: Hoffman, Geoffrey; [EMAIL PROTECTED] Subject: RE: Need nulls in my join Oopssorry. That should have been GROUP BY and not GROUP ON That's what I get for answering a post at 2am. :) -- Loren McDonald AKA MisterrMac [EMAIL PROTECTED] This one is relatively simple: Drop the WHERE evtphoto.phtusage = 1. SELECT it and then GROUP ON it. -- Loren McDonald AKA MisterrMac - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: good manner for handling multiple languages dynamic websites
Bear in mind that I've never attempted a multilingual website, but the first thought that I had when I read your post was to have a table name extension that gets appended based on the user's language choice/locale/whatever: $langext = _en;// english // $langext = _de; // german // $langext = _fr; // french etc. $sql = SELECT *.* FROM dropdownitem.$langext. ; All other things being equal this way, you'd have duplicated tables but little else in your app. dropdownitem_en dropdownitem_de dropdownitem_fr categories_en categories_de categories_fr If you have the ability to make the entire db this way, (create database yourapp_en, yourapp_de, yourapp_fr, etc.) it may be simpler, but depends on your host... I know I cant create dbs, only tables in one db for the domain. Good Luck! Geoff D I have, for the first time, a website to do in several languages. D I'll do a variable replacement whereever needed, with several D lang files (as D I've seen so many times in open source PHP applications) D the color of his object, he chooses RED D I will store RED,BLUE,GREEN,etc. in a table 'color' so I can build a D dropdown list for the user to choose from D D well now, if a visitor browse the ads in french. I'd like the D color to read D 'rouge' not 'red'. D D How should I go about that, database items ? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Need nulls in my join
I have an SQL query that LEFT JOINs four different tables to a main table, based on several foreign keys. It's returning only stories in a section that have photos, but I need it to return all the stories in a section whether it has a photo or not. I think the problem is in the WHERE evtphoto.phtusage = 1 -- if there's no photo, then there's no phtusage. Should I split this up into two queries, to get all the story IDs for a section/day and then get the photos for the stories in a 2nd query? Or do I need a different join type? Or do I put the WHERE clauses in a different order? Here's the query: SELECT evtstorysection.secid, evtstory.styid, evtstory.styheadline, evtstory.stysummary, evtstory.styintro, evtstory.stypubdate, evtphoto.phturl, evtphoto.phtcaption, evtstoryorder.stoorder, evtlayoutsum.lytstring FROM evtstory LEFT JOIN evtlayoutsumON evtstory.slytid = evtlayoutsum.lytid LEFT JOIN evtstorysection ON evtstory.styid = evtstorysection.styid LEFT JOIN evtstoryorder ON evtstory.styid = evtstoryorder.styid LEFT JOIN evtphotoON evtstory.styid = evtphoto.styid WHERE evtphoto.phtusage = 1 AND evtstorysection.secid = 3 AND evtstoryorder.secid = 3 AND evtstoryorder.stodate = '2003-01-24' AND evtstory.stypubdate = '2003-01-24' AND evtstory.styexpdate '2003-01-24' ORDER BY evtstoryorder.stoorder - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: --- Best ISP for MySQL PHP ???
I've had great luck with both: http://linuxwebhost.com and http://onsmart.net WS From: Will Standley [mailto:[EMAIL PROTECTED]] WS Sent: Friday, January 17, 2003 7:45 AM WS Subject: --- Best ISP for MySQL PHP ??? WS I'm looking for an ISP to host a couple of MySQL db's... WS Will be using PHP as the scripting language... WS Want to use PhpMyAdmin to administer the db. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Whats the best way to manage 'generic two-way relationships'?
I couldn't think of a better term for what I want to do... I am building a CMS for news stories. Often news stories are related to each other, or need to be grouped by content. I need a simple way to manage storyId relationships - in both directions. Thinking about the business logic to implement this is a bit confusing, because if you say story f is related to story b, and b is already related to c,d,e, then do I need aditional records for f-c, f-d, f-e? It gets worse if story f is related to g,h,i, and k is related to l,m,n and then you relate f to k... then you'd have to insert additional 9 (or would it be 12) records for the cross-product of all combinations of all the relationships. Or would you? And I can't think of how you'd handle this at the DB level (I'd have to loop in PHP and have 9 inserts?) My first thought was: CREATE TABLE storyRelationship( relIdINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, storyId1 INT UNSIGNED NOT NULL INDEX, storyId2 INT UNSIGNED NOT NULL INDEX ); so, for a given target story ID I would need a query that has something like... ... WHERE storyId1 = targetId OR storyId2 = targetId Another way I thought of has its own problems - CREATE TABLE storyRelationship ( relId INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, storyIdList TEXT }; of which a record would look something like: relId 5 storyIdList '46,59,89,94,213' but then I would need to do a lot of string parsing to get related stories, and I have to believe that a query with a 'LIKE %id%' clause is going to be a lot slower than one with an OR looking on two indexed rows. Any suggestions? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Confirmation of SELECT...IN syntax
you are correct - subselects are NOT allowed until version 4 until then: SELECT t1.* FROM table1 t1 LEFT JOIN t2 ON t1.id = t2.id OR SELECT t1.* FROM table1 t1 LEFT JOIN t2 USING (id) -Original Message- From: Doug Beyer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 10:55 AM It's my understanding that embedded selects are NOT allowed in MySql. Is this correct? Example: SELECT t1.* FROM table1 t1 WHERE ( t1.Id IN ( SELECT t2.Id FROM table2 t2 ) ) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php