MySQL Forums
Forum List  »  PHP

Re: SELECT not echoing single entries
Posted by: Slava Divxak
Date: July 27, 2005 09:42AM

Keith Mundrick wrote:
> $result = mysql_query("SELECT * FROM table WHERE
> `Date` = '$date' AND `Email` = '$Email' AND
> `First_Name` = '$FirstName'")
> or die(mysql_error());
>
> // store the record of the table into $row
>
> $row = mysql_fetch_array( $result );
>
> // Print out the contents of the entry
> print $query;
>
> while ($row = mysql_fetch_array($result))
> {
> print "$row";
>
> }
>
>
> // Closing connection
> mysql_close($link);

And you want to say it working? :)

> $row = mysql_fetch_array( $result ); - for what? (Here you lost your first record)

> while ($row = mysql_fetch_array($result))
> {
> print "$row";
> }
And what it wrote?

Try so:
$query = sprintf("select * from table where date='%s' and Email='%s' and First_name='%s'",
$date, $Email, $FirstName);
$result = mysql_query($query) or die(mysql_error());

if($result)
{
while($row = mysql_fetch_row($result))
print_r($row);
}

Trust me! I'm the best! :)

Options: ReplyQuote


Subject
Written By
Posted
Re: SELECT not echoing single entries
July 27, 2005 09:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.