Jump to content

intrik

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

intrik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [quote author=speedy33417 link=topic=110073.msg444219#msg444219 date=1159624279] You can't just echo <a href=dog.php?dogid=$dogid> [/quote] Yeah you can, I do it all the time. [code] <?php echo"<a href='page.php?a=$var'>"; ?> [/code]
  2. That seems like a bit of a round-a-bout way of doing what it is you're trying to do. Is it not? Are you just grabbing post var's and inserting them into the database? There is a way that's much much easier....
  3. intrik

    Tag order

    Nope, I just couldn't be bothered escaping all your quotes so they'd parse :). echo"<table align=\"center\" width=\"450\" cellspacing=\"0\""; And so on. Otherwise if you go echo"<table align="center" width="450" cellspacing="0""; The first " after align= and before center (in align="center"), will close the echo. So to get around it you do a \". A \ will escape any character in PHP.  I'm not that great at explaning things. But I use a single ' in the example I showed you before so that the first " wouldn't close it. Does that make sense? echo'testing these quotes " abcd'; Is fine, because the echo is encapsulated in ', therefore " won't close it. echo"testing these quotes ' abcd"; Is fine, because the echo is encapsulated in ", therfore ' won't close it. echo"testing this " abncd"; ^^ Is not fine, because the echo is encapsulated in ", therfore " will try and close it. Makes sense? Same goes with all php syntax. [code] <?php $var = "test's"; //Is fine $var = "test"s"s; //Is not $var = 'test's'; //Is not ?> See how the code is now broken above? <?php //The only other way around it is to do this. $var = "test\"s"; //The \" will escape the character and won't be considered as syntax. ?> [/code] Makes sense, yeah?
  4. intrik

    Tag order

    Because [code] <table align="center" width="450" border="0" cellspacing="0" cellpadding="0">   <tr>     <td align="center" valign="middle" bgcolor="#D6DCEB">Those conditions were true </td>   </tr>   <tr>     <td align="center" valign="middle" bgcolor="#F3F7FC">This table appears </td>   </tr> </table>[/code] ^^ is HTML. the stuff inside <? and ?> is php, so when you want to use php you got to open / close the php tags. Alternatively you can do this [code]<?php     if ($Oranges >= 10 && $Bananas == 5) {           echo'<table align="center" width="450" border="0" cellspacing="0" cellpadding="0">   <tr>     <td align="center" valign="middle" bgcolor="#D6DCEB">Those conditions were true </td>   </tr>   <tr>     <td align="center" valign="middle" bgcolor="#F3F7FC">This table appears </td>   </tr> </table>';         } ?>[/code] ^^ Then there's no need to be opening and closing tags all the time
  5. Try using http://au.php.net/str_replace
  6. Using imagejpg(), it creates the file as you would expect but the owner of the file is "apache" rather than, for instance the ftp username. So you cannot download the uploaded files through ftp, because they're not your files. Does that make sense? Is there anyway to make it so that the owner of the file is not "apache"?
  7. Well, the problem is that I can't SORT BY relevance DESC In my version of MySQL... So it's going to have to be done with some PHP, how do I sort the results in PHP? Any ideas? I didn't even know you could do that...
  8. Hey guys, I made this code to count how many times the search string occurs in the results data [code] $desc_lower = strtolower($results['desc']); $title_lower = strtolower($results['title']); $desc_count = substr_count($desc_lower, $searched); $title_count = substr_count($title_lower, $searched); $count_searches = ($title_count+$desc_count); echo $count_searches; [/code] Idealisticly what I'd like to do is order the sql results by the frequency of the occurance, so obviously if $count_searches had a value of 1234 it would order before a value of 1233. So you get the most relevant search results at the top. Any ideas?
×
×
  • 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.