Is the syntax is correct..............i am getting blank page......

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='$_request[$a]'" );
<? 

	include('database.php');

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='$_request[$a]'" );
	
while($row = mysql_fetch_array($result))
		{
	

		 echo $row['contents'];
		
		}
mysql_close();

 ?>

try in this way:

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_request[$a]."'" );

You must write $_request as $_REQUEST..

so the code is:

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[$a]."'" );

The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\demo\contractor_mail_action_contents.php on line 263

i am getting this error........

then check your database connections and table name and column names...
And put echo before your query and execute it
in your mysql...

or send your entire code with database....

<? 

	include('database.php');
echo ssss;
$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[$a]."'" );
echo $result;
while($row = mysql_fetch_array($result))
		{ 
		
		 echo $row['contents'];
		}
mysql_close();

 ?>

o/p is like this
ssssResource id #12

i checked everything its fine but not displaying anything

Hi,

Try this to see if you are getting any rows.

echo mysql_num_rows($result) ;

you can also do $row[0] that way you wouldn't have to worry about the spelling.


Regards,
Camilo

Hi this is my code...........just check whats wrong

<?php

	include('database.php');
$result = mysql_query("SELECT * FROM  autoalto_mail" );
	
while($row = mysql_fetch_array($result))
		{
		?>
		
			
			<tr><td width="10%"></td>
				<td ><img src="images/buldot.gif" alt="" height="6" width="6">

				     <?echo $row['from']?></td>
				<td >
				     <a href="contractor_mail_action_contents.php?mail_id=<? $a=$row['mail_id']
					?>">
					
				        <?echo $row['subject']?>
					 </a>
				</td>
				<td><?echo $row['date']?>
				</td>
			</tr>
				
			<tr>
			  <td width="10%">
			  </td>
			  <td colspan="4" style="background-repeat: repeat-x;"   background="images/dot.jpg" height="0" width="300">
			  </td>
			</tr>
									
		<?		
	    }
	     mysql_close();
        ?>





<? 

	include('database.php');
   
$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[$a]."'" );
		echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
		{ 
		 echo $row['contents'];
		}
mysql_close();

 ?>

ya i removed .....its giving 5 rows with the data......i think its problem with where statement.

ya i removed the where clause.......its working fine.......its displaying 5 rows with the data

Hi,

Cange this line of code:

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[$a]."'" );

for this one

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[mail_id]."'" );

Camilo

change your code to:

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST['mail_id']."'" );

Hi that statement is not working so created session but still its not working......see the code
below

<?php
session_start();

	include('database.php');
$result = mysql_query("SELECT * FROM  autoalto_mail" );
	
while($row = mysql_fetch_array($result))
		{
		?>
		
			
			<tr><td width="10%"></td>
				<td ><img src="images/buldot.gif" alt="" height="6" width="6">
				     <?echo $row['from']?></td>
				<td >
				     <a href="contractor_mail_action_contents.php?mail_id=<? $mailid=$row['mail_id'];
					 $mailid1=$_POST['mailid'];
					  session_register("mailid1"); 
?>">
		
					
				        <?echo $row['subject']?>
					 </a>
				</td>
				<td><?echo $row['date']?>
				</td>
			</tr>
				
			<tr>
			  <td width="10%">
			  </td>
			  <td colspan="4" style="background-repeat: repeat-x;"   background="images/dot.jpg" height="0" width="300">
			  </td>
			</tr>
									
		<?		
	    }
					
	     mysql_close();
        ?>






<? 
session_start();
	include('database.php');
$mailid1 = $_SESSION['mailid1'];
 echo $_SESSION['mailid1']; 



 $query1="SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST['$mailid1']."'" ;

// echo $query1;
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
		{ 
		 echo $row['contents'];
		}
mysql_close();

 ?>

its not working it will show zero number of rows......

Hi,
I think the problem is in the following statement.

$query1="SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST['$mailid1']."'" ;

You are using session to get the value and you are using request in qurey.

change your query to

$query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."'" ;

Hi i changed that where cluase its working but it displaying only the last row contents code is here just see......

<?php
session_start();

	include('database.php');
$result = mysql_query("SELECT * FROM  autoalto_mail" );
	
while($row = mysql_fetch_array($result))
		{
		?>
		
			
			<tr><td width="10%"></td>
				<td ><img src="images/buldot.gif" alt="" height="6" width="6">
				     <?echo $row['from']?></td>
				<td >
				     <a href="contractor_mail_action_contents.php?mail_id=<? $mailid=$row['mail_id'];
					  session_register("mailid"); 
?>">
		
	



<? 
session_start();
	include('database.php');
$mailid = $_SESSION['mailid'];
 echo $_SESSION['mailid']; 



 $query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid."'"  ;

echo $query1;
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
		{ 
		 echo $row['contents'];
		}
mysql_close();

 ?>

Hi,

I think the problem is in the way you are writing the code.
from the above code, you are passing

href="contractor_mail_action_contents.php?mail_id=<?$a=$row['mail_id']?>">

change your code as following

href="contractor_mail_action_contents.php?mail_id=<?=$row['mail_id']?>">

and for the other page, change your code as following:

mailid1 = $_REQUEST['mail_id']; echo $_REQUEST['mail_id'];     $query1="SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST['mail_id']."'" ;
This question has already been answered. Start a new discussion instead.