Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » PHP




 Page 1 of 1 [ 3 posts ] 



Author Message
 Post subject: Fetchin the Rows
 Post Posted: Thu Nov 12, 2009 11:00 am 
Offline

Joined: Sat Feb 21, 2009 2:24 pm
Posts: 30
here comes the prob .. i m havin an table named "comments" nd in dis '
code i was been trin to fetch the inputs "tutorialid" nd
"name" what i wan 2 fetch is a certain id 4m da "tutorialid" how would
i go abt doin dis .. heres coms da part of da code.

Code:
$sql = "SELECT tutorialid, name FROM comments LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);


while ($list = mysql_fetch_assoc($result)) {
   
   echo $list['tutorialid'] . " : " . $list['name'] . "<br />";
}


for an instance.. i need all da rows wid da tutorial id "3"
could sumbody pls help?

any help would be appreciated!!

thanks in advance


Top 
 Post subject: Re: Fetchin the Rows
 Post Posted: Thu Nov 12, 2009 11:01 am 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
Code:
$sql = "SELECT name FROM comments WHERE tutorialid='3' LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);

$list = mysql_fetch_assoc($result);

$tutorialid=$list["tutorialid"];
$name= $list["name"];
   
   echo $tutorialid." : ". $name."<br />";
}

Is this the thin u want to use?


Top 
 Post subject: Re: Fetchin the Rows
 Post Posted: Thu Nov 12, 2009 11:01 am 
Offline

Joined: Sat Feb 21, 2009 2:24 pm
Posts: 30
thanks alot!!!
even though it didnt work i 4got WHERE the tutorialid='3' statement..
thats da only thing i needed to add to my original code.

THANKKKS!'
'


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 3 posts ] 




Board index » Server Side Development » PHP


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
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 post attachments in this forum

Search for:
Jump to:  
cron