SeoPedia Forum

Go Back   SeoPedia Forum > Metode de promovare, resurse, articole si tutoriale > Server side
FAQ Spy Members List Calendar Mark Forums Read RSS 2.0 feed

Server side Apache, PHP, ASP, Baze de date, MySql, SQL

Reply
 
Thread Tools Display Modes
  #1  
Old 2nd July 2008, 17:55
Federals's Avatar
Federals Federals is offline
Ambasador
Recent Blog:
 
Join Date: 29th November 2007
Location: Bucuresti
Posts: 612
Rep Power: 8
Federals is on a distinguished road
Default Cum implementez/gandesc asta?

M-am uitat prin codul Joomla/SOBI dar e prea nearanjat si ma ia cu dureri de cap

Daca va uitati la mine pe site, o sa vedeti ca toate anunturile alea sunt asezate in mici tabele si au paginatie. Sa scot dintr-o baza de date informatii si sa le pun in tabele stiu.

Ce nu stiu: cum sa fac paginatia?

Presupun ca trebuie sa execut query-ul, si aflu cate rezultate imi intoarce. Il impart la nr de elemente/pagina (sa zic 10), apoi ce fac? Pt ca vreau si ca fiecare pagina sa fie accesibila prin link.php?nr_pagina=3 de exemplu

Deci trebuie cumva sa inserez si un $_GET['nr_pagina'] pe undeva prin query, cred.

Macar idei, nu codul complet.
Mersi!
__________________
Sisteme CISS
Reply With Quote
  #2  
Old 2nd July 2008, 18:02
Daniel's Avatar
Daniel Daniel is offline
Recent Blog:
 
Join Date: 21st May 2008
Location: Bucuresti(pt moment)
Posts: 295
Rep Power: 6
Daniel will become famous soon enough
Default

da, te folosescti de clauza LIMIT in query.
Code:
SELECT * FROM `anunturi` LIMIT 0, 10
iti va returna primele 10 rezultate, in timp ce
Code:
SELECT * FROM `anunturi` LIMIT 10, 10
returneaza de la 11 la 20
__________________
Domenii
Reply With Quote
  #3  
Old 2nd July 2008, 18:26
Federals's Avatar
Federals Federals is offline
Ambasador
Recent Blog:
 
Join Date: 29th November 2007
Location: Bucuresti
Posts: 612
Rep Power: 8
Federals is on a distinguished road
Default

Mersi!
__________________
Sisteme CISS
Reply With Quote
  #4  
Old 2nd July 2008, 18:33
rnicolescu's Avatar
rnicolescu rnicolescu is online now
 
Join Date: 6th October 2005
Posts: 59
Rep Power: 11
rnicolescu will become famous soon enough
Default

Class Paginator
Ai si exemple acolo.
Reply With Quote
  #5  
Old 2nd July 2008, 18:53
Federals's Avatar
Federals Federals is offline
Ambasador
Recent Blog:
 
Join Date: 29th November 2007
Location: Bucuresti
Posts: 612
Rep Power: 8
Federals is on a distinguished road
Default

mersi!
__________________
Sisteme CISS
Reply With Quote
  #6  
Old 8th July 2008, 19:57
resahc resahc is offline
 
Join Date: 9th February 2007
Location: Iasi
Posts: 130
Rep Power: 8
resahc will become famous soon enough
Default

eu zic ca n-are rost sa te complici cu clase si alte prostii...ca treaba e foarte simpla
ai asa...
$nr_pagina=$_GET['nr_pagina'];
$catepepagina=10; (sau ce valoare ai tu la cate articole per pagina)
$from=($nr_pagina*$catepepagina)-$catepepagina;

si query-ul o sa fie "select ... from .... where... limit $from,$catepepagina"
Reply With Quote
  #7  
Old 8th July 2008, 22:26
Federals's Avatar
Federals Federals is offline
Ambasador
Recent Blog:
 
Join Date: 29th November 2007
Location: Bucuresti
Posts: 612
Rep Power: 8
Federals is on a distinguished road
Default

mersi mult! simplu si eficient
__________________
Sisteme CISS
Reply With Quote
  #8  
Old 9th July 2008, 18:02
danielbuca's Avatar
danielbuca danielbuca is offline
Ambasador
Recent Blog:
 
Join Date: 13th August 2006
Location: Bucharest
Age: 32
Posts: 331
Rep Power: 15
danielbuca is a name known to alldanielbuca is a name known to alldanielbuca is a name known to all
Send a message via Yahoo to danielbuca
Default

Raspunsurile date sunt corecte dar vad ca este un subiect care nu a fost atins de nimeni si anume ce am selectat din post-ul tau.

Quote:
Originally Posted by Federals View Post
Presupun ca trebuie sa execut query-ul, si aflu cate rezultate imi intoarce.
Pentru a afla cate rezultate ai nu trebuie sa folosesti acelasi query ci trebuie sa folosesti un query de genul: Select count(*) from nume_tabela where conditii .
Daca nu sunt conditii atunci nu folosesti where.

Acest query iti va returna exact cate inregistrari sunt in tabela cu un load minim pe baza de date.
__________________
blog Daniel Buca
Reply With Quote
  #9  
Old 10th July 2008, 00:26
Federals's Avatar
Federals Federals is offline
Ambasador
Recent Blog:
 
Join Date: 29th November 2007
Location: Bucuresti
Posts: 612
Rep Power: 8
Federals is on a distinguished road
Default

Pai da, am rezolvat. Mersi tuturor!
__________________
Sisteme CISS
Reply With Quote
  #10  
Old 13th July 2008, 05:27
Joaffx's Avatar
Joaffx Joaffx is offline
 
Join Date: 19th June 2008
Location: Corabia, Romania
Age: 17
Posts: 9
Rep Power: 0
Joaffx is on a distinguished road
Send a message via Yahoo to Joaffx
Default

Federals, sper ca ai filtrat variabila superglobala $_GET inainte sa faci query-ul . Nu cred ca vrei sa te trezesti intr-o zi cu baza de date goala .

Deci asa :
$blabla = $_GET['nr_pag']; // vulnerabila la SQL Injection

Eu folosesc mysql_escape_string();
$blabla = mysql_escape_string($_GET['nr_pag'];

resahc , codul tau este vulnerabil.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ce cod e asta ? Marius ISP Adsense & Adwords 1 7th June 2008 20:24
Ce fel de director e asta? wrc Directoare web straine 4 16th February 2007 10:57
Wtf E Asta ?? Toto Bar, lobby... 2 3rd May 2006 02:41
Cum Sa Fac Asta w3bmaster Discutii generale privind optimizarea si motoarele de cautare 2 12th April 2006 01:59
Cum fac asta... andypopa Client side 7 30th September 2005 14:59


All times are GMT +3. The time now is 07:43.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 2005-2043 SeoPedia, Webotopia

Gazduit de Hangar Hosting

Creaza-ti un cont PayPal astazi!