|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
we learn the hardway
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > learning the hard way |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|