| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Apr 2004
Posts: 2
![]() | |
| |
| | #2 (permalink) |
| Senior Member Join Date: May 2003
Posts: 2,187
![]() ![]() ![]() | on the = where you assign the vairalbe to the array put a . so it becomes .= what that does saying include/merge any extistence of the variable $subjects you could rename the vairables subject1 subject2 subject3 then change if($search == "$subjects[$i]") to if($search == "$subjects$i[$i]") just to ways to get round it and then on the second bit use a while loop or sominthing like that maybe to look through the results |
| |
| | THREAD STARTER #3 (permalink) |
| New Member Join Date: Apr 2004
Posts: 2
![]() | Thanks for the reply Adam. Ok the .= didnt work. but if i use the: if($search == "$subjects$i[$i]") and changing the subjects to subjects1, 2 etc. What should i write for this line (sorry i'm new to php): $limit = count($subjects); (what do i replace the $subjects variable with, in order to recognise the arrays) I really appreciate your knowledge. |
| |
| | #5 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | Use array_push where you're adding more values to your array and then your code should work out how you want it to. Example: $subjects = array("A Death in Vienna","Daniel Silva","£18.16","23 February, 2004","Hardcover","Putnam Pub Group",'<img src="images\books\thumbs\a_death_in_vienna.jpg" alt="Click for more information">','<img src="images\books\full\a_death_in_vienna.jpg" alt="A Death in Vienna">',"Typical of the writing of author Daniel Silva, A DEATH IN VIENNA is a work of fact-based fiction based on his brilliant and thorough research."); array_push($subjects, "A Girl's Guide to Vampires","Katie Macalister","£16.99","November, 2003","Mass Market Paperback","Love Spell",'<img src="images\books\thumbs\a_girls_guide_to_vampires .jpg" alt="Click for more information">','<img src="images\books\full\a_girls_guide_to_vampires.j pg" alt="A Girls Guide to Vampires">',"If you're a fan of vampire romantic fiction, you'll enjoy this one. The basic premise is that our heroine, Joy, is accompanying her friend Roxy on a trip to the Czech Republic to try to visit a reclusive author of romantic vampire fiction and to explore whether or not vampires do exist."); You can also use in_array to search through arrays. Example: PHP Code: |
| |