php-general Digest 29 May 2005 21:01:23 -0000 Issue 3482

Topics (messages 215958 through 215966):

Re: Dummy question about knowing marked checkboes
        215958 by: Tom Rogers

PHP on XP SP2 IIS Security?
        215959 by: Mario netMines

Re: [EMAIL PROTECTED]
        215960 by: Rasmus Lerdorf

PHP 5.1 release
        215961 by: kioto

php based "open source" document workflow
        215962 by: bruce

Replacing 2 strings
        215963 by: W Luke

Warning: filemtime() (errno=75 - Value too large for defined data type)
        215964 by: Andrew Brampton

A small PHP project
        215965 by: Rob Scovell

Re: novice: how to run .sql script from php?
        215966 by: tony yau

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi,

Sunday, May 29, 2005, 5:50:13 PM, you wrote:
MG> Hi,

MG> First of all, my apologies to all list members for this dummy question.
MG> I've made my home work before posting here, but the truth is that i
MG> didn't found an answer for such a simple question.
MG> Only examples of more sophisticated related things.

MG> I have this piece of code that produces various checkboxes inside a form:
MG> -------------------------------------------------------------------
MG> // select interesses names and values to build the chekboxes
MG> $recordSet = &$conn->Execute('SELECT interesses FROM interesses ORDER BY
MG> interesses ASC');

MG> // build the checkboxe's list
MG> if (!$recordSet)
MG>  print $conn->ErrorMsg();
MG> else {
MG>  while (!$recordSet->EOF) {
MG>   print($recordSet->fields[0] . '<input name=\'interesses\'
MG> type=\'checkbox\' id=\'interesses\' value=' . $recordSet->fields[0] .
'\'>>');
MG> echo"<br />";
$recordSet->>MoveNext();
MG> }
$recordSet->>Close();
$conn->>Close();
MG> }
MG> ---------------------------------------------------------------------


MG> Here's the correspondent HTML output:
MG> ---------------------------------------------------------------------
MG> Alojamento<input name='interesses' type='checkbox' id='interesses'
value=Alojamento'>><br />
MG> Artesanato<input name='interesses' type='checkbox' id='interesses'
value=Artesanato'>><br />
MG> Eventos<input name='interesses' type='checkbox' id='interesses'
value=Eventos'>>

MG> (etc.)

MG> ---------------------------------------------------------------------

MG> My dummy question, for which i apologise once more is: after submitting
MG> the form, how can i know which chekboxes were checked ?

MG> Thanking you in advance.

MG> Warm Regards,
MG> Mário Gamito

Make them an array by adding [] at the end of the name. Also you are
missing a quote at the start of the value=  (double quotes makes it
easier to print in my opinion)

It should be like this:

while (!$recordSet->EOF) {
  print($recordSet->fields[0] . '<input name="interesses[]"
  type="checkbox" id="interesses" value="' . $recordSet->fields[0].'">'
);

Then any checkboxes checked  will be in an array called interesses

$interesses = (isset($_POST['interesses']))? $_POST['interesses'] :
array();
if(count($interesses) > 0){
  //checkboxes have been ticked
}else{
  //none ticked
}

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hi all

a while ago I bought a new computer and set it up to run PHP on IIS using MySQL db. I did all the usual setup step as I used to for the last 5 yrs. The first problem was with image uploading. The move_uploaded_file() was not working but only if the path was in the Inetpub directory. If I wanted to upload an image on the c: drive it was fine. I use Win XP Proffesional and I'm not on a network, so I don't get the security tab on the folder properties. I decided to make the user IUSR_computername an Administrator (stupid I know, but it worked).

So now I'm trying to do an fopen($filename, "w+") but it fails. If the file is outside the Inetpub directory, it works!!!

Can anyone help PLEASE!!!!

Thanks in advance

Mario
--- End Message ---
--- Begin Message ---
Ryan A wrote:
> Everytime I write to the list or reply to the list I get an email from this
> #%#"¤&! saying:

I got rid of him.

-Rasmus

--- End Message ---
--- Begin Message --- Hi all, i have question about the PHP 5.1 version. The PHP-GTk2 it's proud to start and require PHP5.1 version to work. When it's possible to use a stable version and what are the new features of this release.
Thanks so much to all.

--- End Message ---
--- Begin Message ---
hi...

i'm dealing with a project where i'm going to have users deal/modify a
number of docs.. i'd like some sort of doc workflow process where i can
allow a given user/type of user access to the doc, and move the doc along
the process.

ie,
  eng -> develops the doc
 test-> tests the doc
 qa -> reviews the doc
 doc signed off/complete...

this kind of process would have the eng/test/qa person touching the doc, and
only after all have signed off on the doc, would it be complete.. i'm going
to be dealing with potentially ~2000 docs, so i''d like to have a system in
place that allows us to more or less track what's going on.

does anybody have any thoughts on an open source solution for this kind of
situation.

thanks

bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi,

I have some text in a file which, when it's dumped to a var, needs to
be replaced.  In its raw form, it looks like this: <^JIM_JONES> and I
need to remove the <^_ and > characters and have it read "Jim-Jones"

It's nestled in amongst a load of other text - I'm fopen'ing a file
and reading it line by line - the text-to-replace is just in a var
named $text1

Any ideas would be great

Will

--- End Message ---
--- Begin Message ---
Hi,
I'm receiving the following warning:

Warning: filemtime(): Stat failed for master.log (errno=75 - Value too large for defined data type) in test.php on line 5

when I do the following line of code:
filemtime ('master.log');

The file in question is over 2GB, but I'm not interested in its size, I just want to know the time it was last modified. I presume filemtime is just doing a stat which is failing when it tries to read the size field. Whatever the cause filemtime is returning false and displaying that warning.

Does anyone know a work around for this warning (which does not involve shelling out a command line app)?

My code was working fine until the file reached 2GB.

Thanks
Andrew

P.S I'm running PHP 4.3.10-13 on a Debian distro.


--- End Message ---
--- Begin Message ---
Hi,

I do some voluntary work for Anglican Action, a Christian social services agency in Hamilton, New Zealand. We have installed a PHP package called Entiako on a web server (http://www.apexsoftware.ca/products/entiako/entiako.php) -- this is a room booking system. However, we have had some problems with it and we are looking for someone who could make a few small changes to it to suit our purposes. (This is in accordance with the licence agreement, which allows these changes.)

If any of you guys are interested in taking on this short (pro bono) project for an organisation that helps shattered families rebuild their lives, then please email me: robscovell [{at}] xtra.co.nz

I think this will probably take about 15-20 hrs work at most, if that.

Thanks,

Rob Scovell

--- End Message ---
--- Begin Message ---
I realised that there is a fundamental problem with using mysql_query( ...)
to run a .sql script to setup a database, and that was the database needs to
be there in the first place for php to connect to! also there was a lot of
comment lines in the script that was causing problem. ... so I gave up
trying to parse the file.

instead I did this
1) create the database with phpmyadmin etc
2) remove (by hand) all comment lines from the .sql file
and then include the file

ob_start();
include 'installation.sql';
$contents = ob_get_contents();
ob_end_clean();
execQuery($contents);

not very good but does the job.
thanks for all the help

tony yau

"Rory Browne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm assuming that the .sql file consists of a list of MySQL queries,
that when performed sequentially will set up your system.

That being the case, the  perfered way ot install the thing is to do a
'mysql [host/username/password parameters] < file.sql'.

I believe you can also run file.sql scripts using phpMyAdmin.

If you were to define a mysql_run_script() function, it would look a
bit like the following:

<?pseudo_code

function mysql_run_script($file){

$sql = file_get_contents($file);

$queries = split_sql_into_individual_sql_queries($sql);

foreach($queries as $query){
    mysql_query($query);
}

}

?>

Come to think of it, you could turn the above pseudo code into valid
php code, by defining the split_sql_into_individual_sql_queries()
function. This would involve splitting by ';', taking into account the
possibility that ';' may occur in the middle of a string.

Check out the code for phpmyadmin, or phpbb(db backup/recover
feature), for a better idea.

On 5/27/05, tony yau <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>     I got this .sql script that setup the whole db schema, I can run
> mysql.exe to run on my pc but when it goes to a hosting company's server I
> don't have that command!
>
>     So I tried to include("setup.sql") into a string and send that as one
> long sql query. BUT I need to get rid of all the comment lines first in
the
> script!!
>
>     can someone give me a better idea of doing this.
>     (there must be an equivalent php function like
> mysql_run_script("setup.sql"))
>
>
> thanks
> --
> Tony Yau
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to