Jump to content

poleposters

Members
  • Posts

    244
  • Joined

  • Last visited

    Never

Everything posted by poleposters

  1. This is a simplified version of a script I'm using. I select records from a database and print them inside a buffer. Then I output the buffer to the included template.php file. $query="SELECT * FROM location WHERE type='1'"; $result=mysql_query($query); if(mysql_num_rows($result)>0) { ob_start(); while($selectlinks=mysql_fetch_array($result)) { $name=$selectlinks['name']; $address=$selectlinks['address']; $lat=$selectlinks['lat']; $lng=$selectlinks['lng']; print "$name,$address,$lat,"; } $output=ob-get_clean(); } include("template.php"); I'm adding a new feature to the script which requires that I output the retrieved records to be also used as part of some javascript in the head of the template.php file. Specifically I want to write this piece of javascript for each record returned. var marker = new GMarker(new GLatLng([b]lat[/b], [b]lng[/b])); GEvent.addListener(marker, "click", function() { var html= '[b]name[/b]<br />[b]address[/b]'; marker.openInfoWindowHtml(html); }); map.addOverlay(marker); Whats the best way to do this? Is it possible to create two separate buffers using the single query and then just outputting one to the body of the template and one to the head?
  2. Hi, I've been using phpmyadmin to import a csv file containg data for 10 columns. And only after the fact have I realised that I need a unique key column at the beginning of the table. Is this possible through phpmyadmin? Thanks. matt
  3. Thank you both. I've investigated both methods. Just have to choose the best one for my site. Great point on checking that they've actually come across the page from a search page. I wouldn't of thought of that. Is that also a javascript method? I'm not too good with javascript.
  4. Hi all. I have simple search feature on my site that displays a series of listings to user profiles. The User profile has the URL www.domain.com/users.php?id=1 What I'd like to do is create a link that (once the viewer is done viewing the user profile) allows them to return to the search results page. Which looks like (depending on what search was performed) www.domain.com/search.php?gender=male&age=22&language=english Is there a way to do this? If I haven't been clear, please let me know. Its been a long day. Thanks in advance.
  5. Hi all, I'm in a pickle. I've been using this great chained select script and it works perfectly fine. Except since I've rewritten my site with flat URLs its playing up. This script sets a cookie to make the value of the menus persistent. It saves the cookie to the current page path. Except now that I have flat URLs the current page path will always have differing values(dynamic). I'd like to change the script to accomodate flat URLS or make the persistance sitewide. The catch is that my grasp of javascript is very basic at the moment. So if anyone can help or point me in the right direction it would be greatly appreciated. thankyou. // Chained Selects // Copyright Xin Yang 2004 // Web Site: www.yxScripts.com // EMail: m_yangxin@hotmail.com // Last Updated: Jan. 31, 2009 // This script is free as long as the copyright notice remains intact. var _disable_empty_list=false; var _hide_empty_list=false; // ------ if (typeof(disable_empty_list)=="undefined") { disable_empty_list=_disable_empty_list; } if (typeof(hide_empty_list)=="undefined") { hide_empty_list=_hide_empty_list; } var cs_goodContent=true, cs_M="M", cs_L="L", cs_G="G", cs_EG="EG"; var cs_names=new Array(); var cs_supportDOM=document.createElement; var cs_nav=navigator.userAgent.toLowerCase(); var cs_isIE7=(cs_nav.indexOf("msie 7")!=-1 || cs_nav.indexOf("msie 8")!=-1); var cs_isOpera=(cs_nav.indexOf("opera")!=-1); var cs_isMac=(cs_nav.indexOf("mac")!=-1); function cs_findOBJ(obj,n) { for (var i=0; i<obj.length; i++) { if (obj[i].name==n) { return obj[i]; } } return null; } function cs_findContent(n) { return cs_findOBJ(cs_content,n); } function cs_findSubContent(n) { return cs_findOBJ(cs_subContent,n); } function cs_findM(m,n) { if (m.name==n) { return m; } var sm=null; for (var i=0; i<m.items.length; i++) { if (m.items[i].type==cs_M) { sm=cs_findM(m.items[i],n); if (sm!=null) { break; } } } return sm; } function cs_subContentOBJ(n,list) { this.name=n; this.list=list; this.ifm=document.createElement("IFRAME"); with (this.ifm.style) { position="absolute"; left="-200px"; top="-200px"; visibility="hidden"; width="100px"; height="100px"; } document.body.appendChild(this.ifm); this.ifm.src=n; }; cs_subContent=new Array(); function cs_contentOBJ(n,obj){ this.name=n; this.menu=obj; this.lists=new Array(); this.cookie=""; this.callback=null; this.count=1; }; cs_content=new Array(); function cs_topmenuOBJ(tm) { this.name=tm; this.type=cs_M; this.items=new Array(); this.df=","; this.oidx=0; this.addM=cs_addM; this.addL=cs_addL; this.addG=cs_addG, this.endG=cs_endG; } function cs_submenuOBJ(dis,link,sub,label,css) { this.name=sub; this.type=cs_M; this.dis=dis; this.link=link; this.label=label; this.css=css; this.df=","; this.oidx=0; this.addM=cs_addM; this.addL=cs_addL; this.addG=cs_addG, this.endG=cs_endG; if (typeof(cs_names[sub])=="undefined") { this.items=new Array(); cs_names[sub] = this; } else { this.items = cs_names[sub].items; } } function cs_linkOBJ(dis,link,label,css) { this.type=cs_L; this.dis=dis; this.link=link; this.label=label; this.css=css; } function cs_groupOBJ(label,css) { this.type=cs_G; this.dis=""; this.link=""; this.label=label; this.css=css; } function cs_groupOBJ2() { this.type=cs_EG; this.dis=""; this.link=""; this.label=""; } function cs_addM(dis,link,sub,label,css) { var x=new cs_submenuOBJ(dis,link,sub,label,css); this.items[this.items.length]=x; } function cs_addL(dis,link,label,css) { this.items[this.items.length]=new cs_linkOBJ(dis,link,label,css); } function cs_addG(label,css) { this.items[this.items.length]=new cs_groupOBJ(label,css); } function cs_endG() { this.items[this.items.length]=new cs_groupOBJ2(); } function cs_showMsg(msg) { window.status=msg; } function cs_badContent(n) { cs_goodContent=false; cs_showMsg("["+n+"] Not Found."); } function _setCookie(name, value) { document.cookie=name+"="+value; } function cs_setCookie(name, value) { setTimeout("_setCookie('"+name+"','"+value+"')",0); } function cs_getCookie(name) { var cookieRE=new RegExp(name+"=([^;]+)"); if (document.cookie.search(cookieRE)!=-1) { return RegExp.$1; } else { return ""; } } function cs_optionOBJ(type,text,value,label,css) { this.type=type; this.text=text; this.value=value; this.label=label; this.css=css; } function cs_getOptions(menu,list) { var opt=new Array(); for (var i=0; i<menu.items.length; i++) { opt[i]=new cs_optionOBJ(menu.items[i].type, menu.items[i].dis, menu.items[i].link, menu.items[i].label, menu.items[i].css); } if (opt.length==0 && menu.name!="") { cs_getSubList(menu.name,list); opt[0]=new cs_optionOBJ(cs_L, "loading ...", "", "", ""); } return opt; } function cs_emptyList(list) { if (cs_supportDOM && !cs_isMac && !cs_isIE7) { while (list.lastChild) { list.removeChild(list.lastChild); } } else { for (var i=list.options.length-1; i>=0; i--) { list.options[i]=null; } } } function cs_refreshList(list,opt,df,key) { var l=list.options.length; var optGroup=null, newOpt=null, optCount=0, optPool=list; if (cs_isMac) { var l=list.options.length; var iCount=0; for (var i=0; i<opt.length; i++) { if (opt[i].type!=cs_G && opt[i].type!=cs_EG) { iCount=l+optCount; list.options[iCount]=new Option(opt[i].text, opt[i].value, df.indexOf(","+optCount+",")!=-1, df.indexOf(","+optCount+",")!=-1); list.options[iCount].oidx=optCount; list.options[iCount].idx=i; list.options[iCount].key=key; if (opt[i].label!="") { list.options[iCount].label=opt[i].label; } if (opt[i].css!="") { list.options[iCount].className=opt[i].css; } optCount++; } } return; } for (var i=0; i<opt.length; i++) { if (opt[i].type==cs_G) { optGroup=document.createElement("optgroup"); optGroup.setAttribute("label", opt[i].label); if (opt[i].css!="") { optGroup.setAttribute("className", opt[i].css); } list.appendChild(optGroup); optPool=optGroup; } else if (opt[i].type==cs_EG) { optGroup=null; optPool=list; } else { newOpt=new Option(opt[i].text,opt[i].value); if (cs_supportDOM && !cs_isIE7) { optPool.appendChild(newOpt); } else { list.options[l+optCount]=newOpt; } newOpt.oidx=optCount; newOpt.idx=i; newOpt.key=key; // a workaround for IE, but will screw up with Opera if (!cs_isOpera) { newOpt.text=opt[i].text; newOpt.value=opt[i].value; } if (df.indexOf(","+optCount+",")!=-1) { newOpt.selected=true; } if (opt[i].label!="") { newOpt.label=opt[i].label; } if (opt[i].css!="") { newOpt.className=opt[i].css; } optCount++; } } } function cs_getList(content,key) { var menu=content.menu; if (key!="[]") { var paths=key.substring(1,key.length-1).split(","); for (var i=0; i<paths.length; i++) { menu=menu.items[parseInt(paths[i],10)]; } } return menu; } function cs_getKey(key,idx) { return "["+(key=="[]"?"":(key.substring(1,key.length-1)+","))+idx+"]"; } function cs_getSelected(mode,name,idx,key,df) { if (mode) { var cookies=cs_getCookie(name+"_"+idx); if (cookies!="") { var mc=cookies.split("-"); for (var i=0; i<mc.length; i++) { if (mc[i].indexOf(key)!=-1) { df=mc[i].substring(key.length); break; } } } } return df; } function cs_updateListGroup(content,idx,mode) { var menu=null, list=content.lists[idx], options=list.options, has_sublist=false; var key="", option=",", cookies=""; //if (list.selectedIndex<0) { // list.selectedIndex=0; //} for (var i=0; i<options.length; i++) { if (options[i].selected) { if (key!=options[i].key) { cookies+=key==""?""(cookies==""?"":"-")+key+option); key=options[i].key; option=","; menu=cs_getList(content,key); } option+=options[i].oidx+","; if (idx+1<content.lists.length) { if (menu.items.length > options[i].idx && menu.items[options[i].idx].type==cs_M) { if (!has_sublist) { has_sublist=true; cs_emptyList(content.lists[idx+1]); } var subkey=cs_getKey(key,options[i].idx), df=cs_getSelected(mode,content.cookie,idx+1,subkey,menu.items[options[i].idx].df); cs_refreshList(content.lists[idx+1],cs_getOptions(menu.items[options[i].idx],list),df,subkey); } } } } if (key!="") { cookies+=(cookies==""?"":"-")+key+option; } if (content.cookie) { cs_setCookie(content.cookie+"_"+idx,cookies); } if (has_sublist && idx+1<content.lists.length) { if (disable_empty_list) { content.lists[idx+1].disabled=false; } if (hide_empty_list) { content.lists[idx+1].style.display="block"; } cs_updateListGroup(content,idx+1,mode); } else { for (var s=idx+1; s<content.lists.length; s++) { cs_emptyList(content.lists[s]); if (disable_empty_list) { content.lists[s].disabled=true; } if (hide_empty_list) { content.lists[s].style.display="none"; } if (content.cookie) { cs_setCookie(content.cookie+"_"+s,""); } } } } function cs_initListGroup(content,mode) { var key="[]", df=cs_getSelected(mode,content.cookie,0,key,content.menu.df); cs_emptyList(content.lists[0]); cs_refreshList(content.lists[0],cs_getOptions(content.menu,content.lists[0]),df,key); cs_updateListGroup(content,0,mode); } function cs_updateList() { var content=this.content; for (var i=0; i<content.lists.length; i++) { if (content.lists[i]==this) { cs_updateListGroup(content,i,content.cookie); if (content.callback) { var opt=""; for (var j=0; j<this.options.length; j++) { if (this.options[j].selected) { if (opt!="") { opt+=","; } if (this.options[j].value!="") { opt+=this.options[j].value; } else if (this.options[j].text!="") { opt+=this.options[j].text; } else if (this.options[j].label!="") { opt+=this.options[j].label; } } } content.callback(this,i+1,content.count,opt); } if (this.handler) { this.handler(); } break; } } } function cs_getSubList(n,list) { if (cs_goodContent && cs_supportDOM) { var cs_subList=cs_findSubContent(n); if (cs_subList==null) { cs_subContent[cs_subContent.length]=new cs_subContentOBJ(n,list); } } } function cs_updateSubList(cn,sn) { var cc=cs_findContent(cn), sc=cs_findContent(sn); if (cc!=null && sc!=null) { var cs_sub=cs_findM(cc.menu,sn); if (cs_sub!=null) { cs_sub.df=sc.menu.df; cs_sub.oidx=sc.menu.oidx; cs_sub.items=sc.menu.items; } } var cs_subList=cs_findSubContent(sn); if (cs_subList!=null) { cs_subList.list.onchange(); cs_subList.ifm.src=""; document.body.removeChild(cs_subList.ifm); cs_subList.ifm=null; } } // ------ function addListGroup(n,tm) { if (cs_goodContent) { cs_names[tm]=new cs_topmenuOBJ(tm); var c=cs_findContent(n); if (c==null) { cs_content[cs_content.length]=new cs_contentOBJ(n,cs_names[tm]); } else { delete(c.menu); c.menu=cs_names[tm]; } } } function addList(n,dis,link,sub,df,label,css) { if (typeof(sub)=="undefined" || sub=="") { addOption(n,dis,link||"",df||"",label||"",css||""); } else if (cs_goodContent) { if (typeof(cs_names[n])!="undefined") { cs_names[n].addM(dis,link||"",sub+"",label||"",css||""); if (typeof(df)!="undefined" && df) { cs_names[n].df+=cs_names[n].oidx+","; } cs_names[n].oidx++; } else { cs_badContent(n); } } } function addOption(n,dis,link,df,label,css) { if (cs_goodContent) { if (typeof(cs_names[n])!="undefined") { cs_names[n].addL(dis,link||"",label||"",css||""); if (typeof(df)!="undefined" && df) { cs_names[n].df+=cs_names[n].oidx+","; } cs_names[n].oidx++; } else { cs_badContent(n); } } } function addOptGroup(n,label,css) { if (cs_goodContent && cs_supportDOM && !cs_isOpera) { if (typeof(cs_names[n])!="undefined") { cs_names[n].addG(label,css||""); } else { cs_badContent(n); } } } function endOptGroup(n) { if (cs_goodContent && cs_supportDOM && !cs_isOpera) { if (typeof(cs_names[n])!="undefined") { cs_names[n].endG(); } else { cs_badContent(n); } } } function initListGroup(n) { var _content=cs_findContent(n), count=0; if (_content!=null) { var content=new cs_contentOBJ("cs_"+_content.count+"_"+n,_content.menu); content.count=_content.count++; cs_content[cs_content.length]=content; for (var i=1; i<initListGroup.arguments.length; i++) { if (typeof(arguments[i])=="object" && arguments[i].tagName && arguments[i].tagName=="SELECT") { content.lists[count]=arguments[i]; arguments[i].handler=arguments[i].onchange; arguments[i].onchange=cs_updateList; arguments[i].content=content; arguments[i].idx=count++; } else if (typeof(arguments[i])=="string" && /^[a-zA-Z_]\w*$/.test(arguments[i])) { content.cookie=arguments[i]; } else if (typeof(arguments[i])=="function") { content.callback=arguments[i]; } else { cs_showMsg("Warning: Unexpected argument in initListGroup() for ["+n+"]"); } } if (content.lists.length>0) { cs_initListGroup(content,content.cookie); } } } function initListGroups(n) { var listCount=0; for (var i=1; i<initListGroups.arguments.length; i++) { // opera takes select array as function if ((typeof(arguments[i])=="object" || typeof(arguments[i])=="function") && arguments[i].length && typeof(arguments[i][0])!="undefined" && arguments[i][0].tagName && arguments[i][0].tagName=="SELECT") { if (listCount>arguments[i].length || listCount==0) { listCount=arguments[i].length; } } } var _content=cs_findContent(n), count=0, content=null; if (_content!=null) { for (var l=0; l<listCount; l++) { count=0; content=new cs_contentOBJ("cs_"+_content.count+"_"+n,_content.menu); content.count=_content.count++; cs_content[cs_content.length]=content; for (var i=1; i<initListGroups.arguments.length; i++) { if ((typeof(arguments[i])=="object" || typeof(arguments[i])=="function") && arguments[i].length && typeof(arguments[i][0])!="undefined" && arguments[i][0].tagName && arguments[i][0].tagName=="SELECT") { content.lists[count]=arguments[i][l]; arguments[i][l].handler=arguments[i][l].onchange; arguments[i][l].onchange=cs_updateList; arguments[i][l].content=content; arguments[i][l].idx=count++; } else if (typeof(arguments[i])=="string" && /^[a-zA-Z_]\w*$/.test(arguments[i])) { content.cookie=arguments[i]+"_"+l; } else if (typeof(arguments[i])=="function") { content.callback=arguments[i]; } else { cs_showMsg("Warning: Unexpected argument in initListGroups() for ["+n+"]"); } } if (content.lists.length>0) { cs_initListGroup(content,content.cookie); } } } } function resetListGroup(n,count) { var content=cs_findContent("cs_"+(count||1)+"_"+n); if (content!=null && content.lists.length>0) { cs_initListGroup(content,""); } } function selectOptions(n,opts,mode) { var content=cs_findContent(n); if (content!=null) { var optss=opts.split(":"), menu=content.menu, path=true; for (var i=0; i<optss.length; i+=2) { if (menu.type==cs_M && path) { path=false; for (var o=0; o<menu.items.length; o++) { if (mode==0 && menu.items[o].dis==optss[i] || mode==1 && menu.items[o].link==optss[i] || mode==2 && o==optss[i]) { path=true; if (optss[i+1]!="-") { menu.df=","+o+","; } menu=menu.items[o]; break; } } } } } } // ------
  6. I was afraid someone might mention javascript. Mainly I'd like to make the URLs look clean and tidy and with any luck gain some advantage in SEO. I just had an idea to use an intermediary page to process the form data and spit out a a flat URL to complete the query. ie the form data www.domain.com/blog.php?id=1 is passed to intermediate.php and transfomed and redirected to www.domain/blog/id/1/ where the query is completed. Are there any cons to this method?
  7. Hi, I was wondering if it was possible to generate a flat URL from a from using the method GET. I've had some experience using mod-rewrite to create flat URLs from links e.g www.domain.com/blog/id/1 is interpreted as www.domain.com/blog.php?id=1 But how do I do it the other way around? ie. When I submit a form using the get method its going to generate a messy URL. Can I get the form to generate a flat URL?
  8. Hi, I have a simple order form. It works fine. But I have a feeling that the code is fairly primitive. Already I can see that adding more items to the order form is going to be more work than it should be. The form is just a series of select menus. The user simply selects the number of items they'd like to purchase. This form data is passed to another form which confirms the order before emailing me so that I can fulfill the order. Heres the code for the confirmation page.Is there a better way to right this code? ie not have to rely on each individual select box. There are nine of them at the moment but I can see the list getting bigger. <?php $book=$_POST['book']; $wardrobe=$_POST['wardrobe']; $tea=$_POST['tea']; $archive=$_POST['archive']; $wrap=$_POST['wrap']; $tape=$_POST['tape']; $dispenser=$_POST['dispenser']; $mattress=$_POST['mattress']; $butchers=$_POST['butchers']; ob_start(); print "<h2>You have ordered:</h2>"; print "<ul>"; if($book!=0){print "<li>$book book wine box</li>"; } if($wardrobe!=0){print "<li>$wardrobe wardrobe box</li>"; } if($tea!=0){print "<li>$tea tea chest box</li>"; } if($archive!=0){print "<li>$archive archive box</li>"; } if($wrap!=0){print "<li>$wrap roll of bubble wrap</li>"; } if($tape!=0){print "<li>$tape roll of tape</li>"; } if($dispenser!=0){print "<li>$dispenser tape dispenser</li>"; } if($mattress!=0){print "<li>$mattress mattress protector</li>"; } if($butchers!=0){print "<li>$butchers ream of butcher's paper</li>"; } print "</ul>"; $output=ob_get_clean(); ?>
  9. I have a form and want to replicate a nice feature I saw on another site. When field becomes active the entire fieldset changes background colour to highlight it. So I need to change the fieldset class attribute once the user makes one of the input fields active. I've worked out how to change the class of the controlling element using this: onmouseover="this.className='background'" onmouseout="this.className='' " But I'm lost as to how to make one element control another. Sorry I'm very new to javascript, I hope I'm explaining this adequately. Thanks in advance
  10. I worked it out. I should of been using php's date() function instead.
  11. The query is as follows. $query="INSERT INTO press_releases (press_release_id,press_release_title,press_release,press_release_date) VALUES ('','$title','$press_release','$item_date')"; $result=mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); It works fine if I pick a date. And the query executes if I leave the date field blank. It just doesn't insert curdate()
  12. Hi. I want users to select a date for an entry. However if they fail to select a date, I want to insert the current date as default into the database. Heres my code. if(!empty($_POST['item_date'])) { $item_date=$_POST['item_date']; } else { $item_date="CURDATE()"; } It doesn't want to work. It sets the date to to 1970 instead. Can someone shed some light on what I'm doing wrong? Thanks/.
  13. Hi, Whats the best way to handle a date range in mysql? ie I'm building a list of events. Some of the events can last an entire week rather than one day.e.g September 1 to September 7. Is it possible to store a date range in a single field? Or is conventional apporach to have seperate fields for the start date and the finish date. Any advice is appreciated. Cheers.
  14. I'm using FCK editor and I've come across a problem. If The text i enter includes quote marks. The query fails. I can't figure out why this is happening. FCK editor converts everything to HTML before posting the data. Any ideas?
  15. I can't believe I didn't think of that. I was trying to complicate things. Thank you. Its a very elegant solution.
  16. Hi. I'm tidying up some of my scripts. Is it possible to include a php file with unclosed brackets? I went ahead and created two files. header.php and footer.php because my scripts began and ended the same way. header.php <?php require_once($_SERVER['DOCUMENT_ROOT'].'/mysql_connect.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/config.inc.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/fckeditor/fckeditor.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/ref.php'); session_start(); if(isset($_SESSION['name'])) { ?> footer.php <?php include("console.inc.php"); } else { header("Location:/admin/login.php?ref=12"); } ?> As you can see the files individually have unbalanced braces. But when they combine at the top and bottom of my script they balance out. Are these includes possible?
  17. Hi. I have a form on my site to add videos as well as transcripts of the videos.Its simply a textarea for the transcript and a text input for the video in which I usually copy and paste a youtube embed link. I also have a similar form which edits an existing entry in the database. For convenience I display the transcript as a value of the textarea so that it can be edited rather than re-entered. I want to do the same thing for video, but the problem i've discovered is that if a i print the embed object straight into the value of the text input, the video is displayed rather than the string value. How do I get around this?
  18. Thank you. I made the changes. But its still not behaving correctly. It seems that the less than operator retrieves records before the current blog entry, however starting at the beginning of the database. ie. If the current date is 2009-07-24 it will return the first 2 records in the database which are dated 2009-07-18 and 2009-07-19. Instead I'd like to return 2009-07-22, 2009-07-23. I attempted to address this by adding ORDER BY blog_date DESC to the query. This returns the correct records. But in the wrong order. ie 2009-07-23, 2009-07-22. Any ideas?
  19. Sorry I misunderstood. $blogdate contains 2009-07-25. blog_date from the matching records are 2009-07-24 , 2009-07-23 for previous dates and 2009-07-26, 2009-07-27 for the next dates. I'll be ignoring records from dates that equal $blogdate
  20. I should of mentioned that. $blogdate contains the date of the current blog, retrieved from the database without modification. An example is 2009-07-25
  21. Hi, I'm writing a script which displays links to the previous and next blog entries of the current entry. The dates are stored in DATE format. This is the code I've written. $query="SELECT * FROM blog WHERE blog_date < $blogdate LIMIT 2"; $result=mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); $num=mysql_num_rows($result); if($num>0) { while($blog=mysql_fetch_array($result)) { $link=$blog['blog_title']; print "<a href=\"http://localhost/blog/title/$link/\" class=\"right\">$link</a>"; } } $limit=4-$num; $query2="SELECT * FROM blog WHERE blog_date > $blogdate LIMIT $limit "; $result2=mysql_query($query2) or trigger_error("Query: $query2\n<br />MySQL Error: " . mysql_error()); if(mysql_num_rows($result2)>0) { while($blog2=mysql_fetch_array($result2)) { $link2=$blog2['blog_title']; print "<a href=\"http://localhost/blog/title/$link2/\" class=\"right\">$link2</a>"; } } ; The next entries display fine. But the previous ones not at all. Even though they exist in the database. I think i've isolated the problem. If I change the lessthan symbol to a morethan symbol. It works. I've never worked with dates before.Am I doing something wrong?
  22. Hi, I'm wrting a blog script. Alongside each blog entry I want to display links to 5 other entries which are closest to the date of the current entry. ie, if the entry being viewed is for the 18th of January. I want to display the five previous entries.13th,14th,15th,16th and 17th of January. Is this possible? can someone point me in the right direction? Thanks.
×
×
  • 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.