Jump to content

How can I make a date of 22/4/2008 into 21/4/2008 (minus one day)


otixz

Recommended Posts

wow! that resolved my prob!

 

Anyway do any know what is the meaning of an error:

 

Warning: mysql_query() [function.mysql-query]: Unable to save result set in D:\xampp\htdocs\ereport\add_inquiry.php on line 144

 

and

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\ereport\add_inquiry.php on line 146

 

I have this two errors but my queries are doing well and they are giving the results that I want.

What does it mean?

Hi

 

I was able to resolve the other prob

my concern is the error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\ereport\add_inquiry.php on line 146

 

What does it mean?

 

My code is:

$qry = mysql_query("select * from tblcourses");
	$row = mysql_num_rows($qry);



	if($row == 0)
	{
		echo "no record";?>

		<?php
	}		
	else {


		while($b = mysql_fetch_array($qry))			
		{
			$course = $b['coursename'];	
			$initial = $b['initial'];	
			$title = $b['TITLE'];		

			$q="select total ,
				(select total from tblinquiries where inq_date='$date' and course='$course') as Total2
				from tblinquiries where inq_date='$new_str' and course='$course'
				";

			$query = mysql_query($q);					

			$rows = mysql_num_rows($query);

			?>

			<tr>	
			<?php		
				if($title == "Y")
				{
					$course = $b['coursename'];	
			?> 		
					<td bgcolor="#AFEEEE" width="20%"><b><?echo $course;?></td>
					<td bgcolor="#AFEEEE"></td>
					<td bgcolor="#AFEEEE" width="5%"></td>

			<?php
				}else {
				?>
					<td width="20%"><?echo $course;?></td>
					<?php 
					//for PReviews date

					if($rows == "0")
					{
						 ?>
						<td><center>--</td>
						<td width="5%"><input type="text" size="15" name='<?php echo $course;?>' value="<?php echo $a['total2'];?>"><center></td>
						<?php


					}
					else
					{
						while($a= mysql_fetch_array($query))	
						{	
						?>
						<td><center><?php echo $a['total'];?></td>	
							<td><center><?php echo $a['Total2'];?></td>	

					<?php
						}
					}						
					?>
					<?php
				}
			?>	

			</tr>


			<?php
		}
	}

When you get that message, it means that the previous mysql function did not work correctly, usually the query had a syntax error in it. Here's how I usually code my mysql queries:

<?php
$q = "some select statement"
$rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
?>

Using this, your script will tell you the query where the problem occurred and the mysql_error and then stop. Using that you can debug the problem.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.