Jump to content

n8w

Members
  • Posts

    123
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

n8w's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thanks .. this worked great update client_table set company_name = replace(company_name, ‘Old Company’, ‘New Company’)
  2. I have a column that has values like record 1 = bob,nancy, sally record 2 = bob,nancy record 3 = nancy, sally What I would like to do is replace all instances of nancy with betty so all my records would look like this record 1 = bob,betty, sally record 2 = bob,betty record 3 = betty, sally can someone please point me in the right direction of what my sql statement should look like? Thanks
  3. Hey Biobob, Thanks for replying I think I am calling the wrong tables because I am getting a crazy count sql SELECT favorite.letter_id, favorite.user_id, COUNT( favorite.user_id ) AS the_count FROM favorite LEFT JOIN `user` ON `user`.`user_id` = `favorite`.`user_id` LEFT JOIN `letter` ON `letter`.`user_id` = `letter`.`user_id` WHERE user.user_status = 'active' AND letter.letter_visible =1 GROUP BY user.user_id HAVING COUNT( letter.user_id ) >0 LIMIT 10 results should be in the 100 range letter_id user_id the_count 89 1 40230 31 3 894 140 17 1341 85 23 2235 104 26 1788 147 27 9387 46 30 447 128 31 894 104 34 24138 267 39 447 Do you see where I am going wrong? Thanks!
  4. I have 3 tables favorite -favorite_id -user_id -letter_id user -user_id -user_status letter -letter_id -user_id -letter_visible I would like to count how many favorites a user has SELECT letter_id,user_id, COUNT(user_id) as the_count FROM favorite GROUP BY user_id but now I want to count how many favorites a favorite.user_id has where the user.user_status=active and the letter.letter_visible=1 The tricky part is favorite.user_id is the person who marked the letter as their favorite not the person who created it So I have to find who created it by looking up favorite.letter_id and seeing if their user.user_status=active So in plain english I would like to find How many favorites a user has where the status of the person who created the letter is active and the status of the letter is visible. Thanks for any help!
  5. n8w

    tag cloud question

    I want to count how many times words exist in various entires ... so for example if I had these three entries: #1 - health, sun, dog, cat #2 - health, sun, cloud, rain #3 - health, apple, ice cream, cloud I would like the the script to return the number of times each word is used (3) health (2) sun (2) cloud (1) dog (1) cat (1) rain etc
  6. n8w

    tag cloud question

    or if someone know of a good tag cloud api .. that would work
  7. I would like to create a tag cloud .. but not from a defined array .... but from a column in a database with many entries within a date range ... it could have 100s of entries my table has the following columns date, column1, column2, rating I basically want to find out which are the most common words in column 1 and column 2 a row with date might look like this record 1 date:2009-07-16 09:10:33Z column1:red, blue, green column2: hot, sunny rating:3 record 2 date:2009-07-15 09:00:13Z column1:red, blue column2: cold, wet rating:1 what is the best approach to doing this? Here is a tutorial I found on tag clouds .. but it's based off a defined array .. I want to base my off my columns that might have hundred of tags and duplicates .. etc function createTagCloud($tags) { //I pass through an array of tags $i=0; foreach($tags as $tag) { $id = $tag['id']; //the tag id, passed through $name = $tag['tag']; //the tag name, also passed through in the array //using the mysql count command to sum up the tutorials tagged with that id $sql = "SELECT COUNT(*) AS totalnum FROM tutorials WHERE tags LIKE '%".$id."%' AND published = 1";
  8. I am using an api and I need to get the results into a variable? how I takes the results from the web page and turn it into a php variable? something like $bit_request = geturl('http://api.bit.ly/shorten?return_results');
  9. Hello, I have a colum in a table that is an id .. and I have a prefix of "999" on the id (I know this wasn't the best table structure .. but I am retrofitting something.) for example id 1 looks like 9991 id 2 looks like 9992 etc .. I would like to select this column but just the characters after the first "999" which would be 1,2,etc something like select id(after 3 chars) from mytable thanks n8w
  10. [!--quoteo(post=355866:date=Mar 17 2006, 04:51 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 17 2006, 04:51 AM) [snapback]355866[/snapback][/div][div class=\'quotemain\'][!--quotec--] Sounds like you need a UNION [code]SELECT article_id FROM articles  WHERE ( feature='t' AND live_date>CURDATE() ) UNION SELECT  id AS article_id FROM audio_articles WHERE ( s_front='t' and s_date>CURDATE())[/code] [/quote] Hey Barand .. you are awesome! thanks!
  11. I don't think this is a join but I'm not sure how to write it. I need help writing this sql statement I have two similar tables articles audio_articles I want to return all the records from both tables where articles - return the field (article_id) where ( feature=t and live_date>today ) audio_articles (id) AS article_id where ( s_front=t and s_date>today )
  12. I have a user registration system .. where users receive an email and have to click on the link to validate their account .. but a lot say they never received the validation email .. I think this is because my mail is getting filtered out by their server's spam filter .. is the anything I could do to prevent this? Here is what my mail to script looks like [code] $subject=$thesubject; $mail=$email_str; $maili="ocean@illustrationmundo.com"; $headers=""; $headers .= "X-Sender:  $mail <$mail>\n"; // $headers .="From: $maili <$maili>\n"; $headers .= "Reply-To: $maili <$maili>\n"; $headers .= "Date: ".date("r")."\n"; $headers .= "Message-ID: <".date("YmdHis")."selman@".$_SERVER['SERVER_NAME'].">\n"; $headers .= "Subject: $subject\n"; // subject write here $headers .= "Return-Path: $maili <$maili>\n"; $headers .= "Delivered-to: $maili <$maili>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "X-Priority: 1\n"; $headers .= "Importance: High\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: SelmanD Mailler With PHP!\n"; /* send mail */ mail($mail, $subject , $message, $headers);[/code]
  13. [!--quoteo(post=334045:date=Jan 6 2006, 02:07 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Jan 6 2006, 02:07 PM) 334045[/snapback][/div][div class=\'quotemain\'][!--quotec--] try this: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] a.illustrator_id, AVG(score) AS avg FROM illustrator_table a RIGHT JOIN score_table b ON a.illustrator_id = b.illustrator_id GROUP BY a.illustrator_id; [!--sql2--][/div][!--sql3--] THANKS SOOOOOOOOOOOOOOOOOO MUCH!!!!!! This is awesome ..sorry about the double posts .. I wasn't sure if this forum got much traffic so I posted it in the general .. thanks
  14. How do I write a sql statement that will join the tables and get the average of each illustrator's score? I'm trying to create a rating system where users can rate multiple illustrators on one page and it shows the illustrator's existing score I need help writing a sql statement in order to get the score of each illustrator. I have two tables How do I write a sql statement that will join the tables and get the average of each illustrator's score? 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.