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
PHP skripta ispisuje samo jedno polje umjesto 25?

 
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
croatius



Joined: 02 Oct 2007
Posts: 34
Location: pumpaona

PostPosted: 02.10.2007 14:18    Post subject: PHP skripta ispisuje samo jedno polje umjesto 25? Add user to your forum ignore list Reply with quote

Jeli mi moze netko reci gdje sam pogrijesio?

http://pastebin.com/m540e4d72 source
Back to top
View user's profile Send private message Visit poster's website
jojo



Joined: 27 Jan 2005
Posts: 1591
Location: insula aurea

PostPosted: 02.10.2007 14:31    Post subject: Add user to your forum ignore list Reply with quote

nisam odavno radila s php-om al onako odokativno čini mi se ko da nema petlje... al ne uzimaj me baš zaozbiljno

_________________
deviant / malomorgen / videoholik / cimer fraj
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 02.10.2007 14:38    Post subject: Add user to your forum ignore list Reply with quote

da, nema petlje.

postao sam na pastebin correction, ali evo ga i ovdje za kasnije:
Code:
<?php
include("cms-header.php");
$connector = new dbConnect();
$result = $connector->query('SELECT * FROM `articles` ORDER BY `article-date` DESC LIMIT 25');
?>
 <tr>
  <td> Dobro dosao, <? echo $_SERVER['REMOTE_ADDR']; ?>!</td>
 </tr>
 <tr>
  <td> Danas je <?php echo date("d.M Y") . " i "; echo date("G:i"); ?> sati. </td>
 </tr>
 <tr>
  <td> &nbsp; </td>
 </tr>
 <tr>
  <td> &raquo; Zadnji clanci: <br>
<?php
        while ($row = $connector->fetchArray($result)) {
                echo $row['article-title'] . " - " . $row['article-date'] . "<br>"; ?>
        }
?>
  </td>
 </tr>
</table
<? include("cms-footer.php"); ?>

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 02.10.2007 14:38    Post subject: Add user to your forum ignore list Reply with quote

Nema petlje da...
Prvo, odakle taj klasa dbConnect, to neka tvoja ili? tražio sam na php.net, nisam našao...
No ok, recimo da $row = $connector->fetchArray($result); pohvata sve rezultate iz baze...

Znači imaš array, sa petljom foreach napraviš slijedeće:
Code:
foreach($row as $data)
{
/* ako želiš ispisat neku varijablu napraviš to sa echo $data[/*polje koje hoćeš ispisat, datum, text, što već trebaš*/];
}


Nadam se da bude od pomoći

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 02.10.2007 14:39    Post subject: Add user to your forum ignore list Reply with quote

evo zytzagoo već postao u međuvremenu... može i delete...

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
croatius



Joined: 02 Oct 2007
Posts: 34
Location: pumpaona

PostPosted: 02.10.2007 15:10    Post subject: Add user to your forum ignore list Reply with quote

Tristan wrote:
Nema petlje da...
Prvo, odakle taj klasa dbConnect, to neka tvoja ili? tražio sam na php.net, nisam našao...
No ok, recimo da $row = $connector->fetchArray($result); pohvata sve rezultate iz baze...

Znači imaš array, sa petljom foreach napraviš slijedeće:
Code:
foreach($row as $data)
{
/* ako želiš ispisat neku varijablu napraviš to sa echo $data[/*polje koje hoćeš ispisat, datum, text, što već trebaš*/];
}


Nadam se da bude od pomoći


Sredio sam to, dbConnect je funkcija. Hvala svima
Back to top
View user's profile Send private message Visit poster's website
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 03.10.2007 19:35    Post subject: Add user to your forum ignore list Reply with quote

Quote:
Sredio sam to, dbConnect je funkcija. Hvala svima


dbConnect je klasa Wink
Back to top
View user's profile Send private message Send e-mail
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 03.10.2007 19:55    Post subject: Add user to your forum ignore list Reply with quote

PaNtHeR wrote:
Quote:
Sredio sam to, dbConnect je funkcija. Hvala svima


dbConnect je klasa Wink


da, baš to i gledam, al nisam htio postat bzvz radi toga... ček, jel to php built-in klasa ili?
našao sam samo funkciju db2_connect

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
PaNtHeR



Joined: 17 Sep 2003
Posts: 161

PostPosted: 04.10.2007 12:41    Post subject: Add user to your forum ignore list Reply with quote

ne vjerujem da je built-in, nije niti bitno, bitno da se spaja Cool
Back to top
View user's profile Send private message Send e-mail
croatius



Joined: 02 Oct 2007
Posts: 34
Location: pumpaona

PostPosted: 06.10.2007 19:19    Post subject: Add user to your forum ignore list Reply with quote

Tristan wrote:
PaNtHeR wrote:
Quote:
Sredio sam to, dbConnect je funkcija. Hvala svima


dbConnect je klasa Wink


da, baš to i gledam, al nisam htio postat bzvz radi toga... ček, jel to php built-in klasa ili?
našao sam samo funkciju db2_connect


nije built-in, sam sam je definirao, btw u mom slucaju je dbConnect i klasa i funkcija..
Back to top
View user's profile Send private message Visit poster's website
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