This thread is reaaally dragged out.
Pay attention to this line:
PHP Code:
if( mysql_num_rows( mysql_query( $ck_reciever ) ) == 0 )
Nowhere in your code is $ck_reciever declared, therefore mysql_query() is querying nothing, returning false (and a false value is passed as the parameter to mysql_num_rows(), which is why you're getting a an error that a boolean value is being passed as the parameter to mysql_num_rows().'
I think when bluewalrus asked you to change the code, he assumed that you would leave the query in the code.
Try this:
PHP Code:
<?php
// that's another possible cause of your blank page
require "database.php";
$userfinal=$_COOKIE['ID_my_site'];
$user=$userfinal;
echo $user; //<-- if there is no cookie, then $user will be empty
// and you won't see any output.
// if this is the case, and you also don't see any errors,
// (probably something like "Warning: undefined index 'ID_my_site'")
// then you need to turn on error reporting
if (isset($_POST['submit'])) {
echo "Thanks";
$title=$_POST['message_title'];
$to=$_POST['message_to'];
$content=$_POST['message_content'];
$from=$_POST['message_from'];
$time=$_POST['message_date'];
$ck_reciever = "SELECT username FROM users WHERE username = '".$to."'";
if( mysql_num_rows( mysql_query( $ck_reciever ) ) == 0 )
die("The user you are trying to contact don\'t excist. Please go back and try again.<br> ");
else {
$insert = "INSERT INTO pmsys (to, from, title, message, date, ifread)
VALUES ('".$to."', '".$from."', '".$title."', '".$content."', '".$date."', '".$ifread."')";
$add_member = mysql_query($insert);
}
?>
<form name="message" action="new_message.php" method="post">
Title: <input type="text" name="message_title"> <br>
To: <input type="text" name="message_to"> <br>
Message: <br>
<textarea rows="20" cols="50" name="message_content">
</textarea>
<?php
echo '<input type="hidden" name="message_from" value="'.$user.'"><br>';
?>
<input type="submit" name="submit" value="Submit">
</form>
<?php
} //<-- this is where the else for isset submit ends
?>
Bookmarks