0

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

 ?>
5
Contributors
18
Replies
19
Views
9 Years
Discussion Span
Last Post by vicky_rawat
0

try in this way:

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

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.

0

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

0

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

0
<? 

	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

0

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

0

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

 ?>
0

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

0

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

0

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

0

change your code to:

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

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

0

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."'" ;
0

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

 ?>
0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.