Jump to content

bagpiperdude90

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bagpiperdude90's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, maybe a better option would be: Take every word the user enters and search for it using OR, then order by the most hits or something, and group by photo_id. Searching for "Delta 737", lets say that applies to three tags spanned over two images. photo_id: 1 | tag: 737 | tag_type: type photo_id: 2 | tag: Delta | tag_type: airline photo_id: 2 | tag: 737 | tag_type: type Now, GROUP BY photo_id would eliminate one of the photo_id 2's. But, also, photo_id 1 would show up first, even though photo_id 2 has a higher hit count. How do I make photo_id 2 appear first, and in only one instance?
  2. Arrows show how to import excel data - just save the excel file as CSV. But you're trying to merge the two together? Maybe create a temp table, upload SQL file, delete the excess from it, then upload the excel file? Dunno if it would work... just an idea
  3. Ok, so, I'm building a photo gallery. It is a gallery of all sorts of different airplanes at different locations, etc. table: photos id | description | size | data (blob) | etc table: tags photo_id | tag | tag_type Now, when a user uploads a picture, it might be of a Delta Airlines 737 at KATL (airport code for Atlanta, GA). So, these changes would be made: table: photos id | description | size | data (blob) | etc --------------------------------------- 1 | blah blah | xxkb| blah blah | table: tags photo_id | tag | tag_type ------------------------- 1 | Delta Airlines | airline 1 | 737 | type 1 | KATL | airport Now, I want users to be able to use a keyword search feature. In the search box, they could type in "Delta 737 KATL" and it would search the tag table for %Delta% %737% %KATL%. The results would show that photo_id 1 meets the criteria, and shows it. However, it would NOT show pictures of a Delta 737 and KDEN (Denver) - it needs to match ALL words. But it WOULD match a picture of a Delta 737 at KATL taken at night (tag for that would be tag:night tag_type:time). Now, I have no idea how to do that in MySQL. My best guess is to have PHP figure the results. Query: $query = "SELECT * FROM `tags` WHERE `tag` LIKE '%Delta%' OR '%737%' OR '%KATL%' ORDER BY `photo_id`" Then, use PHP to find three of the same photo_id's, and you know you have a match. However, what if the user searched for 5 terms? PHP would have to know to look for 5 of the same id's. I need the tags to stay this way, because I need users to also search for "Delta" in a specific "airline" search box. So the query then would be like: $query = "SELECT * FROM `tags` WHERE `tag` = 'Delta' AND `tag_type` = 'airline'"; Along the same lines, to search for "KATL" in a specific airport box: $query = "SELECT * FROM `tags` WHERE `tag` = 'KATL' AND `tag_type` = 'airport'"; So, in this case, the user could either search for "Delta KATL" in the main keyword search, or fill out two separate boxes - "Delta" in the airline box and "KATL" in the airports box. How would I merge the two specific searches (airline and airport)? $query = "SELECT * FROM `tags` WHERE (`tag` = 'KATL' AND `tag_type` = 'airport') OR (`tag` = 'Delta' AND `tag_type` = 'airline')"; So, main question: How to provide keyword searching based on multiple table rows in a tag table. Any ideas?
  4. I'm putting a resolved on this, because I decided building it differently would be best - now it will show different headers for each nursery class, followed by the dates they are serving on.
  5. Ok, I have been asked by my church to write a website to allow people to sign up for childcare (especially infant and toddler nursery). I've got all my databases setup - basically, they are like this: infants_0900 date (mm/dd/yy) - adult_1 - adult_2 - adult_3 - teen the user id (for example, we will use 28 as the user id) is placed in the adult_1, 2, 3, or the teen cell when they sign up to work in that spot. So, as you can see, each week, there are for helpers - 3 adults, and one teen. There are four of those tables, infants_0900, infants_1045, toddlers_0900, toddlers_1045 . The numbers are for the service times (9:00am and 10:45am). Now, I am also hoping to later on be able to let an admin add more classes (say, a 2nd grade class, with two adults), so I want to keep each table setup the same, with the same column names, etc. But, I have run into a problem. Lets say a volunteer has signed up in all four of the nursery classes, but now wants to know when and where they are working. I'm writing a page to grab the date entry in the table wherever adult_1, 2,3 or teen has their user id. $q = "SELECT `date`, `teen` FROM infants_0900 WHERE teen = $userid ORDER BY date"; Now, I am running that query on all four tables. I could go ahead and print the results from all of them on the page. However, they would not be ordered by the date, but ordered by the table it came out of, then by the date. For instance, I grab the data from infants_0900 first, then infants_1045. Lets say on 07/07/08 the user is working in infants_0900. On 06/07/08, they are working in infants_1045. Well, if I print the results from infants_0900 then infants_1045, the dates will appear as: 07/07/08 - Infants 9:00 06/07/08 - Infants 10:45 So, I'm thinking I need to merge all the results from the queries, then somehow sort them by the date column. I cannot join all or union on MySQL, because all the table structures are exactly the same - only the table names are different. Help! Thanks! Let me know if I need to be more clear on something. I can also post the code, if that would help.
  6. the site is at: http://ecpcsm.lumeriagroup.net index.php file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <p>Instructions:<br /> This web interface has all the songs we have in the database. You can edit the songs by clicking on them, making the changes, and then pressing the "save" button. (Not implemented yet)</p> <p>To create a song, click here. (Not implemented yet) </p> <p>Below is a list of the songs in the OpenSong database (yes, I know they need to be alphabetized):</p> <p> <?php if ($handle = opendir('Songs')) { //sum up all the files in the directory while (false !== ($file = readdir($handle))) { //filter out the "." and ".." if ($file != "." && $file != ".." && $file != "_cache") { echo "<a href='showsong.php?song=$file'>"; echo ($file); echo "</a><br><br>"; } } closedir($handle); } ?> </p> </body> </html> showsong.php file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $song = "Songs/" . $_GET['song']; //$song = "place.xml"; $xml_file = file_get_contents($song); $xml = new SimpleXMLElement($xml_file); echo "<b>" . $xml->title . "</b>" . "<br><br>"; echo "Presentation order:<br>" . $xml->presentation . "<br>(If empty, then program runs straight through)<br><br>"; echo nl2br($xml->lyrics); ?> </body> </html> Sample XML file: <?xml version="1.0" encoding="UTF-8"?> <song> <title>Isaiah 43</title> <author></author> <copyright></copyright> <presentation>v1 c v2 c</presentation> <ccli></ccli> <capo print="false"></capo> <key></key> <aka></aka> <key_line></key_line> <user1></user1> <user2></user2> <user3></user3> <theme></theme> <tempo></tempo> <time_sig></time_sig> <lyrics>[v1] When you pass through the waters, I will be with you And the waves, will not overcome you Do not fear, for I have redeemed you I have called you by name, you are Mine [c] For I am the Lord your God I am the Lord your God I am the Holy One of Israel, your Savior I am the Lord (Do not fear) [v2] When you pass through the fire, you'll not be hurt And the flames will not consume you Do not fear, for I have redeemed you I have called you by name, you are Mine</lyrics></song> You can see all the whitespace, and the spaces before each line of lyrics. I need those preserved. As you can see in the website, it doesnt do that for me. The song files can be accessed under /Songs/[filename].xml Thanks!
  7. One problem - in the XML file, it has a space before certain lines (very important). How can I get PHP to show those spaces before the lines?
  8. Hi, I have an XML file I'm importing, and it needs to preserve the whitespace. Is there a way to do this in SimpleXML? I am having PHP open and display an XML file that shows song lyrics. Obviously, I need the paragraphs to remain intact, or else everything runs together. And I cannot edit the XML file, as a program uses it. Also, how would the below code work out in DOMXML? I couldn't for the life of me, figure out DOM. <?php $song = 'song.xml'; $xml_file = file_get_contents($song); $xml = new SimpleXMLElement($xml_file); echo $xml->title . "<br><br>"; echo $xml->lyrics; ?> The XML file looks like this: <?xml version="1.0" encoding="UTF-8"?> <song> <title>Song Name</title> <lyrics> Verse one Verse two Verse three Chorus </lyrics> </song> I need the whitespace between the verses to stay, when it displays in HTML.
  9. This looks good: http://www.sitepoint.com/article/management-system-php/3 I'll follow that tut (obviously changing it to what I need). I guess I'll post in the PHP Help if I need help. But, let me know if you guys think of a better way to do this project!!
  10. Well, I'm using PHP 5. I can't seem to find a good, decent tutorial on importing XML files. Some seem outdated, only for PHP 4, and the new ones for PHP 5 are so vague. I'll keep looking though. I'll be hosting this on my own server.
  11. First, this is the first PHP project of the sort I've come up with. So, I'm a noob. :-) Ok, the basics of what this project will be: My church uses a program to display the slides for the words to the music that uses a XML files to store the songs. Its a great system (program is called OpenSong), and we haven't run into any problems until now. See, we have several computers (four or five) that all have the program installed. We want them all to have all the song files, all the same version. We might catch a mistake in one file, and update it on one computer, but then we have to take the file to all the other computers via USB stick, and change them. The list gets very, very long after a few weeks. Not to mention the new songs we make. So, I was wondering if I could build a PHP application that would store all the XML files, and I could make a very simple web front end to edit those files. Then, I could tell it to zip up and download all the songs (current versions), and extract those songs into the songs folder on the hard drive. I know its possible. Just... how do I go about using it? I don't need any user authentication. Just a main page that lets you zip up and download the songs, and also has a dynamic text area with all the names of the songs, where you can select one and edit it. Or, I could have a link to another page, which generates hard links to the files, and from there I can click on them. Either way. I would also need a feature to create more songs from a blank template (with all the basic XML tags filled in already). My idea: <main page> Main page lets you d/l the zip file and links to list page and links to create song page </main page> <list page> PHP opens the song folder on the server, and generates hard links to every song file. When you click on the file, it sends you to edit page. </list page> <edit page> Page that shows forms, already filled in with the song information and lyrics. You can edit as needed, and save </edit page> <create song page> similar to edit song, but imports the blank file, and lets you edit, then saves as the title name </create song page> One catch is that the song files are XML without the XML extension. When I open them in notepad, I see the XML tags, etc, but they do not have file extensions. Any suggestions?? Just want to make sure I'm on the right track here! Thanks!
  12. I *think* this should work.... just replace from <embed> to </embed> in your code with this: <embed src="http://www.britepic.com/britepic.swf" FlashVars="id=305546&src=<?php echo(urlencode($photo.imgsrc_photo));?>&width=500&height=600"allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" height="500" width="600"> </embed> You will have 4 flash vars: id (which is set to 305546 in here) src (which is the php variable) width (which is set to 500) height (which is set to 600) From what I could tell, you wanted all those variables, right? If you don't want any, just move them after the Flashvars="[content]" block. The example below doesn't have the height and width variables... they are listed as separate embed parameters (although, you already had those listed as the very last parameters, so they now are conflicting). <embed src="http://www.britepic.com/britepic.swf" FlashVars="id=305546&src=<?php echo(urlencode($photo.imgsrc_photo));?>" width="500" height="600" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" height="500" width="600"> </embed>
×
×
  • 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.