php help pt2
- Started
- Last post
- 11 Responses
- dddc
please forget about the other one.... this is the updated thread
http://www.marc-vitale.com/daily…
why the hell isnt it working?
heres the code:
http://www.pastebin.com/111858help please
- rabattski0
have no time to look at it. but did you debug it oldskool style? like echoing out the arrays and variables if it's indeed reading the dir and it's getting the right variables?
- dddc0
i feel like its right... but obviously it isnt u nknow :(
please look
- rabattski0
dude. i have *no* time. have clients to take care of.
you say it doesn't work so start with checking if the $files is actually occupied. print_r($files) to check.
- rabattski0
also, your next is 5 and previous 3 so that script would be at 4. $show = count($files). so there are, according to the script, 4 files but 5 does not excist you need to add that to the script if the next is bigger than the total amount of files it should either not add the next option or go back to 1. and normally it should start at 1 and not at 4. i think you're script is very off.
- mirola0
after versions 4.1 of php $show and $_GET['s how'] are different variables. so when you're asking if show is set at the beginning then the answer is no and it's always setting it to be 1.
so use $_GET['s how'] instead of $s how
- dddc0
i see now that my code is off/bad...
but what can i say this is my first attempt at a working script.. and first time with php...all i need is a working back/next image flipping type thing like this but working of course
i dont want to go the mysql db route because i already tried and couldnt figure it out....
- dddc0
mirola thank you very much BUT
i wouldnt know where to replace thatcan you update my code to show me please .. or give me more detail
- rabattski0
look if you're new at this, the best way to work with php is debugging. print / print_r variables etc. to see if it's actually doing what it is supposed to do instead of only looking at the end result. that way you can see where it goes wrong or not.
mirola has a good point though.
the concept of your script is good though. reading a folder with images, store them in an array and flip thru those based on a variable in the url.
- rabattski0
hahaha.... everyone one is looking for a quick cut. :) anyways, if it would be *that* easy everybody would be php'ing.
again, if you want to learn how to walk you first need to put on your shoes. so debug that script. seriously. best way. and you learn from it as well.
- dddc0
http://www.pastebin.com/111864
thats my new code
only added $show = $_GET['show'];
to the top therestill no worky :(