Author Topic: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
EDIT: Resolved! See last post.

Hey all. Long time member - no longer active poster but..

Many, many, many a moons ago I used this forum for some help with some web work I did and it seemed good then so I bookmarked it.

Fast forward a few years, and here we are. I'm hoping it's still okay for this. If not, mods feel free to move or delete.

Ok, So I'm brining my little stick comic back to life and would like to figure out how to do a first/previous/next/last buttons.

I'd like to be able to just save the images as filename x.jpg, x+1.jpg, x+2.jpg, etc. and have it automajically use the highest number it finds, on the main page, if possible. Obviously 'last' could just point to the main page url. Unfortunately the other three aren't so easy. wink

I've got html (obviously), php, and sql to work with. I've created a database in sql and have my dbconnect file set up already.

It's been several years since I've done anything web related so, bear with me. Here's the site in question:

http://www.superstickphase.com

Thanks for any help.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
<?php
if (isset($_GET['id'])) {
$comic_number = $_GET['id'];
$next = $comic_number+1;
$prev = $comic_number-1;
}
?>
<a href=\"mysite.com/comic.php?id={$next}\">Next Comic</a>
<a href=\"mysite.com/comic.php?id={$prev}\">Prev Comic</a>

Something like that. not very elegant, but it should work.

Keep in mind that I just typed this up from the top of my head, and it probably won't work without some tweaking happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Hey thanks for the reply. I wish I'd seen this before I went for a nap!

I was layin there thinking about it had logic like this churning grin . But, would that display the newest one on main page?

Alright well Imma try it real quick.

Thanks again for the reply!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
EDITED Ok. Sweet! Partially working. From what I can tell:

I have it displaying the right image, and the next previous buttons working, when you put in the id=x in the URL manually. Now I need to figure out how to make it automatially pull the highest number it can find out of the images folder. Or is that possible? Edit: ok, I've set a variable "newest" that I'llj ust change anytime I upload a picture, no big deal. That makes the "Last" button work. So, What I still need to get working:

-when people come to www.url.com/index.php it will automatically put the ?id=$newest in there.
-make the previous button stop at 1.jpg, not allow going to 0, -1, -2. I guess just an if then?
-make next button stop at current, not allow going to current+1 if current is the highest. if current=newest then...

I hope that's doable. thanks for your help so far, got me started!

Here's my source thus far:

<?php
$newest = 4;
if (isset($_GET['id'])) {
$current = $_GET['id'];
$next = $current+1;
$prev = $current-1;
}
?>

<!-- CONTENTS TABLE -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php echo ("{$prev}") ?>"><span>Previous</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="/index.php?id=1"><span>First</span></a></div></td>
<td width="72%" align="center"><?php echo ("<img src=images/{$current}.jpg>"); ?></img></td>
<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php echo ("{$next}") ?>"><span>Next</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php echo ("{$newest}") ?>"><span>Last</span></a></div></td>
</tr>
</table>
<!-- CONTENTS TABLE -->


I will edit more into this post as I come up with stuff.

This is fun!

Thanks again!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
EDITED:

... almost done! This is all that's left(!):

I need to figure out:

if (id (someone manual puts in URL to be slick) > $newest OR < 1) goto (a custom 404 type page)

I take it I need to edit this:

<?php
$newest = 4;
$current = $newest;
$next = $current+1;
$prev = $current-1;
if (isset($_GET['id'])) {
$current = $_GET['id'];
$next = $current+1;
$prev = $current-1;
}
?>

to include an AND in the IF to say {if over $newest or under 1 goto 'whatever'} then after the if an else { goto index.php?id=$newest }

grin Man this is fun. Why did I ever quit making little sites?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Got it!

Thanks a ton for getting me started on the right track! A little common sense later (and no googling, gasp!) I got it all working. Index.php pulls up newest, previous and next work only in the array of comics uploaded, first and last take to first and latest, and someone being slick changing the ID manually will go to a 404 comic.

Sweet! Thanks again. here's my final code if you're interested.


<?php
$newest = 4;
$current = $newest;
$next = $current+1;
$prev = $current-1;
if (isset($_GET['id'])) {
$current = $_GET['id'];
$next = $current+1;
$prev = $current-1;
}
if ($current > $newest) {
$current = -404;
$next = $newest;
$prev = 1;
}
if ($current < 1) {
$current = -404;
$next = $newest;
$prev = 1;
}
?>



<!-- CONTENTS TABLE -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php if ($current < 2) { echo ("1");} else { echo ("{$prev}"); } ?>"><span>Previous</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="/index.php?id=1"><span>First</span></a></div></td>
<td width="72%" align="center"><?php echo ("<img src=images/{$current}.jpg>"); ?></img></td>
<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php if ($current < $newest) { echo ("{$next}");} else { echo ("{$newest}"); } ?>"><span>Next</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php echo ("{$newest}") ?>"><span>Last</span></a></div></td>
</tr>
</table>
<!-- CONTENTS TABLE -->

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Ah, nice. Sorry I didn't check this earlyer :]

As for automating everything, check this out:

<?php
//Make a function to find the newest file, and output only the filename.
function find_newest () {
$dir = 'images'; //Set the dir where the images reside.
$files = scandir($dir); // Scan the dir, and load all elements into an array.
$file = end($files); // Find last element in array, should be last image in dir.
$newest = explode(".",$file); // Stril the .jpg part of the filename.
$newest = $newest[0]; // set $newest to be the filename.

return $newest;
}

$newest = find_newest(); // run the function.
print ($newest); // echo number of last file.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Duuuuude, that is awesome. I didn't think I could automate it witout SQL.

Works great! Thanks!

(it returned the newest and outputted the number on the page, so i just removed the print line)

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Check this out.

http://pastecode.org/6267

Should work pretty well with using just $newest, $current, $prev and $next for output.

Edit: Doesn't work any better then your code, but it looks a bit cleaner, so should be a bit easyer to maintin / document / whatever :>

Edit2: you might have troubles once you start running into double digits, 10 would be listed before 2 and so on. so it might be clever to call your files 001.jpg instead of just 1.jpg happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Good call, but when I change them 001 etc, the $next and $prev appear to omit the zeros..

i might have to just do 1....9..11..19..20..29.. ?

edit, that didn't work either..

My original method works, where it's just $current+/-1 so it's not a show stopper, thankfully, but I'd like to get the automated working.

000's or not it seesm to nly go 1-9 then stop, counts 9 as newest.

I guess i could name them

1-9
91-99
991-999
but that wouldn't work either, cuz on 9 it would try to go to 10. hmm..

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I'm sure there is a way of doing it. Don't have time to work on it while at work though.
A quick workaround should be to call the files 1001.jpg, 1002.jpg and so on?

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
aww good thinking. *snap*.. I feel stupid not thinking of that....

Edit: That works great! And, I'm okay with it. Not to worried about having them 1.jpg 2.jpg versus 1001.jpg 1002.jpg.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Ok, check this out.

I'm trying to wrap <?php ?> code inside of <?php ?>, I can't seem to get it to work. I'm sure I will, but if you can speed things up feel free wink

Here's what I'm doing. Now that everything is working awesome, and automated (thanks!!), my next goal is to get rid of the prev/first buttons if someone is on the first record 1001.jpg, and get rid of the next/last buttons if someone is on $newest.

Oooo, even better, leaving but disabling them. Can I do that? I'm sure I can. if nothing else just not <a> them..

Here are the lines:

<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php if ($current < 1002) { echo ("1001");} else { echo ("{$prev}"); } ?>"><span>Previous</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="/index.php?id=1001"><span>First</span></a></div></td>

<td width="72%" align="center"><?php echo ("<img src=images/{$current}.jpg>"); ?></img></td>

<td width="14%" align="center"><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php if ($current < $newest) { echo ("{$next}");} else { echo ("{$newest}"); } ?>"><span>Next</span></a></div>
<br><br><div class="buttonwrapper"><a class="squarebutton" href="index.php?id=<?php echo ("{$newest}") ?>"><span>Last</span></a></div></td>

i've tried wrapping all current php code in each line in a <?php if ($current = 1001) blah blah ?> and <?php if ($current = newest) blah blah ?> but it doesn't seem to be taking.

I think I also tried (it was after midnight) wrapping and then removing the inside/current <?php ?>'s and echoing and stuff and I think I confused myself but I couldn't get it right.




 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
You should take a look at the code I posted, as a general rule, you want as little as possible code in your HTML. Try to seperate the two, and you'll have a much easyer time working with the code later.

As for removing/disabling the buttons.

just do a simple if/else statement.

if ($current!=$newest) { //if the current comic is diffrent from the newest.
// insert code to echo the button
}else {
//do nothing
}

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Yeah, that's exactly what I had tried, several times and ways, but it seemed to conflict with the < and >'s in the echo code.. but it was also very late and I'd barely slept the night before, so I'm fixin' to start trying again fresh with some coffee to boot.

happy

As for the code you posted - I glanced at it and it looked great! However, I want as much of this as possible to be hand wrote by me simply because:

a) helps me know my code
b) helps me learn, to type it and understand it as I go
c) kinda proud of myself wink

With that said, I certainly ask for help when I need it, hence your first reply that got me on my way, and the automated part (which is friggin' awesome, btw). Plus, it's all working great, and fast, right now anyway. So I don't wanna fix what isn't broke!

I guess the first thing to do from here is get the code to work right and maybe remove the buttons for testing.. or link elsewhere.. until I get it right. Then I'll make new css classes to fade the text to a grey and have it not change on mouseover.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Disabling the buttons is pretty easy, just add disabled to it.

<input type="submit" disabled>

Btw, you should automate your starting point as well, not just the ending. You can find it at place 2 in the array. (0 is "." and 1 is ".." (dir structure) so the first actualy file should be the third value of the array, IE $array[2])
So make a function to find that one as well (that's my recomendation atleast. That way you don't manually have to go change the starting file everywhere each time you change the filename structure. happy

As for not incorporating my code, that's ok. (It's actually all your code, just sligthly compressed.) but you should definatly work to get the code out of the html bit.

insted of doing <asd> text text text text <?php [lots of code] echo variable [lots of code] echo variable ?> </asd>
I'd do
<?php
[lots of code]
$variable = $desired_value;
[lots of code]
$variable = $alternate_value;
?>
<asd> text text text text {php echo variable;} </asd>

Edit 3: hope that helps you along the way, as you say, you learn much better by writing your own code. But the one thing you really learn from, is REwriting your code wink

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
This is fun, I appreciate your advice and help!

This morning and set a $first variable at 1001, but it's not automated. But that's okay because I have a -404.jpg image in there anyway that might mess that up, for when people try to mess with the ID manually and put in something other than what I have comics for.

Check it out wink

http://superstickphase.com/index.php?id=1022 for example

I will look back at the code you suggested once I get everything working the way I want. I'll make a(nother) backup of it working 100% the way I (currently, heh) want and then mess with it.



 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
oh, and about the buttons.

One way of doing it.

$output = '
[lots of html code]';
if ($current!=$newest) { //if the current comic is diffrent from the newest.
$output .= 'html to echo the button'.$page_variable_here.'more html to end the button';
}else {
$output .= 'html to echo disabled button';
}
$output .='More html';

echo $output;

If that makes any sense happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Oh, I should mention that the button's aren't traditional, they're just css/links.

But, that wouldn't seem to matter with your last post. That looks interesting..

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Phases_OgMaxim posted:
This morning and set a $first variable at 1001, but it's not automated. But that's okay because I have a -404.jpg image in there anyway that might mess that up, for when people try to mess with the ID manually and put in something other than what I have comics for.


Myes. You can always see the contents of your array by using print_r($array) your first image should have the same pos. every time, as long as the file structure remains the same.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Phases_OgMaxim posted:
Oh, I should mention that the button's aren't traditional, they're just css/links.

But, that wouldn't seem to matter with your last post. That looks interesting..


Yeah, you use .= to append stuff to a variable, works nicely happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
is it just me or is the bb code in here not working.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
The bbcode is pretty limited, and even more so if you're not an insider.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Man that took forever. It took Phases long time to get the nesting of <?php's and echo's right.

The next/last buttons are greyd out and not clickable when on $newest and the previous/first are when on $first.

Yay!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
grin Grats :]

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
And now they're centered in one spot so they don't jump around as I you cycle through different sized comics.

grin

Just thought I'd give you the play by play.

You any good with SQL?

I'm gunna tackle a couple things next that will need it, so I may have questions. wink

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
my diploma says I'm decent :>

Its been a while since I've done much apart from a few minisites I've put up. Doesn't hurt to ask though happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I have a web authoring technical certificate.

<marvin>But you can't tell, can you?</marvin>

:P

It may be five minutes, it may be later tonight or it may be tomorrow night before I start that project though. I'm exhausted.

Thanks for hangin' around. I'll play by play ya with details when I get started. Just so you can follow along. Cuz... I'm sure you have nothing better to do. wink

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
haha, boring days at work atm, so don't worry about it happy

I'm in Norway though, so working a diffrent scedule happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
beibhinn 
Title: Snr. Board Mgr
Posts: 36,781
Registered: Jun 18, '02
Extended Info (if available)
Real Post Cnt: 34,969
User ID: 689,760
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I've no idea what went on in this thread, but whatever it was - it was awesome applause applause

 

-----signature-----
-=- Vault Editorial Coordinator -=-
http://vault.ign.com
-=- Templar Knights -=-
http://www.tkfu.com
[Lakoz] she plays the "sweet" lady...and then when she gets comfortable in vent and in game, she turns into Medusa
Link to this post
Evilynne 
Title: Inamorata
Posts: 18,636
Registered: Sep 2, '04
Extended Info (if available)
Real Post Cnt: 16,432
User ID: 963,048
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
beibhinn posted:
I've no idea what went on in this thread, but whatever it was - it was awesome applause applause

 

-----signature-----
Time has stopped before us, the sky cannot ignore us, no one can separate us, for we are all that is left. The echo bounces off me, the shadow lost beside me, there's no more need to pretend, cause now I can begin again

Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Oh it WAS awesome! And with any luck it's going to get more awesome. wink

Raiz, check this out.

How crazy does this sound. Ok, so the sites workin' real well with the images numbered 1xxx.jpg, which is fine by me and I don't plan to change that.

But, get this. You see the "Archive" page on there? I'm manually editing that. What say you, to this:

Either, a) start naming the files 1xxx_Name_of_Comic.jpg and have the index page do what it's doing.. and in addition have the archive page strip out the first five chars and NOT use them, replacing all underscores with spaces - so it just displays the name but still links to the comic - whiles till keeping them in numerical order.

Or b) keep naming files as is but have some special tag on them that I'm currently unaware of that the archive page pulls from to get a title I set, yet still sort them in order of the numbers. (I feel like there are meta type tags that can go on media.. for author and crap like that?)

What do you think of thems apples?

Edit: Ok on first test, just renaming the files 1xxx_whatever.jpg breaks them, the script explodes out more than just the extension?
Edit again: aww crap, this would mess it all up anyway, the way the + and - 1's work and what not.

Ah well, no biggie. happy

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
you can use a database to do that.

you just need a simple table with two values.
Just use a SQL database for the archive I guess.

------------------
| id | title |
------------------
|1001|description|
|1002|description|
|1003|description|
------------------

To make a link, just do a select to get it all, print the link as <a href="images/[id]">[description]</a>

Make a loop of it, and you're set.

(my dp.php file: http://pastecode.org/7638)

to use it, just include it (include 'db.php';) in the files where you need a database connection.

<?

$sql = "SELECT * FROM tablename";
$query = mysql_query($sql)
or die(mysql_error());

while ($db_row = mysql_fetch_array($query)) {
echo "<a href=\"images/".$db_row['id'].".jpg\">".$db_row['description']."</a>";
}

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
the only problem with that, is that you have to populate the database somehow. This can also be done via PHP but then you're talking a bit of work.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Yeah, which sorta defeats the purpose.

But check it out, I added a jCarousel to the archive!

http://superstickphase.com/archive.php

Pretty pimp I think!

Now I guess I'd have to figure out a way to edit the .php when an image was loaded in, and that'd have to be a cronjob I guess of some sort, with a bit of scripting to find the ul and add a li at the end, so... yeah. A bit beyond the scope of this methinks :P

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Evilynne 
Title: Inamorata
Posts: 18,636
Registered: Sep 2, '04
Extended Info (if available)
Real Post Cnt: 16,432
User ID: 963,048
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
so, now we have reached even more awesome?

 

-----signature-----
Time has stopped before us, the sky cannot ignore us, no one can separate us, for we are all that is left. The echo bounces off me, the shadow lost beside me, there's no more need to pretend, cause now I can begin again

Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
well, you can always call the images. 1xxx_whatever-you-want.jpg. And rewrite the explode function. then load only the numbers into an array and sort it.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Do you know if it's possible to have <li> or <ol> but not have it break lines? so instead of the output being

1.
2.
3.

I can have 1. 2. 3. ?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Digero 
Posts: 7,435
Registered: Oct 21, '02
Extended Info (if available)
Real Post Cnt: 7,359
User ID: 729,875
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Phases_OgMaxim posted:
Do you know if it's possible to have <li> or <ol> but not have it break lines? so instead of the output being

1.
2.
3.

I can have 1. 2. 3. ?


As far as I know, this isn't possible with HTML*. If you're generating the list with PHP, you can just keep track of the numbers with a counter variable.

<?php $i = 1; ?>
<?= $i++ ?>. Apple <?= $i++ ?>. Bananna <?= $i++ ?>. Cranberry
<?php
foreach ($moreFruits as $fruit) {
echo $i++,". $fruit ";
}
?>


* You can use the display:inline style for the <li> elements but then it won't show the numbers.

 

-----signature-----
[LotRO] Digero (Guardian), Digrim (Burglar), Dignite (LM), Azrea (Hunter) - Landroval
[AC] Digero, Lyera, Draxxe - Leafcull (Retired)
[CoH] Devil's Zealot, Scinta, Izzard - Guardian (Retired)
Digero's AC Decal Plugins: http://decal.acasylum.com
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I don't want the numbers, but they were better than the bullets... so that works perfect!

What happened was - that archive scroll I have here:

http://superstickphase.com/archive.php

Someone pointed out that with high security settings, with "Active Scripting" disabled (or the no-script plugin with firefox) it just displayed the pictures as a list with bullets all down the page. Can you imagine what that would do with 100 comics?

SO, now, with the inline style it just does rows of thumbnail pictures and works out pretty nice.

Perfect.

Thanks!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
ChiBKey 
Title: lol icon
Posts: 1,515
Registered: May 5, '06
Extended Info (if available)
Real Post Cnt: 856
User ID: 1,136,332
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
beibhinn posted:
I've no idea what went on in this thread, but whatever it was - it was awesome applause applause
I lol'd reading this post.

So is Raiztlin still available or what? Cause I could use a help with PHP tables. tongue

 

-----signature-----
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
shoot. happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Raiz is pimp. My new buddy. :P

..... So just an update - my 'server' has been crashing, 3 times this week so far. It is just a 5.5 year old regular desktop, after all. It gave me these very problems a few years back which is why we built our new(er) desktop to begin with. So, anyway - I found a 2 or 3 year old entry level PowerEdge I'm picking up tonight. This would be why you haven't heard from me after being promised I'd enlist your aide/advice with the SQL stuff. I gotta get this taken care of first.

HOPEFULLY by the end of the night, if not surely mid weekend, everything will be setup and operational and I can drive on. But, let's knock on wood with that because we all know how that can go, I'm sure.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
hehe, good luck with that happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
ChiBKey 
Title: lol icon
Posts: 1,515
Registered: May 5, '06
Extended Info (if available)
Real Post Cnt: 856
User ID: 1,136,332
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Awesome. :) Haha, sorry to "use" your thread for this, Phase.

I recently learned about the Next/Previous links too, but now this is for query sorting using links in the table headers. This is the test page for it live.

By default my table is sorted by ID descending. The command:
PHP code
$query = "SELECT ID, FeaturedCharacter, Rank, Average, TotalVotes, FivePoints, FourPoints, ThreePoints, TwoPoints, OnePoints, DateUpdated, Poll FROM TsundereOrNot ORDER BY ID DESC LIMIT $offset, $rowsPerPage";

I want to make the table headers to be clickable. When user clicks on "Character", the table should be sorted by the character's name alphabetically ascending. When "Character" is clicked again, the alphabetical sorting should go descending.

When user clicks on "Average", the table should be sorted from the highest number to lowest (descending). When "Average" is clicked again, it would sort from lowest to highest (ascending).

And same for LastUpdated, TotalVotes, and the other columns you get the idea...

It's pretty much the same exact concept as this, where you can have the table sorted by whatever is clicked in the table header.

I tried some codes found at Google but they just won't work, perhaps cause my table is structurally different. My difficulty is pretty much how to apply it for my page. tongue
< The php file here >

Thanks.

 

-----signature-----
Link to this post
Digero 
Posts: 7,435
Registered: Oct 21, '02
Extended Info (if available)
Real Post Cnt: 7,359
User ID: 729,875
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
There are generally 3 ways you can go about making a table sortable.
  1. The most straightforward is to make the headers links to the current page but with a parameter telling which column to sort by (and optionally, whether it's descending or not):
    <a href="<?=$_SERVER['SCRIPT_NAME']?>?p=<?=$pageNum?>&orderby=Rank&desc=0">Rank</a>

    In the PHP code, check for the orderby command, verify that it's one of the values you expect, then change your SQL statement to order by that field. Let me just re-iterate that you should verify anything given to you by the user, especially if you're going to use it in an SQL statement; if you don't, then you're vulnerable to SQL injection attacks, among others.

    For example:
    $valid_orderby = array("ID", "FeaturedCharacter", "Rank", "Average", "TotalVotes", "DateUpdated");
    $orderby = $valid_orderby[0];
    if (isset($_GET['orderby']) && in_array($_GET['orderby'], $valid_orderby))
    {
    $orderby = $_GET['orderby'];
    }

    $desc = "";
    if ($_GET['desc'])
    {
    $desc = "DESC";
    }

    $query = "SELECT * FROM TsundereOrNot ORDER BY $orderby $desc LIMIT $offset, $rowsPerPage";
    To make it so clicking on a header toggles DESC, one way is to use a function:
    function is_desc($header)
    {
    global $orderby;

    if ($header == $orderby)
    {
    return !$_GET['desc'];
    }
    return false; // Optionally you can specify defaults per-column here
    }

    And then in the URL above, use &desc=<?=is_desc('Rank')?>
    (I haven't tested any of this code, so there may be bugs or typos).

  2. Another way is to put all of the table data in a javascript array, and use javascript to generate the table and do the sorting. This has the benefit that it's fast -- it doesn't require a page reload to sort the data. However, it can only be used if all of the data fits on one page, which doesn't seem to be the case here.

  3. The most complicated way that combines the best of options 1 and 2, is to use AJAX to retrieve the data from the server in either XML or JSON format. Whenever you want to sort or change pages, you just make an AJAX request with the new parameters, then repopulate the table using javascript. I'd only recommend this if you like playing around with new stuff and want to learn about AJAX. It could take a long time to get it working if you've never used AJAX or more advanced javascript before.

If you want to do options 2 or 3, you should consider using a javascript library that makes it much easier to do complicated things with javascript, like generating the table or doing the AJAX request. There are dozens of good javascript libraries -- jQuery is one of the more popular ones.

 

-----signature-----
[LotRO] Digero (Guardian), Digrim (Burglar), Dignite (LM), Azrea (Hunter) - Landroval
[AC] Digero, Lyera, Draxxe - Leafcull (Retired)
[CoH] Devil's Zealot, Scinta, Izzard - Guardian (Retired)
Digero's AC Decal Plugins: http://decal.acasylum.com
Link to this post
-FIGS- 
Title: Eh?
Posts: 5,317
Registered: Mar 26, '08
Extended Info (if available)
Real Post Cnt: 666
User ID: 1,286,205
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I want your brain Raiztlin!!

 

-----signature-----
Team FIGS! ~ Midgard/Hibernia
http://gimpchimp.etilader.com/s.php?u=figs_mid
http://gimpchimp.etilader.com/s.php?u=figs_hib
A graveyard is full of indispensable people.
Link to this post
ChiBKey 
Title: lol icon
Posts: 1,515
Registered: May 5, '06
Extended Info (if available)
Real Post Cnt: 856
User ID: 1,136,332
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
The first method is what I need for now, but I'll keep an eye on the other two when I learn more of those language. Right now, I know just enough to run a simple table like this. :P

Oh yeah, almost forgot one of the challenges here is to keep the <td> links code working while maintaining the next/previous links.

Just to be certain here, where do I need to plug in the $orderby command? Does it have to be before the pagination or anywhere after that? I tried it for the Rank and getting a query error. < php code here >

 

-----signature-----
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
-FIGS- posted:
I want your brain Raiztlin!!


Lol grin

It's not that difficult really. and 3 years of schooling for that kinda thing helps wink

As for you ChiBKey, listen to Digero, he's giving you solid advice :] I'd help you out, but right now I have to be at work in 3 hours and the new wow expansion has kept me up far far far far too long :<

quick edit: if you use http://pastecode.org/ your code is color-coded, so its easyer to read happy

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Hey I don't mind the thread being used for whatever php/sql help. wink

Just to give an update because I know you're all dying to know - the server update went well! Got my site back up in a couple hours. Woulda been less but I ran into a couple issues (like .. cough.. not havng a USB keyboard in my pile of keyboards), etc. Then used today to troubleshoot other little problems I got from restoring everything. Databases, home directories, etc.

Got another UPS yesterday for it so I'll install that in the morning, but overall - done and success!

Will get back to my site and the stuff Raiz knows is coming before too long. Heh. Here's my current to do list:

-comment system
-perhaps automating my archive page
-setting up email server and letting people subscribe for updates
-feedback system, survey/poll style.

....and I'm acting like my site is popular or something. :P

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
What up Raiz, you still around? Gearing up to get my next little project started. I don't imagine it to be something I can't figure out, but I might have some questions for ya. Basically here's what's to come:

http://superstickphase.com/notify.php
http://superstickphase.com/contact.php

For the first one, notifications.

What I want to have happen (what seems best anyway) is when people fill out the form to get notifications and hit submit.. have php do the following:
- See what they chose to fill in. Whatever they left blank use a dash (-) for the variable.
- Check that the email is in fact an email (or at least something@something.something)
- Append that data into an existing file on my server. The file entries look just like this:

nickname|first|last|email|

I don't plan to use nicknames, so probably just use a dash for that. So I imagine say, five sign-ups, the file could look something like this

-|-|-|someone@gmail.com|
-|-|-|someoneelse@yahoo.com|
-|Deirdre|-|deirdres@email.com|
-|-|Bob|Bobster|bobbobster@comcast.net|
-|-|-|raiztlin@youknowyouwanttosignuponmysite.com|

this file isn't in my web dir so I guess I'll have to give apache rights to it or make a symlink to it but I'm not too worried about that.

As for the second part of notify.. removing an email. I think automating that might not be worth the trouble it would probably be to get php to read the whole file and pull out the line with the input'd email. (or would that be easy?) So I was figuring I'd just have that append to some other file that'd I'd just periodically check and manually remove the people.

((SEE EDIT BELOW)) The second page, the contact me. I'd like to have my mail server email that to my mail account, but I'm not sure how simple that would be. I bet it'd be easier to have it toss that into a sql database and make a page I use to view it all. Like a little mini webmail page. That shouldn't be hard. I'll just have to brush (way) up on my mysql skillz.

So. There's my plan. Whatcha think?

Edit: Ok! Well the contact me was easy! Following this for guidance: http://www.visn.co.uk/form-mail.html and doing a little tweaking, and works pretty well. I've got it emailing to two accounts, and also making sure there is something actually in the note field before it accepts the submission. Rockin'! However.. it puts slashes before quotes and apostrophes. It sorta sucks but I can certainly live with that. It's functional and that's all I really care about. So, onto the notification list...

Edit 2: Alright, have the notify page sending the add form variables to one php page for processing, and the remove part sending to a second php page for processing. I have both set to reject submission with no email filled in. Working on the submitting for notifies, this is what I've got that isn't ((EDIT: is now!) working:

$first = $_REQUEST['first'];
$last = $_REQUEST['last'];
$email = $_REQUEST['email'];
$entry = "-" . "|" . "$first" . "$last" . "|" . "$email" . "|" . "\n";
$fp = fopen('/path/to/file', 'a');
fwrite($fp,$entry);
fclose($fp);

Man I rock.
I'd like though, for it (just like the contact me form) to check that it's at least in correct email format before accepting it, and I'd also be cool with it checking for duplicate addresses.
But it works! On to auto removal..

Edit 3..how would I do this? file_get_contents.. then remove the line with the address, then file_put_contents?

Alright no more edits tonight I promise! Imma get some sleep right quick.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Morning. Ok here's the short version of where I still stand on my last post's progress. Will update it as things change.

-Would like my notification sign up form to check email addresses for syntax. (check!)
-Would like my contact me form to check email addresses for syntax..That field is optional on this form. (check!)
-Wouldn't mind if I could make it so it doesn't put slashes in the data I collect before apostrophes and quotes. (check!)
-Remove from notifications form still not functional. Would like it to remove from the file automatically. (check!)
-Would like my notification sign up and removal form to check for existing email address when submitted and let user know.

Edit: ..alright I've done pretty good on my own and made pretty good time happy . But, the last two ^^ I think I might need help with..
Edit: Working on auto removal in mailing list. I can get php to open and read the file, put it into a string and print it out.. and replace the email address but, I need it to replace the email address and everything touching it (so the whole line will be replaced..with a space). Here's what I'm toying with at the moment:
Edit: Got it. It just replaces the address with a space, my address book shows the entry but iwth no address, and when I go to compose and email the list those entries get ignored. Good enough!

Now all that's left of this part of the project is to check for existing and honestly I'm not that worried about it until I actually start getting some sign ups. Dupe's are ignored on the email out anyway, and all instances of an email address are removed when asked too so.. no change in functionality, just to keep it clean.

.. I debate a comment system..

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Looks to me like you're doing good happy

I don't understand why you're using textfiles to save your userdata though, would be a lot easyer to put it all in a database grin

I'd just put it all in a table, that way you can pull the exact data you want to, whenever you want to. Making emailing your users super easy (esp with the built in php mail() function.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Well, because I use an existing front end for the email.. so I'm just using the address book file that it uses by default. I have a "newcomic" account set up so any address that makes it into it's address book is solely for this purpose. It wouldn't be a cookie cutter email either, it's going to tell of the new comics then also any news that there may happen to be.

happy

Edit: and how dare you disappear when I need you. Don't you know you're supposed to be on standby awaiting requests from me at all times?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
well, I usually just browse this board once a day really :]

You can feel free to add me to your msn, my addy is kellendil@gmail.com

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Only use yahoo, and that's only when I'm at home, and that gchat thing I use here at work too. Perhaps if I have a pressing matter I can email that addy and let ya know there's something here, then at same time that'll put you on the gchat contact list?

Anyway, check this out! I'm proud of me. I've started a new project on the site because I got a wild hair and realized I could do it, so I am. It's real sloppy at the moment but getting more and more functional.

I made a manage (password protected area) of the site with the following so far:

---------------------------------------------------------
manage.php (this just the php, stripped out formatting):

<!-- File Upload, This is on all the pages in the manage area, and submits to a uploader.php page for processing. Works well! -->

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
File: <input name="uploadedfile" type="file" size="10"/><br />
Directory: <input type="radio" name="dir" value="images">Images
<input type="radio" name="dir" value="archive">Archive<br>
<input type="submit" value="Upload" />
</form>

<!-- End File upload -->

<!-- check for need to edit file with data sent back from fileedit.php which I'll show ya in a sec.-->
<?php
if (isset($_POST['filetoedit'])) {
$filetoedit = $_POST['filetoedit'];
$newcontent = $_POST['newcontent'];
$newcontent2 = stripslashes($newcontent);
$fp = fopen($filetoedit, 'w+');
fwrite($fp, $newcontent2);
fclose($fp);
}
?>
<!--- End check for need to edit file -->

<!--- Display contents of root dir and the main 2 other directories I edit files in -->
<?php
$dir = '/var/www/';
$files = scandir($dir);
echo "<b>Files in ".$dir.":</b><br>";
for($i=0; $i < count($files); $i++) {
echo "<a href='editfile.php?id={$dir}{$files[$i]}'>";
echo "$files[$i]<br>";
echo "</a>";
}
?>

<?php
$dir2 = '/var/www/files/';
$files2 = scandir($dir2);
echo "<b>Files in ".$dir2.":</b><br>";
for($i=0; $i < count($files2); $i++) {
echo "<a href='editfile.php?id={$dir2}{$files2[$i]}'>";
echo "$files2[$i]<br>";
echo "</a>";
}
?>

<?php
$dir3 = '/var/www/manage/';
$files3 = scandir($dir3);
echo "<b>Files in ".$dir3.":</b><br>";
for($i=0; $i < count($files3); $i++) {
echo "<a href='editfile.php?id={$dir3}{$files3[$i]}'>";
echo "$files3[$i]<br>";
echo "</a>";
}
?>
<!-- End display contents of 3 main directories -->
-------------------------------------------------------

As you can see those three main directory contents are clickable and go to a edit.php page that puts all the contents into a textarea, and lets me change it around, hit edit, and then from there it's sent back to this page for processing.

Here are other pages' php content in case you're interested:

-----------------------------------------------------
uploader.php:

<?php
if (($HTTP_POST_VARS[dir])==("archive")) {
$target_path = "/var/www/archive/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "<center>The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded. Back to <a href='manage.php'>Manage.</a></center>";
}

else {
echo "There was an error uploading the file, please try again!";
}
}

elseif (($HTTP_POST_VARS[dir])==("images")) {
$target_path = "/var/www/images/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "<center>The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded. Back to <a href='manage.php'>Manage.</a></center>";
} else {
echo "There was an error uploading the file, please try again!";
}
}

else {
echo "<center>Please select an upload directory.</center>";
}
----------------------------------------------------

------------------------------------------------------
and finally editfile.php that takes the clicked file from the listing on manage.php and lets you edit contents:

<?php
if (isset($_GET['id'])) {
$file = $_GET['id'];
$fp = fopen($file, 'r+');
$content = fread($fp, filesize($file));
fclose($fp);

echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">'.$content.'</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>';
}
?>
-------------------------------

So that's tight, but a problem I'm having is when I actually click to edit the edit.php file, it gives me all the code up to the '.'$content.'

..in the text area, and then ends it and shows the edit button and then AFTER that, shows

';}?>

.. then puts another edit button. So I guess it's processing what it's supposed to be showing me. So that's sorta weird.

Soon as I get that figured out I'm going to have some cleaning up to do.

-I'd like it to NOT show the . and .. on the dir listings,
-I'd like the folders to either not show, or when clicked show the files within. At the moment they go to edit.php and fail with unopenable stream.
-I'm going to make edit/delete/copy/newfolder/newfile buttons happy

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
This is killing me. When it makes the text area to echo $content into for the edit.php page on the edit.php page, it makes the text area to put the content in fine, and does spit out $content up to that point. But when it's trying to echo the closing </textarea> tag within $content, the site actually works the tag instead of just prints it inside the textarea.

If I just remove </textarea> altogether it works, but then it breaks the rest of the page on down.

Any way past that?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Good job so far :]

As for the textarea that's pretty damn weird, I'm sure there's just something we're both missing that's causing it grin

You could see if it is the single quotes that does it:
echo "<center>"
"<form action=\"manage.php\" method=\"post\">
<textarea cols=\"125\" rows=\"50\" name=\"newcontent\">".$content."</textarea><br>
<input type=\"hidden\" name=\"filetoedit\" value=\"".$file."\"><br>
<input type=\"submit\" value=\"edit\">
</form></center>";
}

if not that, try splitting it up into more then one echo statement.

As for showing the . and .. in the dirs, those are just the two first items in the array created, you should be able to strip those without much difficulty.

"-I'd like the folders to either not show, or when clicked show the files within. At the moment they go to edit.php and fail with unopenable stream."
Not sure I understand what you mean here.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
[Edit - see bottom reply]

Ah thanks for the reply! I hope you can help me.

I've tried it with double quotes, singles, multiple echo statements.. I can't get it to NOT work the </textarea> !! sad It's driving me nuts.

As for stripping . and .. - I agree it should be easy but I want to get past this hurdle first.
As for the folder thing.. At the moment it lists all files and folders in the directory. just names. so like:

file.php
file2.php
folder
file3.php
folder2

Makes each one clickable to editfiles.php?id=[whateveryouclicked]
So if I click file.php, it goes to editfiles.php?id=file.php

When it gets to editfiles.php it pulls the id and makes it a variable:
$variable = file.php

Then in it freads the conents of $variable and puts it into the text box.

If it's a folder I click, say 'folder' in the above example, it sends it to editfiles.php?id=folder
sets it: variabe = folder
then trys to fread folder, which gives me a 'stream failed, may be a folder' error message.

.... as for the </textarea>.... (here come some edits)

Edit: I've tried the following:

echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">'.$content.'</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>';

and

echo "<center>
<form action='manage.php' method='post'>
<textarea cols='125' rows='50' name='newcontent'>".$content."</textarea><br>
<input type='hidden' name='filetoedit' value='".$file."'><br>
<input type='submit' value='edit'>
</form></center>";

and

echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">';
echo $content;
echo '</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>''

and more... all same result.

edit 2: your suggestion to try:

echo "<center>
<form action=\"manage.php\" method=\"post\">
<textarea cols=\"125\" rows=\"50\" name=\"newcontent\">".$content."</textarea><br>
<input type=\"hidden\" name=\"filetoedit\" value=\"".$file."\"><br>
<input type=\"submit\" value=\"edit\">
</form></center>";

.. same(ish) result. Still prints all the way up to >".$content." ..then the the textarea closes with </textarea>

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
[EDIT: see bottom reply]

I may or may not be onto something:

$replace = '&lt;textarea&gt;';
$newcontent = str_replace("</textarea>", $replace, $content);
echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">'.$newcontent.'</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>';

It works and doesn't break the page, however the $newcontent displayed also does the replace:

$replace = '</textarea>';
$newcontent = str_replace("</textarea>", $replace, $content);
echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">'.$newcontent.'</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>';

... so that if I then saved the page, it would re-break it.
Thoughts?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
[Edit out - didn't work. (well, worked great except for the manage page, then it would replace it's own code to replace code.) See next reply]

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Friggin' FINALLY.

Here's final (php part of the) pages:

---------editfile.php:

<?php
if (isset($_GET['id'])) {
$file = $_GET['id'];
$fp = fopen($file, 'r+');
$content = fread($fp, filesize($file));
fclose($fp);
$replace = '&lt;/textarea&gt;';
$newcontent = str_replace("</textarea>", $replace, $content);
echo '<center>
<form action="manage.php" method="post">
<textarea cols="125" rows="50" name="newcontent">'.$newcontent.'</textarea><br>
<input type="hidden" name="filetoedit" value="'.$file.'"><br>
<input type="submit" value="edit">
</form></center>';
}
?>

---------manage.php:

<?php
if (isset($_POST['filetoedit'])) {
$filetoedit = $_POST['filetoedit'];
$newcontent = $_POST['newcontent'];
$newcontent2 = stripslashes($newcontent);

if ($filetoedit != "/var/www/manage/manage.php") {
$newcontent3 = str_replace("replace = '</textarea>'", "replace = '&lt;/textarea&gt;'", $newcontent2);
$fp = fopen($filetoedit, 'w+');
fwrite($fp, $newcontent3);
fclose($fp);
}

else {
$fp = fopen($filetoedit, 'w+');
fwrite($fp, $newcontent2);
fclose($fp);
}
}
?>

<napoleon dynamite>Yessssss</napoleon dynamite>

...good god almighty. That took almost 8 hours to figure out.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Aha, ofcource :> told you it was something easy :]


The folder problem: check to see if the file you recieve has a file ending you accept, else fallback to listing a dir.
The dots: just skip the two first results from the array when you print.

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Started the ($i=2) to skip the dots..

As for the folder suggestion... Well, I have files with no .ext and some files that are something.something.something you know, so.. gunna have to figure that out.

One thing I could work with - All folder filesizes seem to be 4096 so far...

(Right now i have it printing filesize too)

This is super fun. But, I head home now and get ready to go see my neighbors daughter play in her school band. happy

Fun stuff, thanks for keepin' me company! Next up, later tonight or tomorrow afternoon - formatting manage.php and maybe putting in copy/delete/newfolder functions!

Funny thing is I'll probably rarely ever use this stuff. heh. Good to get practice though on a site that is fun to do.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
okay, in that case, check to see if you get an error before printing, if you do fall back to listing the dir :]

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Word, I like that.
I have some other pretty cool ideas too. grin

Going to a seminar this morning though.. sigh.

Stoopid werk.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Hey.. I wonder, can php be used to run a script in your filesystem?

edit: obviously... man I'm about to have some fun!

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
So it turned out my solution for the textarea problem was not solved, the manage page was still buggy and ended up overwriting itself with wrong data.. in teh replace the replacements string.

Then it hit me.

use include('closingtextareatag.php')

Reduced code and solved easily.

Why didn't I think of that long ago?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Man I hope you have some ideas on this. I'm pulling my hair out. Been messing with this for hours.

I'm trying to get it to make a temporary backup of files as I edit them, so I can revert and the click of a button. So I'm taking it a step at a time.

My problem is.. fopen should be creating a file for me, and it works if i just use a regular filepath/name.. but if I try to name it off a variable that's passed to the page, it refuses to open it.

<?php

# get variables
if (isset($_POST['filetoedit'])) {
$filetoedit = $_POST['filetoedit'];
$newcontent = $_POST['newcontent'];
$newcontent2 = stripslashes($newcontent);
# get variables

#backup old
$backupfile = "/media/backup_drive/wwwbackups/temp$filetoedit";
echo $backupfile;
$fpb = fopen($backupfile, 'a+');
#fwrite($fpb, $newcontent2);
#fclose($fpb);
#backup old

#write new
#$fp = fopen($filetoedit, 'w+');
#fwrite($fp, $newcontent2);
#fclose($fp);
#writenew

}
?>

As you can see the writing new is commented out while I figure this out, and so is half the backup script. So what happens, it gets the variables, sets the $backupfile, echo's it correctly, then errors on the fopen, says /correct/path/to/filenamename.php is 'not a file or folder'.

Well I know that, you're supposed to be creating it!

I've tried every combo I can of different ways to get it to work. If I take out the variable and just put

fopen("some/path/file.log", 'w+');

it works. But I need it to go work off the variable.

Thoughts? Ideas?

Edit: I wonder if name is too long? I found something like :

[ENAMETOOLONG] The length of the filename exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.

..when describing scenarios that cause it to fail, but the page from 97 and I couldnt' find PATH_MAX in php.ini...

It ends up being something like /media/backup_drive/backups/wwwbackups/temp/123/456/another/path/hereisfile.php

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I see. Turns out while fopen() can indeed create files, it can't create directories!

I got my 'oh shit backup' done!

It's tight. any time I edit a file on my web based file manager it automajically creates a backup of the file. At the moment the file gets overwrote with the next edit, so I've always got one behind me, but I have plans!

What I'd like to do is put a revert button up that lets me one click revert to the backup, in case of those (and I had one the other day) true 'oh shit' moments. wink
I also plan to have it save 3 or 5 .. haven't decided.. backups of each file and just replace the newest each time, pushing each version back one.

I think I can do it....

..then be able to revert back several version if I wanted. grin

Also, today I got all my log files put into text boxes on a couple pages, that works out nicely! Although, I think when my management area is mostly done and I find myself bored I might get my ajax learn on and tail 'em wink

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I have been computerless the last couple of days :< Glad to see you're still doing good though. At this point, I would be sick and tired of the project already tongue

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Hey Raiz, I gots two questions for ya.

1) You use linux with apache by chance? If so... Any idea how to filter what apache2 writes to access.log ? I'm having a heck of a time figurign that out.

and

2) Do you know the pro's and con's of exec() vs shell_exec()?

I get the same results using the following two snippets of code and wonder if one is better than the other. Maybe less work for server, or maybe other doesn't close the command properly, or whatever:

[code]
$output = shell_exec('tail -15 /var/log/apache2/access.log');
echo $output;
[/code]

and..

[code]
$cmd = "tail -15 /var/log/apache2/access.log";
exec("$cmd", $output);
foreach($output as $outputline) {
echo ("$outputline\n");
}
[/code]

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
I'm afraid I can't help ya there :<

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
That's cool. I got it grin

I have a page with my 13 favorite logs all tailed with ajax!

(they all move in real time with no need to refresh the page)

It's tight.

Next up is going to be the hardest of my project... implementing ajax on my main manage page to drill around in directory structure. You got any ajax exp.?

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post
Raiztlin 
Title: Dick Tracy
Posts: 8,885
Registered: Jan 23, '02
Extended Info (if available)
Real Post Cnt: 8,688
User ID: 626,780
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
none at all actually :<

Actually looking to get something done about that though, although, I have no idea where I'll find the time :]

Christmas is busy for those of us working in retail :]
With work, photography and trying to learn the guitar.. I don't have alot of time grin

 

-----signature-----
I has a flavor!
CC always welcome.
Link to this post
Phases_OgMaxim 
Posts: 9,552
Registered: Jul 16, '02
Extended Info (if available)
Real Post Cnt: 9,053
User ID: 697,927
Subject: Ok board for PHP/SQL help? Looking to make first/previous/next/last buttons
Well it's fun that's for sure. I never got into javascript much though so it's kinda hard to follow. Followed some how-to to get the first script going then built from that.

 

-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull
Link to this post

Valid XHTML 1.0 Transitional Powered by PHP