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);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.