[PHP] Help with files

2004-02-01 Thread Mr. Austin
Hello all,

I am trying to open a file (successful), then rewrite over the file when it is saved 
via a form on a website.  I have used the following code, yet it simple rewrites from 
the file pointer, but does not clear the file before writing.  Thanks for any help.




Re: [PHP] Help with files

2004-02-01 Thread Mr. Austin
I'm not entirely sure why it is that you assume I did not read the manual or
the online documentation (which is very thorough).  I'll find my answers
elsewhere.

Thank you,
Mr. Austin

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 01, 2004 8:43 PM
Subject: Re: [PHP] Help with files


> On Monday 02 February 2004 10:33, Mr. Austin wrote:
>
> > $buff = fopen("sample.txt", "r+");
>^
> ---+
>
> RTFM to see what other options you can use.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Give your very best today.  Heaven knows it's little enough.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SQL Query Not Kosher?

2004-02-02 Thread Mr. Austin
Hi all:

I am trying to get this to work, but always get the same error: that the resource in 
mysql_affected_rows() is not valid.  Anyone see why this would be?  All variables have 
been tested for accuracy.

$query = mysql_query("UPDATE stories SET status='approved' WHERE story_id={$id}");
  if(mysql_affected_rows($query) == 1) {
print("Your approval of \"$title\" was successful.  If this user entered an email 
address, they have been sent a notice of its approval and publication on the site.");
  } else {
print("The approval of \"$title\" was not successful.  Please check with the site 
administrator for assistance.");
  }

The above SQL statement works perfectly with phpMyAdmin (and, oddly enough, works with 
the above script, yet the Warning is produced and the 'not successful' message is 
displayed)  Any thoughts are appreciated!

Mr. Austin


Re: [PHP] SQL Query Not Kosher?

2004-02-02 Thread Mr. Austin
That would explain why it displays the second message saying it was not
successful.  But why then does it still display this warning?

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link
resource in c:\apache\htdocs\admin\stories.php on line 112

Mr. Austin
- Original Message -
From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Mr. Austin" <[EMAIL PROTECTED]>
Sent: Monday, February 02, 2004 10:41 PM
Subject: Re: [PHP] SQL Query Not Kosher?


> from the php function manual:
>
> 
> Note: When using UPDATE, MySQL will not update columns where the new
> value is the same as the old value. This creates the possibility that
> mysql_affected_rows() may not actually equal the number of rows matched,
> only the number of rows that were literally affected by the query.
> 
>
> http://nl2.php.net/mysql_affected_rows
>
> Mr. Austin wrote:
>
> > Hi all:
> >
> > I am trying to get this to work, but always get the same error: that the
resource in mysql_affected_rows() is not valid.  Anyone see why this would
be?  All variables have been tested for accuracy.
> >
> > $query = mysql_query("UPDATE stories SET status='approved' WHERE
story_id={$id}");
> >   if(mysql_affected_rows($query) == 1) {
> > print("Your approval of \"$title\" was successful.  If this user
entered an email address, they have been sent a notice of its approval and
publication on the site.");
> >   } else {
> > print("The approval of \"$title\" was not successful.  Please check
with the site administrator for assistance.");
> >   }
> >
> > The above SQL statement works perfectly with phpMyAdmin (and, oddly
enough, works with the above script, yet the Warning is produced and the
'not successful' message is displayed)  Any thoughts are appreciated!
> >
> > Mr. Austin
> >
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php