[PHP] Re: mysql_close();

2003-03-21 Thread Michiel van Heusden
I've been told (in this newsgroup as well :) that PHP automatically closes
the MySQL connections on closing the file or session..
probably when you ended your last '?' PHP closed the MySQL connection

a way to solve it is to insert the closing-command right after you finished
using the connection

and I don't really understand why you use if(etc...) and not just a plain:
mysql_close($connection);
but i suppose that doesn't make any difference

grace
michiel

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi,

 I include a file called bottom.php which goes at the bottom of all my
pages
 and looks like this:

 tdnbsp;/td
   /tr
  /table
 /body
 /html
 ?php
 if ($connection = @mysql_connect($host, $username, $password)){
  @mysql_close($connection);
 }
 ?

 I use this to make sure that I haven't left a connection open
accidentally,
 however I sometimes get an error message even though I am using the @
 symbol:


 Warning: mysql_close(): no MySQL-Link resource supplied in
 /home/w/o/workmanagement/public_html/authenticate_user.php on line 51

 How can this be?





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



[PHP] Re: Eliminating space between HR and Image

2003-03-19 Thread Michiel van Heusden
this is an HTML-problem, not php..but anyway

i have no clue why the extra space would appear,
but I'd try to add absolute positiong to the HR and IMAGE as well, that
should solve the problem

like:
style type=text/css
!--
hr {
 position: absolute;
 top: 0px;
}
img {
 position: absolute;
 top: 8px;
}
--
/style

grace
michiel


Andre Dubuc [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I've added an animated gif in the banner area of my site, and just above
it,
 a horizontal rule to give added emphasis. The problem is, no matter what I
 do, I cannot get rid of an extra space that appears between the two. Is
this
 a natural function? Is there some way of eliminating the space?

 The code:

 ?php
 . . . .
 div class=banner
 hr align=left size=8 width=1000 style=background: #9a3e2b;
 img src=icr.gif height=100 width=1000
 /div
 . . .
 ?

 CSS code:

 div.banner {
 position: absolute;
 top: 0px;
 left: 1%;
 }

 I will be grateful for any ideas or advice on how to fix this.
 Tia,
 Andre



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



[PHP] storing files in database

2003-03-18 Thread Michiel van Heusden
is there any possibility using PHP 4 to store entire files as a database
field in a MySQL database?
and if so, does anybody know a way, or a tutorial describing this?

thanks
michiel



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



[PHP] attaching php-action to form-button

2003-03-07 Thread Michiel van Heusden
my problem is this

I have some variables defined which i'm sending through get

form name=form1 method=get action=result.php
// input's etc
/form

now I have $var1 defined in my PHP and I want to send it through that GET as
well
is there a way to do this?

so it's not a user-defined but php-defined var, which i need to send through
the form

any help appreciated



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



[PHP] some help needed building chat-app

2003-03-05 Thread Michiel van Heusden
i'm working on a chat-app which has to be extremely plain and simple
mysql is available

i tried stripping some of the big scripts, but ended up in a mess
so i've ended up building a little app myself

i'm just wondering whether i'm using the right principe to get the data
refreshed in the chat..

i'm dropping all the messages as records in a mysql-table
then i have the php script

first printing all the html stuff
opening a paragraph

and then a loop, querying the mysql, printing the data and querying again

is that a way to build this, or are there much better ways?

and some other questions:
* how can i make sure the db-connection is closed before the user closes the
window?
* is there any server-side problem with this (say, 100 people log on, and
are contineously querying mysql, won't there be some sort of crash?)

thanx a lot
michiel



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



Re: [PHP] some help needed building chat-app

2003-03-05 Thread Michiel van Heusden
thanks for your replies

the other thing i was trying to ask :) is how to keep on looping and looking
for new messages
is just a plain loop ok
or should i use a timer or whatsoever, i have no clue

right now it's a bit like

$x = loop;

do while ($x == loop) {
//mysql_query (select new messages)
//output new messages to bottom of html
}


Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You need only one query with LIMIT, example:
 //this will select last 10 messages
 $res=mysq_query('SELECT * FROM chat_messages ORDER BY addtime DESC LIMIT
 10');

 // this will print them from newer to older
 while($message=mysql_fetch_array($res)) {
 echo $message['from'].': '.$message[message'].'br';
 }

 the connection is closed once your script is over (unless you use
 pconnect), you can not really find out the window has been closed.

 you don't need to worry about any crash, sql server will take care of this

 Michiel van Heusden wrote:

 i'm working on a chat-app which has to be extremely plain and simple
 mysql is available
 
 i tried stripping some of the big scripts, but ended up in a mess
 so i've ended up building a little app myself
 
 i'm just wondering whether i'm using the right principe to get the data
 refreshed in the chat..
 
 i'm dropping all the messages as records in a mysql-table
 then i have the php script
 
 first printing all the html stuff
 opening a paragraph
 
 and then a loop, querying the mysql, printing the data and querying again
 
 is that a way to build this, or are there much better ways?
 
 and some other questions:
 * how can i make sure the db-connection is closed before the user closes
the
 window?
 * is there any server-side problem with this (say, 100 people log on, and
 are contineously querying mysql, won't there be some sort of crash?)
 
 thanx a lot
 michiel
 
 
 
 
 




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



[PHP] passing arrays to a session-variable

2003-02-28 Thread Michiel van Heusden
I'm using this script to test passing arrays to a Session-variable.

?
session_start();

// method 1
$_SESSION['array1'] = array(item1, item2);

// method 2
session_register(array2);
$array2 = array(itemA, itemB);

header (Content-type: text/html);

echo $array1[0]. br /;
echo $array2[0];
?

method 1 doesn't work until another PHP is loaded, only then the var is
ouputted...
method 2 works fine, but i'd prefer using $_SESSION all the way instead of
session_register
any suggestions?

grace
michiel



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



[PHP] Re: Efficient db connect function?

2003-02-23 Thread Michiel van Heusden
$db = mysql_connect$db_host, $db_user, $db_pass)
 or die (Cannot connect to database);
mysql_select_db($db_name, $db)
 or die (Cannot select database);
$result = mysql_query($query ,$db)
 or die (Query not executed);

and all the outputting code...

grace
michiel

Cf High [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey all.

 I'm currently using the following db connection function, but I'm not sure
 if it's as efficient as it could be.

 function dbConnect($SQL) {

 global $result;

  // Connect to DB
  if (!$link = mysql_connect($db_host, $db_user, $db_pass)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
  }
  else

   // Select DB
   if ([EMAIL PROTECTED]($db_name, $link)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
   }
   else {
 // Execute query
 if (!$result = mysql_query($SQL, $link)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
}
   }
 }
 return $result;
 }

 *** Is there a faster way to establish a connection  run a query, or
am
 I wasting my time over nothing? *

 --Noah





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



[PHP] Re: Dynamic combobox in Flash with PHP

2003-02-23 Thread Michiel van Heusden
my experience is
that interaction between flash and php runs best through GET
so, you could try using GET instead of POST

and in your actionscript
insert the ';' on the end of the lines for:
test = this[list_label+i]
myItem.label = test

grace
michiel


Pei_world [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have the following PHP code to generate output to the flash
 //===
 $query = SELECT currencyCode,currencyName,country,buyPrice,sellPrice
   FROM $CURRENCIES_TABLE order by currencyCode;;

  $db_linker = db_connection();
 db_selection($db_linker);
  $result = mysql_query($query);
   $num=mysql_num_rows($result);
   echo array_num=.$num;
   for($i=0; $imysql_num_rows($result); $i++){
echo

list_label.$i.=.mysql_result($result,$i,currencyCode).,.mysql_resul
 t($result,$i,currencyName);
  }


  db_close($db_linker);



//==
 ==


 also the following code in actionscript use to receivesend data.
 but when I run the *.swf it cann't get the output from PHP,
 so anyone can help

 //
 loadVariables(link.php, this, POST); // get the data from php file
 /*
 //==
 iList = new Array();
 myItem = new Object();
 iList[0] = myItem;

 for (i=0; iarray_num; i++) {
 myItem = new Object();
 test = this[list_label+i]
 myItem.label = test
 myItem.data = i;
 iList[i+1] = myItem;
 }

 list_currency.setDataProvider(iList);

 //




 thx.

 --
 Sincerely your;

 pei_world ( .::IT::. )








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



[PHP] selection in form-field

2003-02-21 Thread Michiel van Heusden
i have quite an easy question:

is there a way in PHP to trace the selection in a certain form-field?
i need this for building a simple html-edit application,
which allows a user to select his/her text within a field, and then click
'bold' for instance..the PHP should insert b before the selection, and
/b after the selection.

1) should i use PHP or is this a typical JavaScript-thing? (or a
combination?)
2) if you could help with a function or small script I would me most
grateful

grace
michiel



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




[PHP] passing variables to flash

2003-02-21 Thread Michiel van Heusden
i want to pass variables to a shockwave-flash-file
currently that's working fine with

print  PARAM NAME=movie
VALUE=\$movie?idlinks=$idlinksidcontent=$idcontentidknoppen=$idknoppen\
etc...

but passing the variables through GET makes iexplore think it's loading a
new *.swf-file

how to fix this?

1) is there a way around using GET to pass the variables from PHP?
2) is there a way to make Iexplore realise the file has been loaded before
:)?

thanks a lot
michiel



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




Re: [PHP] passing variables to flash

2003-02-21 Thread Michiel van Heusden
thanks for your reply

 What I do in these cases is either having PARAM name=movie.swf?var1=text
the first thing you mention is exactly the problem I'm having since the
file.swf?var=xxx
makes iexplore reload it

 Or use a file (something.php) which spits text like var1=var2=.
 Flash can read that file and get the variables
the second one is not a possibility, because I need flash to have the vars
before operating. the variables are used to call on another php-script for
conetnt-details. (for instance: file.swf?id=23 will make flash call on
content.php?id=23 for relevant content)

anybody else for other options?

original question:
 i want to pass variables to a shockwave-flash-file
 currently that's working fine with

 print  PARAM NAME=movie

VALUE=\$movie?idlinks=$idlinksidcontent=$idcontentidknoppen=$idknoppen\
 etc...

 but passing the variables through GET makes iexplore think it's loading a
 new *.swf-file

 how to fix this?

 1) is there a way around using GET to pass the variables from PHP?
 2) is there a way to make Iexplore realise the file has been loaded before




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




[PHP] Re: and ' giving problems

2003-02-11 Thread Michiel van Heusden
you could use stripslashes or stripcslashes to remove the '\'-s, otherwise i
wouldn't know..

Pag [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Hi,

 When a user wants to add a comment on my site and uses either  or  ', and
 when it gets printed out,  comes out as / or /', either to the web page
or
 on a form to alter.

 The only treatment i give it after its submitted on the form is:

 $comentarioc = str_replace(\r\n, \n, $comentarioc);
 $comentarioc = str_replace(\r, \n, $comentarioc);

 Is there a way to solve this? So it can accept both  and ', and be able
 to alter/print it with no problem?
 Thanks.

 Pag





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




[PHP] Q. on ereg_replace

2003-02-11 Thread Michiel van Heusden
i'm creating sort of a very simple css-alike-thing for outputting html to
flash actionscript.
the php gets a string ($text) from the database, which look something like:
h1header 1 /h1 etc...

then, from a 'css' file it reads the strings $replace and $replacement

it looks something like:

   $number = count($arr_replace);
   $i = 0;

   do {

   $replace = stripcslashes($arr_replace[$i]);
   $replacement = stripcslashes($arr_replace[$i]);

   $text = ereg_replace($replace, $replacement, $text);

   $i++;

   } while ($i  $number);

this works fine, except that after the ereg_replace some newlines are
inserted. I could strip them, but then i'm also stripping the original
newlines (which were in the string already) so, i'd be happier finding a way
of using this script without ereg_replace inserting newline (i don't
understand why it does anyway)

any suggestions?



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




[PHP] Re: Q. on ereg_replace

2003-02-11 Thread Michiel van Heusden
never mind it

i've solved it trimming the $replace and $replacement before using them in
ereg_replace()

thanks anyway


Michiel Van Heusden [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 i'm creating sort of a very simple css-alike-thing for outputting html to
 flash actionscript.
 the php gets a string ($text) from the database, which look something
like:
 h1header 1 /h1 etc...

 then, from a 'css' file it reads the strings $replace and $replacement

 it looks something like:

$number = count($arr_replace);
$i = 0;

do {

$replace = stripcslashes($arr_replace[$i]);
$replacement = stripcslashes($arr_replace[$i]);

$text = ereg_replace($replace, $replacement, $text);

$i++;

} while ($i  $number);

 this works fine, except that after the ereg_replace some newlines are
 inserted. I could strip them, but then i'm also stripping the original
 newlines (which were in the string already) so, i'd be happier finding a
way
 of using this script without ereg_replace inserting newline (i don't
 understand why it does anyway)

 any suggestions?





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




[PHP] little problem with ' and stuff

2003-02-10 Thread Michiel van Heusden
hi there,

i'm having a small problem, wondering if anybody can help

// a line in my script defining $url
 $url = $directory . '/main.php?id=' . $id;

// a line later on in the frameset calling this $url
 echo 'frame name=main scrolling=no src='$url'';

this gives me a paring error on the last line

any suggestions??

thanks
michiel



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




[PHP] stupid little problem

2001-11-16 Thread Michiel van Heusden

sorry..I'm quite new in this php-stuff
i've got a little problem

if I write

a$ = test;
b$ = test2;
data$ .= a$ . . b$   ;
echo data$;

it outputs:
test test2
instead of:
test   test2  

I really need that spaces..
any help?
thnx



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] POSTing values to file

2001-10-28 Thread Michiel van Heusden

anybody help me please...

how can I open a file from php (something like require, but without closing
the php-file)
and then send some string to that file with POST
is thispossible?/?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP, SWF and XML

2001-10-26 Thread Michiel van Heusden

I needto use php to open  *.swf,
and then send some xml code to it.
anyone knows if this is possible,
and if so, how to send code (via POST) to the *.swf after opening it?

thnx

Michiel



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]