Search found 67 matches

by Dm7
Wed Nov 16, 2005 6:09 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

:/ At least.. is there a way to go to next row and prev row???? without using ID's???
by Dm7
Tue Nov 15, 2005 10:07 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

// i is for number of current image... set one for now $i = 1; while ($row = mysql_fetch_assoc($resulta)) { if ($row['name'] == $_GET['pix']) { break; } else { $i++; } } This loop is giving me problems, i am getting wrong results with that one... it always ends up being $i = 1 no matter where I am ...
by Dm7
Tue Nov 15, 2005 8:51 pm
Forum: PHP - Code
Topic: Randomizing monster spawns [SOLVED]
Replies: 7
Views: 1504

<?php //creates a random number... 1 to 100 (as in 1% to 100%) $rand = rand(1, 100); // checks if it's 5 or less (creating 5% of it) if ($rand <= 5) { echo "Congrats, you got a Red Slime!"; } // checks if there's 25 or less and is greater than 5 (creating 20% of it) elseif ($rand > 5 &...
by Dm7
Tue Nov 15, 2005 8:09 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

$i is 1 $prev is 0 $next is 2 // BETA $sqla = "SELECT * FROM $table ORDER BY date DESC"; $resulta = mysql_query($sql); // i is for number of current image... set one for now $i = 1; while ($row = mysql_fetch_assoc($resulta)) { if ($row['name'] == $_GET['pix']) { break; } else { $i++; } } ...
by Dm7
Sun Nov 06, 2005 12:56 am
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1, 1' at line 1 You can't have a row at offset -1, row 0 (or maybe 1 i dont even know to be honest) is corresponds to the first row. Nah, number for page wo...
by Dm7
Sat Nov 05, 2005 9:43 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

$sqla = "SELECT * FROM $table ORDER BY date DESC"; $resulta = mysql_query($sql); // i is for number of current image... set one for now $i = 1; while ($row = mysql_fetch_assoc($resulta)) { if ($row['name'] == $_GET['pix']) { break; } else { $i++; } } // then sql limit $sqlp = "SELECT...
by Dm7
Sat Nov 05, 2005 7:10 pm
Forum: PHP - Code
Topic: Rainbows!
Replies: 18
Views: 8647

Wowthat'ssobeautiful...:P

LOL I love that code snippet. XD I don't know how you do that... I'm curious where/how you learned about that? :o
by Dm7
Sat Nov 05, 2005 6:27 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

Nah, number for page won't work because I already set it up for view.php?pix=blah.jpg. I can't think of how to make it id=12 instead on my gallery page so I'd like to at least try and get numbers from using pix=blah.jpg So how do I count something and break out when $row['name'] == $_GET['pix'].. wa...
by Dm7
Sat Nov 05, 2005 6:02 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

traversing the results: $offset = 0; while($row = mysql_fetch_assoc($result)) { if($offset == $currentPage) { break; } else { $offset++; } } if(is_array($row)) { // offset was found var_export($row); } Geez I'm lost.. I guess I'll do the $n=1 instead of $pix = blah.jpg for my viewing page. :P Thank...
by Dm7
Sat Nov 05, 2005 3:19 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

Jcart wrote:Its a comparison operator called ternary
Thanks :D Now I understand how it works.
by Dm7
Sat Nov 05, 2005 3:03 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

you don't use the picture's name anymore, or you would have to figure out how far into the data it is by traversing the results.. traversing the results.. how? I'm stupid.. forgive me.. :oops: $first = (isset($_GET['first']) && is_numeric($_GET['first'])) ? $_GET['first'] : 1; Geez that's w...
by Dm7
Fri Nov 04, 2005 10:50 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

jshpro2 wrote:LIMIT $x, 1

Where $x is the # of the pic you want to view, $x doesn't have to correspond to the id
Gotcha, but... how do I get $x? How do I get like $_GET['pix'] and get number for that pic row? Well how do I DETERMINE $x for LIMIT since I use pic name to call stuff.
by Dm7
Fri Nov 04, 2005 10:04 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

So you can see, I only want to show one image at the time... and... I'm not sure how I can do that without ID's...... the url I have given you earlier was a direct url to the viewing page of my gallery. That's what I'm talking about... does anybody have an idea? I don't want it to show rows of stuff...
by Dm7
Fri Nov 04, 2005 7:36 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

Wait, it's for viewing pics...

http://www.dm7.net/gallery/view.php?pix=robotmonkey.jpg
go there so you get a better idea. :)
by Dm7
Fri Nov 04, 2005 5:59 pm
Forum: PHP - Code
Topic: Better way to do it without using IDs?
Replies: 23
Views: 5236

Better way to do it without using IDs?

Right now I'm using ids to calucate the offsets (yes they works fine.. but a bit buggy... read on to see why), but I don't want to use ids for one reason... whenever I delete a file from the database, the IDs aren't right so therefore it get messed up. So I don't want to use IDs (autoin.), so I'd li...