chrishea 182 Nearly a Posting Virtuoso

fopen_wrappers has to be enabled in order to use file_get_contents with a URL. This may not be the case on some servers, in which case you may need a local php.ini file to enable it.

chrishea 182 Nearly a Posting Virtuoso

The strtotime function is useful for this sort of thing. Here is a little routine that calculates the 2nd and 4th Saturdays in May (as an example):

<?PHP


	$wk = strtotime ("first saturday may 2009");
	
	if ($wk == false) {
		echo "<br>Not able to interpret the string ";
		exit;
	}
	
	$sat2	= $wk + (3600*24*7);				// add seven days  (in seconds)

	$sat4	= $sat2 + (3600*24*14);				// add 14 days

	$wk2 = date ("Y-m-d",$sat4);
	
	echo $wk2;

?>
chrishea 182 Nearly a Posting Virtuoso

if you change line 84 to

if (($rowcount % $picsperrow) == 0) {

it eliminates the error and hopefully gives you what you wanted.

Borderline commented: Many thanks +1
chrishea 182 Nearly a Posting Virtuoso

Try this instead:

print ('<table style="border-width: thin; border-style: solid; cellpadding=1; border-width: 10px;">');

Don't know why you'd want a 1400 pixel border. I changed it to 10 pixels but you can modify it to whatever you really need.

chrishea 182 Nearly a Posting Virtuoso

Why you want to do it is unclear but a little bit of research will probably provide you with the answer. There are previous posts on this topic such as:
http://www.daniweb.com/forums/thread162002.html

chrishea 182 Nearly a Posting Virtuoso

If you search the forum first you can often find previous posts with similar problems. Try this one as an example:
http://www.daniweb.com/forums/thread101948.html

chrishea 182 Nearly a Posting Virtuoso

You have to be more explicit. "It still doesn't work" doesn't help much. I ran a modified version of your code as follows and it worked correctly:

<?php
//opens connection to mysql server
$dbc=mysql_connect('localhost','root','');
if(!$dbc)
	{
	die('Not connected: ' . mysql_error());
	}

//select database
$db_selected = mysql_select_db("test",$dbc);
if(!$db_selected)
	{
		die("Cant connect: " . mysql_error());
	}

//test
$query="UPDATE test_table SET field1='hopethisworks' WHERE id='00001'";
$result=mysql_query($query);
?>

You may have a problem with your DB or the names / parms you are using for it.

Chris

chrishea 182 Nearly a Posting Virtuoso

Any output at all (even a blank line) before the Header will cause this error. As you say, this often doesn't show up as an error until you run from the server. I didn't notice any obvious echo statements so it is more subtle than that.

I seem to remember having a similar problem when I had a session_start before the headers (maybe because it was issuing an error message even though it was suppressed?). You may find it easier to use ob_start and ob_end_flush statements to catch whatever is being issued. It can save tearing out your hair trying to find the actual cause.

Chris

chrishea 182 Nearly a Posting Virtuoso

Start by changing the line if(!$db_selsected) -to- if(!$db_selected)

gangsta gama commented: Very helpful +1
chrishea 182 Nearly a Posting Virtuoso

I think you answered your own question correctly. Use mysql_num_rows and if there 0 records found then you can take the appropriate action.

Chris