Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Klikom na sliku, prikazuje se sledeca..., PHP/MySLQ

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
emokiddy



Joined: 12 Sep 2003
Posts: 18

PostPosted: 16.01.2009 02:34    Post subject: Klikom na sliku, prikazuje se sledeca..., PHP/MySLQ Add user to your forum ignore list Reply with quote

Imam galeriju slika koja se otvara preko menija.
Treba mi da na klik na sliku,
prikaze se prva sledeca u bazi.


Code:
<?php
            include("includes/database.php");
            if(isset($_GET["cat"])){
              $category = $_GET["cat"];
            $resultNazivi = mysql_query("SELECT ime,id FROM radovi WHERE kategorija='$category' ORDER BY id DESC ") or die(mysql_error());
            $resultPrviId = mysql_query("SELECT id FROM radovi WHERE kategorija='$category' ORDER BY id DESC ") or die(mysql_error());
            $redPrviId =  mysql_fetch_array($resultPrviId);
            if(isset($_GET["id"])){ $id=$_GET["id"]; }else{ $id= $redPrviId["id"] ;};
            $resultFile = mysql_query("SELECT * FROM radovi WHERE id='$id'") or die(mysql_error());
            $redFile = mysql_fetch_array($resultFile);
            while( $redNazivi = mysql_fetch_array($resultNazivi)){
            ?>


Kako treba da linkujem sliku?
Probao sam da napravim novu promenljivu, $resultFile2 koja bi bila + 1 ali sam negde pogresio.
Zato mi treba pomoc sta i kako.

P.S. - Ako neko moze da mi izvuce iz ovoga i za NEXT i PREVIOUS dugme, bio bih mu neizmerno zahvalan!


H
i
P
Back to top
View user's profile Send private message
snyder



Joined: 21 Dec 2005
Posts: 57
Location: Zagreb

PostPosted: 17.01.2009 09:38    Post subject: Add user to your forum ignore list Reply with quote

prvo polovis get varijable.
Code:

$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$category = isset($_GET['category']) ? (int) $_GET['category'] : 0;


za slijedecu sliku
Code:

select * from radovi where kategorija = $category and id > $id order by id ASC LIMIT 1


za prethodnu sliku
Code:

select * from radovi where kategorija = $category and id < $id order by id DESC LIMIT 1
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
emokiddy



Joined: 12 Sep 2003
Posts: 18

PostPosted: 17.01.2009 14:26    Post subject: Add user to your forum ignore list Reply with quote

OK. Kako da definisem promenljivu za rad, konkretno, sta treba da mi stoji u linku slike?

P.S. - Nemam veze sa programiranjem, ali ponesto razumeme.

[quote="snyder"]prvo polovis get varijable.
Code:

$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$category = isset($_GET['category']) ? (int) $_GET['category'] : 0;
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group