I started this project to be a very secure messaging system for my family, so far everything works except for the the last two mysql_fetch_array for displaying the messages. As of now I don’t know what the problem is because I get the same error message regardless of whether I have the queries before array with the || or as a single variable. The bottom queries are echo’d later on in the file, but they are done in the same fashion as the echo creating the table after the first query.
Error message “Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource”
Any thing you can do to help would be fantastic. I am at my wits end trying to figure it out.
[php]<?php
$query = “SELECT * FROM members WHERE member_id=’”.$_SESSION[‘SESS_MEMBER_ID’]."’";
$result = mysql_query($query);
while ($data = mysql_fetch_array($result)) {
$id = $data[“login”];
$fname = $data[“firstname”];
$lname = $data[“lastname”];
$email = $data[“email”];
$secretq= $data[“secretq”];
echo(“
User ID | $id |
---|---|
First Name | $fname |
Last Name | $lname |
Email Address | |
Secret Question | $secretq |
}
$query1 = “SELECT * FROM mail WHERE to=’”.$id||$fname."’";
$result1 = mysql_query($query1 or die(mysql_error()));
while ($data1 = mysql_fetch_array($result1)) {
$from = $data1[“from”];
$message = $data1[“message”];
}
$query2 = “SELECT * FROM mail WHERE from=’”.$id||$fname."’";
$result2 = mysql_query($query2 or die(mysql_error()));
while ($data2 = mysql_fetch_array($result2)) {
$to = $data2[“to”];
$message = $data2[“message”];
}
?>[/php]