Forum Home
Press F1
 
Thread ID: 122179 2011-12-06 06:16:00 Putting SQL results onto webpage bot (15449) Press F1
Post ID Timestamp Content User
1247329 2011-12-06 06:16:00 Sorry about the title :)

Basically, my SQL query gets a row from a table containing a link and a title. What I want to do is, for each row, return a div. What I've got now is:


public function getM(){
//$c is the database connection
mysql_select_db("mydatabase", $c);
$q = "SELECT fieldone, fieldtwo FROM mytable WHERE otherfield = 1";
$r = mysql_query($q, $c);
while ($row = mysql_fetch_array($r, MYSQL_NUM)) {
foreach($row as $value){

}
}
}

Unfortunately that's as far as I've got.

Therefore, I want the function to return something like:

<div id="mydiv">
<div class="divitem"><a href="link.com">Title<
<div class="divitem"><a href="example.com">Example<
</div>

Sorry if This isn't clear enough
bot (15449)
1247330 2011-12-07 00:53:00 Could you use echo? Sorry been a long time since I've done anything mysql hueybot3000 (3646)
1