User
Pass
2FA
 
 

request mysql...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message1606
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 21-09-2010, 11:47:37 | Translate post to: ... (Click for more languages)

nu ma descurc cu ceva...

am 1 bz de date 2 table: movies, images.

Code:
include "input/connect.php";

$sql="SELECT movies.id, movies.zzz, movies.original_name, images.id, images.zzz, images.image FROM movies, images WHERE movies.zzz = images.zzz ORDER BY movies.id LIMIT 10";


$result = mysql_query($sql);

while($row = mysql_fetch_row($result)) { ?>

<?php echo $row['original_name']; ?> <br>
<?php echo $row['image']; ?> <br>


<?php } mysql_close($con); ?>


legatura dintre cele 2 este campul zzz prezent in ambele tabele
cum fac sa rezulte echo insa doar o singura data title => image , deoarece in mom de fata face echo la fiecare titlu => de fix X ori cate poze am in tabela cu imagini




tare as fi recunoscator pentru un pic de luminare.... ca deja nu mai pot cate variante am incercat si tot nu imi reuseste -. multumesc
si daca nu prea m-am exprimat pe inteles... scuze nam dormit de ore bune cu asta Angel

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Shocker

[Freakz owner]



Status: Offline
(since 08-02-2020 12:17)
Joined: Momentul zero
Posts: 33986, Topics: 1350
Location: localhost

Reputation: 6485.6
Votes: 829

   
Post Posted: 22-09-2010, 20:25:05 | Translate post to: ... (Click for more languages)

Nu inteleg

FREAKZ COMMUNITY @ Facebook
WOW FREAKZ @ Facebook
0 0
  
Back to top
View user's profile Send private message
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 22-09-2010, 22:52:08 | Translate post to: ... (Click for more languages)

deci repet -

am intr-o singura baza de date 2 tabele movies,images .

in images retin mai multe fielduri(poza2) pentru fiecare field din movies(poza1).

acum in index.php (exemplu) as dori sa afisez ultimele 10 id-uri retinute in movies si pentru fiecare ultimul id retinut in images unde movies.zzz = images.zzz

gen :
Code:
SELECT movies.*, images.* FROM movies, images WHERE (movies.zzz = images.zzz LIMIT 1) ORDER BY id LIMIT 10 DESC


dar comanda de sus nui buna -

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 27-09-2010, 14:35:09 | Translate post to: ... (Click for more languages)

SELECT m.*, i.* FROM movies m, (SELECT k.* FROM images k, movies p WHERE k.zzz=p.zzz LIMIT 0,1) i ORDER BY m.id LIMIT 10 DESC

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
Shocker

[Freakz owner]



Status: Offline
(since 08-02-2020 12:17)
Joined: Momentul zero
Posts: 33986, Topics: 1350
Location: localhost

Reputation: 6485.6
Votes: 829

   
Post Posted: 28-09-2010, 01:08:38 | Translate post to: ... (Click for more languages)

Nu poti cu un singur query. Cu unul iei ultimele 10 ids si cu al doilea iei imaginile corespunzatoare ID-urilor alora

FREAKZ COMMUNITY @ Facebook
WOW FREAKZ @ Facebook
0 0
  
Back to top
View user's profile Send private message
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 28-09-2010, 06:58:34 | Translate post to: ... (Click for more languages)

am rezolvat altfel pana la urma am retinut toate imaginile intrun camp in movies.images
Code:
@03d/4c36037a7b9aa102cc00003d/some-like-it-hot/jpg@1b6/4c30baeb5e73d63ccd0001b6/some-like-it-hot/jpg@a99/4bc9058d017a3c57fe001a99/some-like-it-hot/png@140/4c7ebc775e73d648e2000140/some-like-it-hot/jpg@157/4c7ebc535e73d648de000157/some-like-it-hot/jpg@146/4c7ebca05e73d648e2000146/some-like-it-hot/jpg@155/4c7ebcc05e73d648df000155/some-like-it-hot/jpg@15d/4c7ebcd35e73d648de00015d/some-like-it-hot/jpg


si am lucrat cu foreach, in unele cazuri index.php am extras prima poza in altele toate
bineinteles m-am folosit si de split("@",$row['images'])

cat despre query-ul tau nr913 ramane la bookmarks de testat pt proiectele viitoare - thx

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Shocker

[Freakz owner]



Status: Offline
(since 08-02-2020 12:17)
Joined: Momentul zero
Posts: 33986, Topics: 1350
Location: localhost

Reputation: 6485.6
Votes: 829

   
Post Posted: 28-09-2010, 07:30:46 | Translate post to: ... (Click for more languages)

Daca chair vrei asa foloseste implode() si explode() pe viitor, sau serialize() si unserialize()

FREAKZ COMMUNITY @ Facebook
WOW FREAKZ @ Facebook
0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 03-12-2024, 07:59:55
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x