Jump to content

Rogue3

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by Rogue3

  1. I'm trying to get a collectors database up and running based on the OpenDB platform. The OpenDB (Open Media Collectors Database) platform was built to collect media such as DVDs. I'm trying to modify it to work with other collectibles. I've got most of it modified, but I'm at the point where some slightly more advanced code editing is due, and I'm not figuring it out. Right now, it is set up where you can import your database from a file such as excel, and it will propogate the database based on what fields you match up. It puts them all on a nice item listing page as seen here: http://www.jeditemplearchives.com/hasbrodb/item_display.php?item_id=51&instance_no=1 I'd like to take it a small step further. I'd like to add a column to that layout, on the right side. The column would span the total height of the rows (so, one cell) and would house a large image, likely a fixed size. This image would simply be a database link entry, so it pulls up the image (it already does this for thumbnails associated with the entry). Here is my mock-up of exactly what I'm talking about: http://www.jeditemplewarroom.com/images/database-mockup.jpg So, i'm thinking that what I would need is a single cell in that location that you can assign a field value to. Then, when I do my import any item (in my case a link of an image) will propogate that field. I'm not sure which files would be edited, but I'd be willing to zip up the whole package and email it to someone. I hope someone can help me out here!
  2. I'm sorry, I must have mistook the title of this forum for 'help'. I'm about as far as I can get on this, which is why I came here.
  3. I use a simple image gallery for new images on our news site. I'd like to add a 'previous' and 'next' link at the top that automatically goes to the next image in the list (or previous image) to make it easy for viewers to pan through new images. Currently, they have to keep going back to view the next image. Here is our image gallery: http://www.jeditemplearchives.com/news/images2007b/images.php?image=27 Here is the code for our php file: <HTML> <LINK REL=STYLESHEET HREF="/sitetext.css" TYPE="text/css"> <HEAD> <TITLE>Jedi Temple Archives Image Gallery</TITLE> <style type="text/css"> <!-- body { background-image: url(/images/fill-blue.gif); } --> </style> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </HEAD> <BODY leftmargin="0" topmargin="0" rightmargin="0" onLoad="MM_preloadImages('../../images/goback_on.gif')" > <span class="class6"> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" background="/images/banner-background-top.gif"> <tr> <td height="12"><img src="/images/blank.gif" width="5" height="12"></td> </tr> </table> <TABLE width="100%" border="0" cellpadding="5" cellspacing="0" background="/images/banner-background-mid.gif" > <TR> <TD height="85"><div align="center"><a href="/"><img src="/images/banner-logo.gif" width="408" height="65" border="0"></a></div></TD> </TR> </TABLE> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" background="/images/banner-background-bot.gif"> <tr> <td height="7"><img src="/images/blank.gif" width="5" height="5"></td> </tr> </table> <CENTER> <img src="../../images/spacer.gif" width="1" height="10"><br> <TABLE border="0" cellpadding="0" cellspacing="0" width="200"> <TR > <TD height="27" align="center"><div align="center"></div> <div align="center"><a href="#" onClick="history.back();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','/images/goback_on.gif',1)"><img src="/images/goback_off.gif" name="Image6" width="68" height="27" border="0"></a></div></TD> </TR> </TABLE> <img src="/images/spacer.gif" width="1" height="10"> </CENTER> <table border="2" align="center" bordercolor="#003333"> <tr> <TD align="center" > <font size=3 face="arial" color="#CCCCCC"> <?php if ($image == "01") { print ("<img src='/news/images2007b/koto-20070718-01.jpg'>"); } elseif ($image == "02") { print ("<img src='/news/images2007b/koto-20070718-02.jpg'>"); } elseif ($image == "03") { print ("<img src='/news/images2007b/koto-20070718-03.jpg'>"); } elseif ($image == "04") { print ("<img src='/news/images2007b/koto-20070718-04.jpg'>"); } elseif ($image == "05") { print ("<img src='/news/images2007b/koto-20070718-05.jpg'>"); } elseif ($image == "06") { print ("<img src='/news/images2007b/koto-20070718-06.jpg'>"); } elseif ($image == "07") { print ("<img src='/news/images2007b/koto-20070718-07.jpg'>"); } elseif ($image == "08") { print ("<img src='/news/images2007b/koto-20070718-08.jpg'>"); } elseif ($image == "09") { print ("<img src='/news/images2007b/koto-20070718-09.jpg'>"); } elseif ($image == "10") { print ("<img src='/news/images2007b/koto-20070718-10.jpg'>"); } elseif ($image == "11") { print ("<img src='/news/images2007b/koto-20070718-11.jpg'>"); } elseif ($image == "12") { print ("<img src='/news/images2007b/koto-20070718-12.jpg'>"); } elseif ($image == "13") { print ("<img src='/news/images2007b/koto-20070718-13.jpg'>"); } elseif ($image == "14") { print ("<img src='/news/images2007b/koto-20070718-14.jpg'>"); } elseif ($image == "15") { print ("<img src='/news/images2007b/koto-20070718-15.jpg'>"); } elseif ($image == "16") { print ("<img src='/news/images2007b/koto-20070718-16.jpg'>"); } elseif ($image == "17") { print ("<img src='/news/images2007b/hasbro-20070719a.jpg'>"); } elseif ($image == "18") { print ("<img src='/news/images2007b/hasbro-20070719b.jpg'>"); } elseif ($image == "19") { print ("<img src='/news/images2007b/hasbro-20070719c.jpg'>"); } elseif ($image == "20") { print ("<img src='/news/images2007b/koto-70070723a.jpg'>"); } elseif ($image == "21") { print ("<img src='/news/images2007b/koto-70070723b.jpg'>"); } elseif ($image == "22") { print ("<img src='/news/images2007b/koto-70070723c.jpg'>"); } elseif ($image == "23") { print ("<img src='/news/images2007b/sdcc-lego.jpg'>"); } elseif ($image == "24") { print ("<img src='/news/images2007b/kiriko-c3po1.jpg'>"); } elseif ($image == "25") { print ("<img src='/news/images2007b/kiriko-c3po2.jpg'>"); } elseif ($image == "26") { print ("<img src='/news/images2007b/kiriko-c3po3.jpg'>"); } elseif ($image == "27") { print ("<img src='/news/images2007b/kiriko-r4p171.jpg'>"); } elseif ($image == "28") { print ("<img src='/news/images2007b/kiriko-r4p172.jpg'>"); } elseif ($image == "29") { print ("<img src='/news/images2007b/kiriko-r4p173.jpg'>"); } else { print ("<p>No image was selected to display</p>"); } ?> </font> </tD> </tr> </table> <p> </p> </BODY> </span> </HTML>
  4. Thank you! It seems I was missing just one '  :-\
  5. Hey, that's even better. I don't know how my id's would get out of order, but at least this way it is definately going to pull what I just entered.
  6. Well, the field that can sometimes be left blank is going to be a searchable field, but not a field that will display on the results page.
  7. [quote]"ORDER BY year;" is a bare string.  You need to enclose it in quotes and concatenate it to the rest of the query string.[/quote] Thanks for the advice. I'm still a beginner at the coding part (hence the failing code :-) ), so can you help me out here?
  8. I did it like this, but I get an error upon search... [code]$query = 'SELECT * FROM guides WHERE CONCAT(series,type,mfg,keywords,year,name) LIKE "%' . implode('%" AND CONCAT(series,type,mfg,keywords,year,name) LIKE "%', preg_split('/\s+/',$_POST['find'])) . '%"' ORDER BY year;[/code]
  9. If I wanted to sort my results by my 'date' field, where would I add that information?
  10. OK, after fiddling around I think I solved it. Since I have my auto-incriment set for the id I just added this along with the LIMIT 1: ORDER BY id DESC
  11. I have a field in my form (varchar(80)) that I don't always enter information for. It's an "additional keyword" field used to put additional keywords for my search form. Right now I have it to where it is just blank, but should I have it set to 'null' if there is no info there? Will this affect the search one way or the other?
  12. I added LIMIT to my query. I now get 1 result, however it is the first result in my table. How do I make it show the one I just entered? Here is what I changed: [code]$query="SELECT * FROM guides LIMIT 1";[/code]
  13. I made a form so that I can add entries into my database, and I need help tweaking the end result a bit. Everything works just fine, the only part I can't figure out is when I enter an item in the database and click my submit button, the page that comes up shows all entries in the database. I'd like it to only show the one I JUST put in (for verification purposes). Here is my code: [code]mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM mytable"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>JTA Database Entry</center></b><br><br>"; $i=0; while ($i < $num) { $series=mysql_result($result,$i,"series"); $type=mysql_result($result,$i,"type"); $mfg=mysql_result($result,$i,"mfg"); $year=mysql_result($result,$i,"year"); $name=mysql_result($result,$i,"name"); $link=mysql_result($result,$i,"link");[/code]
  14. BINGO! I was forgetting the result line: while($result = mysql_fetch_array( $data )) It is working now... finally! Thank you for all your help!
  15. Ok, getting closer.... I didn't get the 'no results' this time, I just got a blank result. Here is the code as I have it now... this is all directly below my database information. Also, right now I only have 7 entries in my database until I hash this search out. So, some search terms (for testing) that should bring back results: luke leia skywalker luke skywalker vintage (this one should bring back all results so far) [code]$find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //search criteria $query = 'SELECT * FROM guides WHERE CONCAT(series,type,name) LIKE "%' . implode('%" AND CONCAT(series,type,name) LIKE "%', preg_split('/\s+/',$_POST['find'])) . '%"';  $data = mysql_query($query); { echo $result['series']; echo " "; echo $result['type']; echo "<br>"; echo $result['link']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> [/code]
  16. Thanks for all your help. I will try this again. Sorry, i'm a bit new to some of this. But, i'm getting it, slowly but surely!
  17. Where is 'term1' and 'term2' defined? It seems that no matter what I put in my search I come back with no results.
  18. OK, that is getting me closer. However, I'm a bit confused on which items I need to substitute my own variables in. So, from here: whatever_field LIKE '%term1%' OR whatever_field LIKE '%term2%' do I replace the 'whatever_field' with the name of my fields from my table? I have 3 different fields I want to make part of the search, so do I have another 'OR' in there? Also, the '%term1%', is this a variable that I need to change too? Here is my form code: <form name="search" method="post" action="/search/search.php"> Seach for: <input type="text" name="find" />           <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> There's no choice for different fields to search, it's just a single search box. My fields in my table that I want to search are 'series' , 'type' , and 'name'
  19. That would explain why i'm getting all my results! Can you show me where I would put the "where" clause in the above strings?
  20. I'm trying to create a search engine for my mysql database. I think i'm pretty close. I made a search form, but no matter what I type in I get a list of ALL items in my database. I'm wanting it to only return results that include ALL search terms. Here is the code I think is hanging me up: $data = mysql_query("SELECT * FROM `guides`"); while($result = mysql_fetch_array( $data ))  Here is my search page: http://jeditemplearchives.com/search/ Can anyone offer any help here?
×
×
  • 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.