Jump to content

bagpiperdude90

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by bagpiperdude90

  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>
  13. not sure what SEO is... but I guess you're talkin about search engines? I have some sites, based on this format: www.domain.com/index.php?page=about www.domain.com/index.php?page=contact etc Google picks up all the pages fine for me. If you think about it, a lot of forums use the same type of include, but include text from databases. For instance, the format could be: www.domain.com/forum/viewtopic.php?1190428&forum=3 Now, do a google search for a topic you might find in a forum, and then click on the result. Look at the address; 99 out of 100 times it'll be the type of format I just printed. Also, PHP only sends HTML to the web browser, or the search engine. So the engine just treats it as a normal page.
  14. hmm, thats odd. I tried "working offline" in IE, and it printed fine the first time. The second time it didn't work. Any ideas?
  15. This is (part of) the code that needs to go in your HTML or PHP page. I've only included the first part of the embed tag; I assume you know everything else: <EMBED src="[flashmovie].swf" FlashVars="myFlashVar=<?php echo(urlencode($myPHPVar));?>&myFlashVar2=<?php echo(urlencode($myPHPVar2));?>" Hopefully that should work! Make sure you add a dynamic text area in flash, and the variable name should match the flash variable (i.e. "myFlashVar" or "myFlashVar2".
  16. hmm... I was doing the same exact thing. [site]/index.php?show=[pagename] I tried telling it to include a page from another site of mine, but it wouldn't show any of the text in there. Another thing to note, is that if you have any .htaccess password protected areas, you can be smart with the includes and include files inside the .htaccess without logging in. And its simple to find out what the .htaccess directory is... almost certainly it's one of the ones listed in the "robots.txt." file they'll have. Just for the noobs of us who don't know too much.
  17. First off, I'm new here. I did do a search, and didn't see anything like the problem I'm having. Ok, I've developed a website that somebody asked me to make, more as a joke than anything else. I've only gotten the PHP script working - haven't started on the site design yet. Open up IE 7 (maybe 6 and before do this to; I'm not sure. I only KNOW that firefox WORKS, and IE 7 does NOT work). Here's the site: http://www.mancardmaker.com Go to the second page in, and enter in some info (you don't have to do all of it - just a random first name and a random last name). Also, in the Image URL box, put in "boy.png". Hit submit. Ok, so obviously the name(s) and the boy image were created using variables passed from another page. The date and date expires text was created using some php code, not using variables. Ok, now print the page. If you were in IE7, only the base image and the dates and the commas will print. Those were overlayed exactly the same as all the other text, though. In fact, the "[Last name], [First name]" is all compiled into one variable, and then printed. However, the source of the first and last names came from variables, and the source of the comma came from a static declaration. Here's the code I'm talking about: // gets first and last name from form from previous page $fname = $_POST['fname']; $lname = $_POST['lname']; //Put last and first name into new variable, with ", " inbetween. $name = "$lname" . ", " . "$fname"; // Took out some irrelevant code // Here's the code to display the image $img_handle = imageCreateFromPNG("mancard.png"); $color = ImageColorAllocate ($img_handle, 100, 100, 100); //and to write that $name variable ImageString ($img_handle, 3, 7, 80, "$name", $color); //then more code is below to actually display image, and to overlay the ID photo the user provides Now, when it prints out in IE7, the original $fname and $lname variables don't come through the print. However, the ", " declared in $name does print. Also, if you right click and "print image" or even just "save image" in IE7, it doesn't display the original strings in $fname and $lname. In firefox, it works perfectly. Not sure about Safari or Opera. Any ideas? It's obviously something about losing all the form data, maybe IE7 is regenerating the picture when it prints it? Thanks for the help!
  18. ah! that did a clear up a few things. I'm working on writing my own version, changing one or two things, and stuff. Thanks for the help! I'll post the code when I'm done for any suggestions.
  19. [quote author=spfoonnewb link=topic=124234.msg514492#msg514492 date=1169859877] [/quote] ;D :o wow. Talk about a helpful forum. Thanks a ton dude! I'll try it out and see how it goes, and post here once i try it! I'll probably try to re-write it, just so i can learn how you did it. Again, thanks a lot!!!
  20. Ok, this is probably fairly simple - but I'm taking my first steps in PHP. Basically, I want to create a form for 12 to 15 people sign up for specific jobs. There are 6 jobs, plus a backup person for each job (so a total of 12 jobs). I want to have a PHP script that will access the MySQL database. There will be a form on an html page that will pass the info to the php page. (I've gotten this far). The form is very basic - it only has: " Enter your name to sign up for a job, and then hit submit. Job 1: [box to enter name] Job 1 Backup: [box to enter name] Job 2: [box to enter name] Job 2 Backup: [box to enter name] (4 more lines, for a total of 6 lines) [submit] " Now, there needs to be one page per month. Once somebody enters their name, i want the text input area for that job to disappear and show the persons name, with a little "edit" link, in case they need to remove their name from the list. Obviously null needs to be displayed with a text box, but anything other than null needs to show the contents of the spot in the table. Like I said, I need one of these per month. It would be nice to have it automatically change to the next month's form and erase the database after each month. I don't need any user authentication or anything of the sort - these people are trustworthy and won't be changing each other's entries. Any login or authentication would just complicate the whole process. I know how to communicate and create tables and databases with PHP and MySQL - I just don't have a clue about the rest. I'm reading up on PHP right now, but it would be nice to get this sign up thing ready soon. Thanks for any info, links to tutorials, or encouragement!
×
×
  • 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.