Jump to content

defeated

Members
  • Posts

    246
  • Joined

  • Last visited

Everything posted by defeated

  1. Hi, I've been using phpmailer in my sites. It has been great, in that I can add attachments etc. I have had some issues with it though. It does not seem to resolve email addresses properly leading to a lot of my form mails being caught in spam filters. This problem is exacerbated by the host I use. They are not able to certify any of the email addresses they provide on shared hosting. The result is that if a mail gets through it comes through with the email address I specify as the sender. If it is stopped however it is showing up as [email protected]. My host company says it's a problem with my script (even though it works ok on another host - although still somewhat subject to being classed as spam). Anybody have any experience of this or have a better mailer to recommend I use. It needs to be fairly simple... I'm not experienced enough yet for anything too complicated.
  2. Hi, I want to run a blog. That bit is easy. I also want to have some pages attached to the blog that will run off their own db (not wp). I have done it where the blog was "dropped into" a site before, changing the header to add in the site menu and the css to make it fit in with the rest of the site, but this time I need WP to be the top level. The trouble is I can't figure out how to do it. You can't just plop in a page called 'whatever.php' into the top level of the WP code. I could make a sub directory and direct to that directory from a menu, but I don't know where to put that sub directory. Should it be a child directory of whichever theme folder I'm using or should it be a child directory of the top level directory?
  3. hmmm. I thought I was normalising it! :-\ The idea is that the 'english' is repeated many times in the table, so I replaced the english with an id number and add a translation table (id =>english). This significantly reduces the amount of data held in the db. For example... the column may be job catagories. The english may be one of a list (Medical and Healthcare jobs, Financial Jobs, Scientific and Technical Jobs.) I replace them with an id number... eg 1,2,3. That reduces the number of chars needed from up to 50 varchars down to 2 ints. I then have a table that goes id English 1 Medical and Healthcare Jobs 2 Financial Jobs 3 Scientific and Technical Jobs Each job (eg one row in the main table) will have several of these tables for information that comes from a list.. eg. job type, job name, job locations, salaries, experience levels, questions to ask applicant. I am assuming that by normalisation you are talking about many to many relationships? Because there are so many tables involved I can't get my head around that many tables. I have done a many to many relationship for job tags (bit like the wordpress tags). That was a b***h because I had to have the tags expire when the job did (but not delete until the job was actually deleted). Kickstart set me straight on that one. I just want a row per job that holds all the information, but in a simplified format (eg ints instead of varchars) where possible. But when I recall the information I have to get the full varchar info from the separate pages. I'm very lost on the multiple joins necessary. Any enlightenment gratefully received!
  4. Hi, Tables and col names as follows Main id, name, sub1_id, sub2_id, sub3_id sub1 id, english sub2 id, english sub3 id, english id's are all numbers. Sub tables contain the english "translation" of the numbers. If I want to get the english for all entries in a row on the main table.... $query=mysql_query("SELECT name, sub1.english, sub2.english, sub3.english FROM main LEFT JOIN (sub1, sub2, sub3) ON (main.sub1_id=sub1.id AND main.sub2_id=sub2.id AND main.sub3_id=sub3.id) WHERE main.id='$selected_row'") or die(mysql_error()); $row=mysql_fetch_array($query); $main_name=$row['name']; $sub1_english=$row['sub1.english']; $sub2_english=$row['sub2.english']; $sub3_english=$row['sub3.english']; Am I barking up the wrong tree?
  5. Yep, sorry about that.
  6. No. That didn't work. max_count is the tag with the highest individual count. I sorted it though. Just added ORDER BY count DESC LIMIT 0,150 to my query.
  7. Hi, I have the following code making up a tag cloud. I have just realised that it will not be limited... so if I have 1,000 tags they will all show. Any ideas on how to modify it to limit the tags that show to 150? Cheers function tag_cloud() { $min_size = 9; $max_size = 30; $tags = tag_info(); $minimum_count = min(array_values($tags)); $maximum_count = max(array_values($tags)); $spread = $maximum_count - $minimum_count; if($spread == 0) { $spread = 1; } $cloud_html = ''; $cloud_tags = array(); // create an array to hold tag code foreach ($tags as $tag => $count) { $tag_url=str_replace(" ","-",strtolower($tag)); $size = $min_size + ($count - $minimum_count) * ($max_size - $min_size) / $spread; $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px; line-height:'. floor($size+. 'px;' . '" class="tag_cloud" href="http://www.mynextjob.ie/tags/' . $tag_url . '.jobs" title="' . $count . ' job(s) tagged \'' . $tag .'\'">' . htmlspecialchars(stripslashes($tag)) . '</a>'; } $cloud_html = join("\n", $cloud_tags) . "\n"; return $cloud_html; }
  8. Thank you Mr. Adam!
  9. In a for loop I have the following code $jobloc.($i+1)=$addjobloc[$i]; What I am trying to do is... $jobloc1=$addjobloc[0]; $jobloc2=$addjobloc[1]; $jobloc3=$addjobloc[2]; But what I get is an Error: unexpected "=" Help please
  10. aaarrrrgggghhhh! Thanks. Been staring at it for 10 mins!
  11. 1002: mysql_query("INSERT INTO job_tags 1003: (jobref_id,tag_id) 1004: VALUES 1005: ('$jobref_id','$tag_id')") or die mysql_error()); Getting an unexpected T_STRING error on line 1005
  12. Keith you're a bloody genius! That's saved me hours. I hadn't thought of adding a deleted column. I'm still reading left joins at the moment. Haven't got to inner joins yet. I have a feeling that this is going to be another one of those turning points where everything I've done before seems very basic and a whole lot of things suddenly seem a lot more possible. Thanks for all your help. To be honest I thought that my last post was more of a demonstration of "hopeless situation" than an actual request for good advice. Your post was a very nice surprise!
  13. 123 expires with all tags. If a topic ref 123 was tagged appledrops, gumdrops, some other tag and then topic 123 expires (one month after it was posted) then there is one less occurrences of each of the tags appledrops gumdrops and some other tag. If the number of occurrences was then equal to 0 then the tag would be deleted. To further complicate it, the topic can be deleted before it expires and the tags can be edited at any time. If the topic expires it can be re-posted which would mean that the deleted information would have to be re-instated. This means that I need another table of deleted tag/reference relationships to store deleted but possibly re-usable tags. I will handle the expiring topics with a Cron Job running in the middle of every night. I can't help but think that it's not worth it for the ability to have a tag cloud on my site. Unfortunately now that I've started and it's kicking my ass it has become a challenge and I am unable to walk away from it. The worst part is that once I have it finished nobody will be any the wiser to all the work and complications that have gone into it. They will go , "oh a tag cloud.... naff!".
  14. :-\ My head hurts. I get that I need the three table schema. I just can't get my head around the queries. Haven't done any joins before.... Also, mine is going to be a little more complicated because I have to deal with expiring references and tags(if there are no more associated references for it). I also need to be able to edit tags per reference. It's doing my head in. oh well, off to the tutorials with me I suppose. Thanks for the direction Kickstart. Your short term solution would work. But I may as well learn how to do it properly.
  15. I hadn't seen donedeal.ie I'm surprised! I agree that you can make a site that's a lot cleaner. The url example you gave is certainly nicer to look at. I don't think it would rank any better though since both contain the same keywords. Best of luck!
  16. It wouldn't be the first time.. Check out this link: http://www.wipo.int/amc/en/domains/decisions/html/2006/die2006-0005.html It wasn't just about the site name, it was about the trademark. They had registered buy-sell as a business name and everything... didn't protect them. Why start a site by trying to piggy back on a successful site? Would it not be better to start off something original where you won't run the risk of being shut down? Or are you going to copy them entirely and live off adsense on your site for as long as you can get away with it?
  17. It seems that the problem was a ddos attack on the ISP. I guess there is only one way to find out if 30 sites is too many....
  18. Why bother? Buy & Sell will just get you shut down again anyway.
  19. First you have to learn the secret handshake
  20. Both are important. They work hand in hand. External links to your site will be less effective if your landing page is not optimised for the keywords used in the external link. Likewise, an optimised page is not a lot of good without any links to it. My preference would be to start by optimising your site and then add relevant links to it.
  21. I want to return rows where a reference is in an array or references. Database looks like:- Tag count refs this tag 3 1 , 3 , 1234 another tag 2 1234 , 12345 gumdrops 3 123, 1234, 12345 appledrops 3 123 , 12345 , 123456 $ref='1234'; $query=mysql_query("SELECT * FROM mytable WHERE refs LIKE '$ref'") or die(mysql_error()); $num_rows=mysql_num_rows($query); echo "<p>".$num_rows." contain the reference ".$ref.".</p>"; That code doesn't return any rows because the column refs is not exactly like 1234 in any instance. I can't use LIKE '%ref%' because that would return the row 'appledrops' which doesn't actually contain the ref 1234 Any suggestions?
  22. aha! Try this. There seems to be an extra curly bracket at the end.... but perhaps it's not extra. All I have done is put the echo statement outside the if statement and structured the code a bit so that I could see what was going on. If it doesn't work I'll get to it later. function do_checkboxes($userid){ global $profile_info, $setting, $smarty_object, $user_info;; if(isset($_POST['set_options'])) { if(!$_POST['c_options']=="") { foreach($_POST['c_options'] as $key=>$value) { $tag_name=mysql_real_escape_string($_POST['tag_name'][$key]); $id=mysql_real_escape_string($value); $delete = "DELETE FROM tags_options where user_id = '".$user_info[user_id]."' and tag_id <> '".$id."'"; $deleteSQL = mysql_query($delete) or die(mysql_error()); //echo $deleteSQL.'<br />'; }//end foreach foreach($_POST['c_options'] as $key=>$value) { $tag_name=mysql_real_escape_string($_POST['tag_name'][$key]); $id=mysql_real_escape_string($value); $oaction = "INSERT INTO tags_options (tag_id, tag_name, user_id) VALUES('$id', '".$tag_name."', '".$user_info[user_id]."')"; echo $oaction.'<br />'; $optionsSQL = mysql_query($oaction) or die(mysql_error()); }//end foreach if($optionsSQL) { echo '<font color=red>Your options have been saved</font>'; }//end if }//end if no c_options }//end if set_options $query ="SELECT tag_desc_id, tag_name,parent_id FROM tags_description ORDER BY tag_name ASC"; $result = mysql_query($query); if (!$result) { echo mysql_error(); }//end if elseif(mysql_num_rows($result)<=0) { //echo "No entries"; }//end elseif else { echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">"; echo "<form method=\"post\">"; $i=0; while ($row = mysql_fetch_array($result)) { $i++; $incr = ($incr == 3) ? 1 : $incr + 1; if($incr == 1) echo "<tr>"; echo "<td class=\"formcheckbox2\">"; $query2 ='SELECT tag_options_id, tag_id,tag_name,user_id FROM tags_options'; $result2 = mysql_query($query2); if (!$result2) { echo mysql_error(); }//end if echo"<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$row['tag_desc_id']."\""; $checked = ''; while ($row2 = mysql_fetch_array($result2)) { if($row2['tag_id'] == $row['tag_desc_id'] && $row2['user_id'] == $user_info[user_id]) { //global $checked; $checked = 'checked="checked"'; }//end if echo " $checked> </input>"; }//end while echo"<input type=\"hidden\" name=\"tag_name[$i]\" value=\"".$row['tag_name']."\"></input>"; echo $row['tag_name']; echo "</td>"; if($incr == 3) echo "</tr>"; }//end while echo "<tr>"; echo "<td> <input type=\"hidden\" name=\"set_options\" value=\"set_options\"> <input name=\"GO\" type=\"submit\" id=\"GO\" value=\"Save Changes\" class=\"button\">"; echo"</td>"; echo "</tr>"; echo "</form>"; echo "</table>"; }//end else // What's this curly bracket for? }/*
  23. Play suspended due to having to pick up my daughter from the creche. I'll have a look later tonight if nobody else solves it for you first.
  24. Not sure but try.. $sql="DELETE FROM tenderlotponude WHERE OpcijaPonude = '$expiry' "; The single quotes should do the trick.
  25. Nice... but I suspect that you will end up with two inputs for each checked checkbox. I think that what you are trying to do would be better achieved with a WHERE statement in your mysql. The trouble will still be that you have two pieces of data that satisfy your if clause. $tag_desc_id = $row['tag_desc_id']; $user_info = $user_info[user_id]; $query2 ="SELECT tag_id FROM tags_options WHERE tag_id='$tag_desc_id' AND user_id='$user_info'"; $result2 = mysql_query($query2) or die(mysql_error()); while ($row2 = mysql_fetch_array($result2)) { if(!empty($row2['tag_id'])) { echo "<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$tag_desc_id."\" checked='checked' />"; }//end if else { echo "<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$tag_desc_id."\" />"; }//end else }//end while Ah, Sorry WolfRage. I stand corrected. This should work in that case. Scratch that. It won't work. Like WolfRage said... need more code. or just try adding else { //global $checked; echo"<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$row['tag_desc_id']."\""; echo "> </input>"; }// end else after your if statement
×
×
  • 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.