Jump to content

[SOLVED] Retrieving multiple rows from a table


jscix

Recommended Posts

Ok im having a bit of a problem, This code works.. however, when it finds multiple entries, it is only returning the first one (first row I guess?)

How can I get this to find all the rows, and move on to the next one after putting the data into vars?

 

<?php
$connection = mysql_connect("mysql", "lllll", "lllll");
if (!$connection) { print "Failed to connect to database";}
$db_select = mysql_select_db("posts");
if (!$db_select) { print "Failed to find database";}

$sendsql = "
SELECT *
FROM comments
WHERE tou
IN (
'$curusr'
)
LIMIT 0 , 30
";

$sqlq = mysql_query($sendsql);

if (!$sqlq) { print "Failed to find"; die();}

$dbdata = mysql_fetch_row(($sqlq));

$postid = $dbdata[0]; // post ID
$retuidz = $dbdata[1]; //from user
$retusrn = $dbdata[2]; // to user
$retcom = $dbdata[3]; //comment

print_r ($dbdata);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.