Jump to content

H-Fish

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

H-Fish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. most of the SMS scripts i have seen work on the basis that sending an email to phonenumber@serviceprovider.com will be forwarded on as a text message by the phone operator, so it can probably done very easily with the mail() function.
  2. Thanks, i cracked it this way: function array_repeated($array) { if(!is_array($array)) return false; $repeated_values = Array(); $array_unique = array_unique($array); if(count($array)-count($array_unique)) { for($i=0;$i<count($array);$i++) { if(!array_key_exists($i, $array_unique)) $repeated_values[] = $array[$i]; } } return $repeated_values; } $repeatedtags = array_repeated($tags); // get the most repeated values from the array tags into a new array // if there wasn't any repeated just use the old array with the new name if (empty($repeatedtags)) { $repeatedtags = $tags; } // set up some randomness srand((float) microtime() * 10000000); $rand_keys = array_rand($tags, 2); $rand_keys2 = array_rand($repeatedtags, 2); echo "$repeatedtags[0]"; // the first most popular tag echo "$repeatedtags[1]"; // second most popular tag echo $repeatedtags[$rand_keys2[0]]; // random popular tag echo $repeatedtags[$rand_keys2[1]]; // random popular tag echo "$repeatedtags[4]"; // 5th most popular tag echo $tags[$rand_keys[0]]; // random tag echo $tags[$rand_keys[1]]; // random tag
  3. Hi there, i have an array that i have created by exploding a string that is comma seperated (for example my string was 1,2,3,4,5,6,7,8,9 and now i have this as array[0] = 1 etc etc) What i am wondering, is if my string was more like 1,2,3,5,6,7,1,1,1,8,9,3,3,2,2 could i search the array and find what appears most frequently in the values (in the above case 1)? So if 1 has 4 occurences, then i echo this value first, then 3 which has 3 occurrences (etc etc) I am trying to make a basic tagging system for my website, and i want the tags that appear most to be displayed first or in a bigger font or something
  4. It didn't say to do that where i downloaded it from, but the credit is still in the source i believe. All the php coding is mine. But anyway, i've added a link back in the footer now. Only fair Thanks for the advice on the menu bar, and the padding, i think that will just make it generally easier to read. Also didn't think about readers wearing glasses, so it might be worthwhile to increase the font size.
  5. Hey everyone, firstly i'd like to thank the people on here who helped me recently, i managed to complete the coding i needed so i think my site is finished. (apart from the booksearch.php page, but it's almost done. I can't fully test it until the database is a bit more full) What i was hoping is if people could take a quick look over it, and perhaps tell me how it works with regards to interface, php coding and general usability. It's been quite an adventure, since it's the first full site i've coded from scratch, even had a little play with mod_rewrite Anyway, url is http://www.listbook.net/ You don't have to register if you don't want, you can login using the username demo and password demo. Thanks
  6. I see where you are coming from here, i figured maybe it was because i couldn't have two while loops inside each other. The code you gave still does not echo $row2['displayimage']; but i see the principle at least so i'll have a look at it.
  7. By the way, here is my attempt that doesn't seem to output anything // Show the results for every user who has a certain album $query4="SELECT UserId, format, artist, name, label FROM books WHERE name = \"$getalbum\" order by name asc"; $result=mysql_query($query4); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ownerid=mysql_result($result,$i,"UserId"); //echo "<tr><td><a href = \"profile.php?id=$ownerid\">Profile</a></td></tr>"; $sql = "SELECT UserId, displayimage FROM $dbtable WHERE UserId = \"$ownerid\" order by UserId asc"; $results = mysql_query($sql); while($row = mysql_fetch_array($results, MYSQL_ASSOC)) { echo $row['displayimage']; } ++$i; }
  8. Hey everyone, i appear to have run into a bit of a brick wall here and i need some help if possible. I have 2 tables, one called users2 and one called books. Books has a field called UserId, which is the ID of the user that added the book to the database. My problem, is that i need to take this ID from the book table, and use it to get some information from the user table. Here is my code to get the ID from the book table: query4="SELECT UserId, format, artist, name, label FROM books WHERE name = \"$getalbum\" order by name asc"; $result=mysql_query($query4); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ownerid=mysql_result($result,$i,"UserId"); ++$i; echo "$ownerid"; } If i try to repeat this code (ie have two while loops inside each other, then it does not output the result, despite getting no error messages. Here is the query i use to get the information from the users field $query4="SELECT UserId, displayimage FROM $dbtable WHERE UserId = $ownerid order by UserId asc"; If anyone can shed some light on this i would greatly appreciate it
  9. cheers i did it with this code ///////// READS INFO FROM DATABASE /////// mysql_connect("localhost","clanrryoy",""); @mysql_select_db($DB_DBName) or die( "Unable to select database"); $query="SELECT artist, title FROM tabs order by id desc limit 5"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $artist=mysql_result($result,$i,"artist"); $title=mysql_result($result,$i,"title"); ?> <? // ADDS READ DATA INTO PAGE ?> <p> </p> <div align="center"> <p><? echo "$artist"; ?><br> <? echo "$title"; ?> <? ++$i; } echo "</table>";
  10. thanks but i just need one more little thing...., will i have to decaler this as a variable / string or just echo mysql_result i\'m at school ahnd havent got the chnace to look at my code so i might just be talking crap to myself
  11. i\'ve got an id field, but do i like put id field 1 in there..... heres a what my table looks like from phpmyadmin btw you can see it at www.clansr.co.uk/cs/hctabs it just a little selection of scripts where me and my friends can share guitar tabs
  12. i have a table called tabs, and from this table i want to retrive data from columns: artist & title BUT i only want to get the 5 most recent submitted entries is this possible?
×
×
  • 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.