General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 7th, 2002, 10:48 PM
littleblackdog littleblackdog is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Anchorage
Posts: 118 littleblackdog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Smile learning the hard way

Honestly, I don't mind learning the hard way. I feel good that I stuck it out. But I look back at all the attempts, the searching for code to disect, the failed attempts...ugh, what a heck of a lot of time spent!

I've been posting this problem for some time. I'lll post my findings to help anyone out there who might be having the same problem...

I posted:

Array Question-

Wanted to pull just rows from the db that had a specific word ( entry ) in it, all the rows containing that word. The word was entered from a form. For more info, see the above post.

Here is what I did to get ALL the rows containing a key word (passes on from a post(form)) that was in a specific column. Took me forever!


$db_name = "books";
$table_name = "bookinput";
$connection = @mysql_connect("localhost", "user", "pass") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$query = "SELECT * FROM $table_name WHERE mediatype = '".$mediachoice."' ORDER BY title";
$result= @mysql_query($query, $connection) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$title = stripslashes($row['title']);
$authorname = stripslashes($row['authorname']);
$mediatype = $row['mediatype'];
$subject = $row['subject'];
$publisher = stripslashes($row['publisher']);
$edition = stripslashes($row['edition']);
$isbn = stripslashes($row['isbn']);
$quantity = stripslashes($row['quantity']);
$location = stripslashes($row['location']);
$description = stripslashes($row['description']);
$display_block .="
<p><strong>$title</strong> (<STRONG>$authorname</STRONG>, $publisher)<br>
$description(<em>location: </em> $location,<em> mediatype:</em> $mediatype, <em>edition:</em> $edition,<em> isbn#: </em>$isbn, <em>quantity:</em> $quantity.)</p>";
}
?>


The problem I was having was the $query. -I finally got it my putting the inputted variable "mediachoice" in the '".$mediachoice."' in this format, otherwise I was finding syntax errors. The "mediachoice" is the choice from a form function passes from a prior page.

Boy, I hope I am helping. I don't use the proper terms all the time, since I'm not the sharpest tool in the shed , but I'm trying.

Thanks for everyone's help agian.
We still haven't had snow in Alaska yet...almost a record!
I'm not complain'in
__________________
bow wow!

Last edited by littleblackdog : November 7th, 2002 at 10:53 PM.

Reply With Quote
  #2  
Old November 7th, 2002, 11:36 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
we learn the hardway

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > learning the hard way


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT