Re: [PHP] Parsing Variables Inside a String

2007-08-15 Thread Chris

[EMAIL PROTECTED] wrote:

Hi, is there a function that can parse variables within a string?

For example:

$good_day = 'The';
$fr['iop'] = "y're crazy!";

$new = '$good_day$fr['iop']';
echo TheFunctionIRequest($new); // They're crazy!


Well this:

echo $good_day . $fr['iop'];

will do what you show here.


What are you trying to do exactly?

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Parsing Variables Inside a String

2007-08-15 Thread heavyccasey
I need to get the variable names from a database.

On 8/15/07, Chris <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi, is there a function that can parse variables within a string?
> >
> > For example:
> >
> > $good_day = 'The';
> > $fr['iop'] = "y're crazy!";
> >
> > $new = '$good_day$fr['iop']';
> > echo TheFunctionIRequest($new); // They're crazy!
>
> Well this:
>
> echo $good_day . $fr['iop'];
>
> will do what you show here.
>
>
> What are you trying to do exactly?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

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



RE: [PHP] problem with require_once

2007-08-15 Thread Sanjeev N
Hi,

The problem is simple...
Either the file myclass.php path is wrong (may be your calling file is in
some folder and myclass.php is in another folder) or if path is correct and
file may have some syntax errors or some function may not exist..

Please check the path if wrong and check the file for syntax and content if
path is correct

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Vanessa Vega [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 11:30 AM
To: php-general@lists.php.net
Subject: [PHP] problem with require_once

Good day to all...

I would like to ask for some help..
I have a form created in javascript codes. The page is a pop up window.
I am passing the values of the form using the method "post". The PHP file 
that handles the form displays the values from that and  had the following 
code in the beginning:



when i clicked the submit button, nothing happens and the page wouldl just 
refresh...
but when i removed the require_once code of my PHP, the values from the form

is displayed but of course, will not be saved since the class isnt 
there.

can anyone help me 

-- 
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



RE: [PHP] www.soongy.com

2007-08-15 Thread Sanjeev N
Hi Gevorg,

Great work.. But few things.
Scroller is not working even at bottom content is there...
I tried in both mozila and IE... In IE when I selected text and moved down
then it scrolled down. But where in Mozila no use...

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: Gevorg Harutyunyan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 14, 2007 8:45 PM
To: php-general@lists.php.net
Subject: [PHP] www.soongy.com

Hello,

 

I am Gevorg. 

I just wanted to introduce you my new PHP based work here www.soongy.com
 .

It is working on PHP and MySQL and here is used DHTML, AJAX.

 

Thank you very much.

 

Waiting for your response 

 

Regards,

Gevorg

 

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



RE: [PHP] Parsing Variables Inside a String

2007-08-15 Thread Sanjeev N
$new = '$good_day$fr['iop']';

This will give you error...
Instead if you try in this way as follows
$new = "$good_day$fr['iop']"; or
$new = $good_day.$fr['iop'];

It will include the "They're carzy!" in the $new variable..


Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 12:21 PM
To: php-general@lists.php.net
Subject: [PHP] Parsing Variables Inside a String

Hi, is there a function that can parse variables within a string?

For example:

$good_day = 'The';
$fr['iop'] = "y're crazy!";

$new = '$good_day$fr['iop']';
echo TheFunctionIRequest($new); // They're crazy!

Thanks!

-- 
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



RE: [PHP] Parsing Variables Inside a String

2007-08-15 Thread Sanjeev N
Consider the variable name inside database is 'emp_name' and now you want to
use this as $emp_name.. 

This variable will be stored in as follows
$variable1 = $resultfromdatabase['variable1'];

Then next step is store anything in this variable as follows
$$variable1 = "John";

I hope this may not help you for what you want, but at least It will gives
an idea for different methods..

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 12:41 PM
To: Chris
Cc: php-general@lists.php.net
Subject: Re: [PHP] Parsing Variables Inside a String

I need to get the variable names from a database.

On 8/15/07, Chris <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi, is there a function that can parse variables within a string?
> >
> > For example:
> >
> > $good_day = 'The';
> > $fr['iop'] = "y're crazy!";
> >
> > $new = '$good_day$fr['iop']';
> > echo TheFunctionIRequest($new); // They're crazy!
>
> Well this:
>
> echo $good_day . $fr['iop'];
>
> will do what you show here.
>
>
> What are you trying to do exactly?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

-- 
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] Re: PHP Books - A poll of sorts

2007-08-15 Thread David Powers

Jay Blanchard wrote:

If there was a best practices book would you buy it?


I write books on PHP aimed at the beginner/intermediate level, and have 
a considerable collection of PHP books written by others. Two relatively 
recent books that struck me as being important are "Pro PHP Security" by 
Chris Snyder and Michael Southwell, and "Essential PHP Security" by 
Chris Shiflett. (I know there's also "php|architect's Guide to PHP 
Security" by Ilia Ashanetsky and Rasmus Lerdorf, but I haven't read it.)


The thing that struck me most about the books was that anyone thought 
there should be a need for them. Of course, there is a need - that's why 
they were written. However, surely security should be taught from the 
very beginning? Every book on PHP (or any other language) should be a 
"best practices" book.


The problem is that books are written by human beings, who are prone to 
mistakes (myself included), and whose own view of "best practice" might 
leave gaps in security. The other problem is that a lot of people who 
use PHP just want to copy and paste a script that "works". Even if the 
ready-made script has been designed with security in mind, using it 
without understanding *how* it works can lead to unforeseen problems.


By the way, I would welcome constructive criticism of the scripts in my 
books. I have tried to incorporate what I perceive to be the best 
practices at the time of writing, but I'm sure there's room for improvement.


--
David Powers

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



[PHP] Re: PHP Books - A poll of sorts

2007-08-15 Thread Man-wai Chang To Die
> We all have our favorite PHP books and resources but there is one tome
> that seems to be missing from the group...a "best practices" book. We

PHP, being server-side, is not difficult. I think the client-side stuff
deserves some books (DOM, Javascript, CSS, XHTML, XML, ) if you want
to save time.

-- 
  @~@   Might, Courage, Vision, SINCERITY.
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.22.2
  ^ ^   19:44:01 up 5 days 6:30 0 users load average: 0.05 0.06 0.02
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] zip freezes - how to handle corrupt CRC in zip-file

2007-08-15 Thread ecc

Ah, fine. How do i use this ZIPARCHIVE::CHECKCONS flag? 

Something like that should work, i think?

$zip = new ZipArchive;
$res = $zip->open ( $filename ZIPARCHIVE::CHECKCONS );
if (TRUE === $res) {
# all looks fine
}
elseif {
switch($res){
case ZIPARCHIVE::ER_INCONS:
# do some error handeling
break;
}
# test these errors
# ZIPARCHIVE::ER_EXISTS
# ZIPARCHIVE::ER_INCONS
# ZIPARCHIVE::ER_INVAL
# ZIPARCHIVE::ER_MEMORY
# ZIPARCHIVE::ER_NOENT
# ZIPARCHIVE::ER_NOZIP
#  ZIPARCHIVE::ER_OPEN
# ZIPARCHIVE::ER_READ
# ZIPARCHIVE::ER_SEEK 
}


Richard Lynch wrote:
> 
> On Tue, August 14, 2007 5:42 am, ecc wrote:
>> i´m reading zip-files with the php zip-functions without a problem.
>> Now i
>> got and Zip containing an corrupt crc (If i open this file via winzip,
>> the
>> error is shown).
>>
>> It looks like the php functions for zip-handeling "zip_entry_read" and
>> "ZipArchive::getFrom..." do not quit on a bad crc checksum so
>> these
>> functions read in the file and than are in an infinite loop. Because i
>> use
>> PHP-GTK2 my tool feezes and the process has to be killed. On an
>> web-enviroment this could also a big problem . ok, user-zip
>> handeling on
>> web is not the best idea :-)
>>
>> I´ve found no way to find out, if an file in the zip file is an valid
>> or
>> corrupt entry. The output of "ZipArchive::statName" give me no info
>> about
>> the state of an entry.
>>
>> Is there any trick out there, how to manage this problem. Maybe this
>> is an
>> bug or missing feature in the zip extensions. Dont know!
> 
> Perhaps checking the consistency with this ZIPARCHIVE::CHECKCONS flag
> would help.
> 
> This is just a wild guess.
> 
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/zip-freezes---how-to-handle-corrupt-CRC-in-zip-file-tf4266474.html#a12161999
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Re: cant get if logic correct..

2007-08-15 Thread Per Jessen
Gregory Machin wrote:

> Hi
> i have a piece of code that gets info from a comma delimited file,
> then gets each value that is to be insterted into the database 
> 
> The variabls must only contain numbers and must not be null ..
> but the  logic i have is iether not working or there are some hidden
> characters creeping in because it is processing the data ... how can i
> do this better ?

Maybe use a regex?


/Per Jessen

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



[PHP] cant get if logic correct..

2007-08-15 Thread Gregory Machin
Hi
i have a piece of code that gets info from a comma delimited file,
then gets each value that is to be insterted into the database 

The variabls must only contain numbers and must not be null ..
but the  logic i have is iether not working or there are some hidden
characters creeping in because it is processing the data ... how can i
do this better ?


for($i=2;$i<$arrsize;$i++){
  $parts=explode(",",$lines[$i]);
  $stnr=$parts[0];
  $subj=$parts[1];
  $mark=$parts[4];
if (($stnr>"") and ($subj>"") and ($mark>"")){
   //do alot of something lol
   }
   }

-- 
Gregory Machin

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



Re: [PHP] cant get if logic correct..

2007-08-15 Thread Michael Preslar
This will be of help.

http://us2.php.net/manual/en/function.is-numeric.php

On 8/15/07, Gregory Machin <[EMAIL PROTECTED]> wrote:
> Hi
> i have a piece of code that gets info from a comma delimited file,
> then gets each value that is to be insterted into the database 
>
> The variabls must only contain numbers and must not be null ..
> but the  logic i have is iether not working or there are some hidden
> characters creeping in because it is processing the data ... how can i
> do this better ?
>
>
> for($i=2;$i<$arrsize;$i++){
>   $parts=explode(",",$lines[$i]);
>   $stnr=$parts[0];
>   $subj=$parts[1];
>   $mark=$parts[4];
> if (($stnr>"") and ($subj>"") and ($mark>"")){
>//do alot of something lol
>}
>}
>
> --
> Gregory Machin
>
> --
> 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



Re: [PHP] Parsing Variables Inside a String

2007-08-15 Thread heavyccasey
Thank you so much! :D

On 8/15/07, Sanjeev N <[EMAIL PROTECTED]> wrote:
> Consider the variable name inside database is 'emp_name' and now you want to
> use this as $emp_name..
>
> This variable will be stored in as follows
> $variable1 = $resultfromdatabase['variable1'];
>
> Then next step is store anything in this variable as follows
> $$variable1 = "John";
>
> I hope this may not help you for what you want, but at least It will gives
> an idea for different methods..
>
> Warm Regards,
> Sanjeev
> http://www.sanchanworld.com/
> http://webdirectory.sanchanworld.com - Submit your website URL
> http://webhosting.sanchanworld.com - Choose your best web hosting plan
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 15, 2007 12:41 PM
> To: Chris
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Parsing Variables Inside a String
>
> I need to get the variable names from a database.
>
> On 8/15/07, Chris <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] wrote:
> > > Hi, is there a function that can parse variables within a string?
> > >
> > > For example:
> > >
> > > $good_day = 'The';
> > > $fr['iop'] = "y're crazy!";
> > >
> > > $new = '$good_day$fr['iop']';
> > > echo TheFunctionIRequest($new); // They're crazy!
> >
> > Well this:
> >
> > echo $good_day . $fr['iop'];
> >
> > will do what you show here.
> >
> >
> > What are you trying to do exactly?
> >
> > --
> > Postgresql & php tutorials
> > http://www.designmagick.com/
> >
>
> --
> 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] QuickTime question

2007-08-15 Thread tedd

Hi gang:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);

-- but it's falling short.

Thanks for any help.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] QuickTime question

2007-08-15 Thread Eric Butera
On 8/15/07, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> Given:
>
> http://www.webbytedd.com/bb/ice/
>
> How can I play the movie inside the page instead of going to another page?
>
> I know that I could use phpclasses, but that seems an overkill.
>
> I think something like this --
>
> $file_source = 'ice-fishing.mov';
> $size = filesize($file_source,"","");
>
> header('Pragma: public');
> header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
> header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
> max-age=0');
> header('Content-Transfer-Encoding: none');
> header("Content-type: video/quicktime");
> header("Content-Length: " . $size);
>
> -- but it's falling short.
>
> Thanks for any help.
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

JavaScript?

Put a nice event listener that checks for click actions and do a swap
out of the innerHTML with the movie.

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



[PHP] OOP in PHP

2007-08-15 Thread Patrik Hasibuan
Dear my friends,

This is the first time for me to use OOP concept of PHP. I wrote still a very 
simple codes but it doesn't work as my manual book taught. the book titled 
"MySQL/PHP Database Application" by Jay Greenspan say these lines should work 
but in fact it don't work as expected.
Here is my code:
===
//pelangganbaru.php

===
//koneksi.php




  




";
$konek=mysql_connect("$namakompie","$un","$pw");
if ($konek){
echo "koneksi berhasil (connection succeeded)";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>


=

Theoritically if Class "koneksi" is being initialized than it prints "koneksi 
berhasil (connection succeeded)" but it doesn't.

Please tell me what is my mistake.

Thank you very much in advance.
-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

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



Re: [PHP] QuickTime question

2007-08-15 Thread Stut

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);

-- but it's falling short.


Something like this...

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"; 
height="153" width="321">

  
  
  
  pluginspage="http://www.apple.com/quicktime/download/"; controller="true" 
autoplay="true" height="153" width="321">



I'm sure there are lots of tutorials on the web regarding the details - 
I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut

--
http://stut.net/

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Nathan Nobbe
what sort of error are you encountering ?

-nathan

On 8/15/07, Patrik Hasibuan <[EMAIL PROTECTED]> wrote:
>
> Dear my friends,
>
> This is the first time for me to use OOP concept of PHP. I wrote still a
> very simple codes but it doesn't work as my manual book taught. the book
> titled "MySQL/PHP Database Application" by Jay Greenspan say these lines
> should work but in fact it don't work as expected.
> Here is my code:
> ===
> //pelangganbaru.php
>  require "koneksi.php";
> $sqlnya="select country from countries";
> $klas=new koneksi($sqlnya);
> ?>
> ===
> //koneksi.php
> 
>
> 
> 
>   
>
> 
>
> 
>  class koneksi{
> $namakompie="127.0.0.1";
> $un="root";
> $pw="mysqlpw";
> $sqlnya;
> $kueri;
>
> function koneksi($sqlnya){
> echo "superclass koneksi dipanggil";
> $konek=mysql_connect("$namakompie","$un","$pw");
> if ($konek){
> echo "koneksi berhasil (connection succeeded)";
> $mybd=mysql_select_db("survey",$konek);
> $kueri=mysql_query($sqlnya,$konek);
> }else{
> echo "I can't talk to the server";
> exit();
> }
> return $kueri;
> }
>
> }
> ?>
> 
> 
> =
>
> Theoritically if Class "koneksi" is being initialized than it prints
> "koneksi berhasil (connection succeeded)" but it doesn't.
>
> Please tell me what is my mistake.
>
> Thank you very much in advance.
> --
> Patrik Hasibuan <[EMAIL PROTECTED]>
> Junior Programmer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Parsing Variables Inside a String

2007-08-15 Thread Jim Lucas

[EMAIL PROTECTED] wrote:

Hi, is there a function that can parse variables within a string?

For example:

$good_day = 'The';
$fr['iop'] = "y're crazy!";

$new = '$good_day$fr['iop']';
echo TheFunctionIRequest($new); // They're crazy!

Thanks!



One thing to add to what everybody else is saying, is that you should use curly braces around your 
variable names.  This way the parser will not get confused.


$new = "{$good_day}{$fr['iop']}";

It just helps the parser recognize the beginning and ending of your variables.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Robert . Degen

> Theoritically if Class "koneksi" is being initialized than it 
> prints "koneksi berhasil (connection succeeded)" but it doesn't.

What "does" it? Just nothing? No warnings at all? Possibly disabled?

so far

rob

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



Re: [PHP] cant get if logic correct..

2007-08-15 Thread Jim Lucas

Gregory Machin wrote:

Hi
i have a piece of code that gets info from a comma delimited file,
then gets each value that is to be insterted into the database 

The variabls must only contain numbers and must not be null ..
but the  logic i have is iether not working or there are some hidden
characters creeping in because it is processing the data ... how can i
do this better ?


for($i=2;$i<$arrsize;$i++){
  $parts=explode(",",$lines[$i]);
  $stnr=$parts[0];
  $subj=$parts[1];
  $mark=$parts[4];
if (($stnr>"") and ($subj>"") and ($mark>"")){
   //do alot of something lol
   }
   }



for ( $i=2; $i<$arrsize; $i++ ) {

// Explode string into what you need
list($stnr, $subj, $mark) = explode(',', $lines[$i]);

// Test for conditions
if ( !empty($stnr) && !empty($subj) && !empty($mark) ) {

// Do a lot of something lol

} else {

// Something was empty

}

}

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Jim Lucas


A few missing pieces in your code.  Take a look below within your class.  I 
corrected it.

try also using include_once instead of require

and make sure that your error level and reporting are turned on so you can see 
what is happening.


Patrik Hasibuan wrote:

Dear my friends,

This is the first time for me to use OOP concept of PHP. I wrote still a very simple 
codes but it doesn't work as my manual book taught. the book titled "MySQL/PHP 
Database Application" by Jay Greenspan say these lines should work but in fact it 
don't work as expected.
Here is my code:
===
//pelangganbaru.php

===
//koneksi.php




  





var $namakompie='127.0.0.1';

$un="root";

var $un='root';

$pw="mysqlpw";

var $pw='mysqlpw';

$sqlnya;

var $sqlnya;

$kueri;

var $kueri;


function koneksi($sqlnya){
echo "superclass koneksi dipanggil";
$konek=mysql_connect("$namakompie","$un","$pw");

$konek=mysql_connect($this->namakompie, $this->un, $this->pw);

if ($konek){
echo "koneksi berhasil (connection succeeded)";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>


=

Theoritically if Class "koneksi" is being initialized than it prints "koneksi 
berhasil (connection succeeded)" but it doesn't.

Please tell me what is my mistake.

Thank you very much in advance.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] QuickTime question

2007-08-15 Thread brian

tedd wrote:

Hi gang:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);



That would simply send the QT file to the browser, which would display 
it sans HTML. If by "inside the page" you mean inside of your interface, 
this is the opposite of what you want. You'll need to create an object tag.


But (since we're already off-topic) i'd suggest you check out the 
anarchy media player:


http://an-archos.com/anarchy-media-player

This thing is wonderful. 5 stars! Grab the "Standalone Javascript for 
non-WP sites" version.


brian

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



Re: [PHP] QuickTime question

2007-08-15 Thread tedd

At 4:32 PM +0100 8/15/07, Stut wrote:

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);

-- but it's falling short.


Something like this...

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"; 
height="153" width="321">

  
  
  
  pluginspage="http://www.apple.com/quicktime/download/"; 
controller="true" autoplay="true" height="153" width="321">



I'm sure there are lots of tutorials on the web regarding the 
details - I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut


-Stut:

That certainly works, --

http://www.webbytedd.com/bb/ice1/

-- but I was hoping for something in the php realm.

Thanks,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Problem downloading files in IE

2007-08-15 Thread Richard S. Crawford
My users are having problems downloading .doc or .xls files linked to from PHP 
pages; when they click on the link, IE returns an error stating that the file 
cannot be found.  Firefox, however, seems to be able to find the file and 
open it just fine.

From what I can tell, this is related to a known IE issue which prevents users 
from being able to download files from a secure site if the headers on the 
page are set to prevent caching.  However, our site is not a secure site, nor 
do we have headers which prevent caching.

This has been bugging me for weeks.  I advise our users to use Firefox, but 
not all of them are able to do so; and since they pay our bills, we don't 
have much of an option.

If anyone has any ideas, I'd appreciate hearing them.

-- 
Richard S. Crawford
Editor-in-chief, Daikaijuzine (http://www.daikaijuzine.com)
Personal website: http://www.mossroot.com
http://www.myspace.com/underpope / underpope.livejournal.com
"We are here to help each other get through this thing, whatever it is."
(Kurt Vonnegut, 1922 - 2007)

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



Re: [PHP] QuickTime question

2007-08-15 Thread Michael Preslar
I'm not sure if this would be of help or not, but have you tried
setting 'Content-disposition: inline' in the header?

On 8/15/07, tedd <[EMAIL PROTECTED]> wrote:
> At 4:32 PM +0100 8/15/07, Stut wrote:
> >tedd wrote:
> >>Given:
> >>
> >>http://www.webbytedd.com/bb/ice/
> >>
> >>How can I play the movie inside the page instead of going to another page?
> >>
> >>I know that I could use phpclasses, but that seems an overkill.
> >>
> >>I think something like this --
> >>
> >>$file_source = 'ice-fishing.mov';
> >>$size = filesize($file_source,"","");
> >>
> >>header('Pragma: public');
> >>header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
> >>header('Cache-Control: must-revalidate, pre-check=0, post-check=0,
> >>max-age=0');
> >>header('Content-Transfer-Encoding: none');
> >>header("Content-type: video/quicktime");
> >>header("Content-Length: " . $size);
> >>
> >>-- but it's falling short.
> >
> >Something like this...
> >
> > >codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";
> >height="153" width="321">
> >   
> >   
> >   
> >>pluginspage="http://www.apple.com/quicktime/download/";
> >controller="true" autoplay="true" height="153" width="321">
> >
> >
> >I'm sure there are lots of tutorials on the web regarding the
> >details - I just nicked this code from
> >http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html
> >
> >-Stut
>
> -Stut:
>
> That certainly works, --
>
> http://www.webbytedd.com/bb/ice1/
>
> -- but I was hoping for something in the php realm.
>
> Thanks,
>
> tedd
>
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> 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] XML editors

2007-08-15 Thread Al

What do you guys use for casual XML editing, besides plain text editors?

Ones that'll error check and allow fixing files with errors?

Thanks...

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



[PHP] adding "Back to Search results" link

2007-08-15 Thread Derek Moon
I am trying to imporve a web application that my group uses.

Basically there are 3 forms that work together Form 1 > form 2

Form 1 - searchs for enterend values
Form 2 - returns search results, letting you individually select any item
Form 3 - lets you edit a specific individual item

I want to make a link on the Form 3 that returns you to form Form 2
basically a "Back to Search results" link.

I'm thinking that there is a way to pass the query string, but I am a newbie 
and I'm not sure that I am going about this the right way.

Anyone have any advice or knowledge to share? 

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Patrik Hasibuan
Dear Jim,

You've solved my problem, Jim. Thank you very much.

Now, my code give the output as my expectation:
"
superclass koneksi dipanggil
koneksi berhasil
negara->
". 
But come another problem, namely: the $negara is empty. I tried to read the 
documentation on 
"
http://www.php.net/manual/en/language.types.object.php#language.types.object.casting
"
but I didn't manage to find the answer.

I suspect the "return $kueri" could be only for 'returning' a variable of 
boolean or string or number but not 'returning' an array (such as the result of 
mysql_query("select country from countries",$koneksi) ) or an object (such as 
the result of mysql_connect() ).

So how should I get the content of mysql_query() so I can get the value with 
"mysql_fetch_row()" or inherit array?
Is is also possible to re-use the result of "mysql_connect()" or inherit the 
$konek?

Here is my current code:

//pelangganbaru.php
kueri);
list($negara)=$brs;
echo "$negara";

?>
=
//koneksi.php




  




";
$konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
if ($konek){
echo "koneksi berhasil";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>



Please keep telling me.

Thank you very much in advance.
ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds...

On Wed, 15 Aug 2007 09:00:56 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:

> 
> A few missing pieces in your code.  Take a look below within your class.  I 
> corrected it.
> 
> try also using include_once instead of require
> 
> and make sure that your error level and reporting are turned on so you can 
> see what is happening.
> 
> 
> Patrik Hasibuan wrote:
> > Dear my friends,
> > 
> > This is the first time for me to use OOP concept of PHP. I wrote still a 
> > very simple codes but it doesn't work as my manual book taught. the book 
> > titled "MySQL/PHP Database Application" by Jay Greenspan say these lines 
> > should work but in fact it don't work as expected.
> > Here is my code:
> > ===
> > //pelangganbaru.php
> >  > require "koneksi.php";
> > $sqlnya="select country from countries";
> > $klas=new koneksi($sqlnya);
> > ?>
> > ===
> > //koneksi.php
> > 
> > 
> > 
> > 
> >   
> > 
> > 
> > 
> > 
> >  > class koneksi{
> > $namakompie="127.0.0.1";
> var $namakompie='127.0.0.1';
> > $un="root";
> var $un='root';
> > $pw="mysqlpw";
> var $pw='mysqlpw';
> > $sqlnya;
> var $sqlnya;
> > $kueri;
> var $kueri;
> > 
> > function koneksi($sqlnya){
> > echo "superclass koneksi dipanggil";
> > $konek=mysql_connect("$namakompie","$un","$pw");
> $konek=mysql_connect($this->namakompie, $this->un, $this->pw);
> > if ($konek){
> > echo "koneksi berhasil (connection succeeded)";
> > $mybd=mysql_select_db("survey",$konek);
> > $kueri=mysql_query($sqlnya,$konek);
> > }else{
> > echo "I can't talk to the server";
> > exit();
> > }
> > return $kueri;
> > }
> > 
> > }
> > ?>
> > 
> > 
> > =
> > 
> > Theoritically if Class "koneksi" is being initialized than it prints 
> > "koneksi berhasil (connection succeeded)" but it doesn't.
> > 
> > Please tell me what is my mistake.
> > 
> > Thank you very much in advance.
> 
> 
> -- 
> Jim Lucas
> 
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
> 
> Twelfth Night, Act II, Scene V
>  by William Shakespeare
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

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



Re: [PHP] adding "Back to Search results" link

2007-08-15 Thread Brad Bonkoski

Something like this might work:

(To go back 1 page)
Of course if this is a form post, it would repost the data resulting in 
that annoying pop-up on most browsers indicating the page is being 
re-posted.


Maybe you could write out the post variables to the session variables, 
and have your page 2 look for the $_POST and $_SESSION for the variables 
in question...


-B

Derek Moon wrote:

I am trying to imporve a web application that my group uses.

Basically there are 3 forms that work together Form 1 > form 2

Form 1 - searchs for enterend values
Form 2 - returns search results, letting you individually select any item
Form 3 - lets you edit a specific individual item

I want to make a link on the Form 3 that returns you to form Form 2
basically a "Back to Search results" link.

I'm thinking that there is a way to pass the query string, but I am a newbie 
and I'm not sure that I am going about this the right way.


Anyone have any advice or knowledge to share? 

  


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



Re: [PHP] QuickTime question

2007-08-15 Thread Stut

tedd wrote:

At 4:32 PM +0100 8/15/07, Stut wrote:

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another 
page?


I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);

-- but it's falling short.


Something like this...

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"; 
height="153" width="321">

  
  
  
  pluginspage="http://www.apple.com/quicktime/download/"; 
controller="true" autoplay="true" height="153" width="321">



I'm sure there are lots of tutorials on the web regarding the details 
- I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut


-Stut:

That certainly works, --

http://www.webbytedd.com/bb/ice1/

-- but I was hoping for something in the php realm.


I'm confused. What do you mean by "inside the page"?

If you mean the embedded full-page Quicktime player that you sometimes 
get, that's a browser configuration issue and you'll never be able to 
control it for everyone, if anyone.


I'm not clear why you want a solution "in the php realm"? Use the right 
tool for the job and life becomes easier.


-Stut

--
http://stut.net/

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



Re: [PHP] XML editors

2007-08-15 Thread Stut

Al wrote:

What do you guys use for casual XML editing, besides plain text editors?

Ones that'll error check and allow fixing files with errors?

Thanks...


I tend to use Visual Studio for this sort of thing since I usually have 
it open anyway.


-Stut

--
http://stut.net/

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



Re: [PHP] QuickTime question

2007-08-15 Thread tedd

At 8:54 PM +0100 8/15/07, Stut wrote:

tedd wrote:

At 4:32 PM +0100 8/15/07, Stut wrote:

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,"","");

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, 
post-check=0, max-age=0');

header('Content-Transfer-Encoding: none');
header("Content-type: video/quicktime");
header("Content-Length: " . $size);

-- but it's falling short.


Something like this...

codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"; 
height="153" width="321">

  
  
  
  pluginspage="http://www.apple.com/quicktime/download/"; 
controller="true" autoplay="true" height="153" width="321">



I'm sure there are lots of tutorials on the web regarding the 
details - I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut


-Stut:

That certainly works, --

http://www.webbytedd.com/bb/ice1/

-- but I was hoping for something in the php realm.


I'm confused. What do you mean by "inside the page"?

If you mean the embedded full-page Quicktime player that you 
sometimes get, that's a browser configuration issue and you'll never 
be able to control it for everyone, if anyone.


I'm not clear why you want a solution "in the php realm"? Use the 
right tool for the job and life becomes easier.


-Stut


-Stut:

As for "inside the page", I meant that the example I originally 
provided sent the user to another page and I would like them to stay, 
which your suggestion worked very well -- thank you.


As for  "in the php realm" -- I'm sure you're right -- I just saw:

header("Content-type: video/quicktime");

and wanted to investigate. It looked like something I could play 
with. Besides, I do see that PHP Classes deals with it as well. So, I 
just wanted to see where that might take me.


As for "using the right tool for the job", there's lot's of tools 
that overlap and until you use the wrong one, you (as least me) don't 
really understand what the right one is.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] XML editors

2007-08-15 Thread Stut

I assume this comment was aimed at the list and not just me.

Kelvin Park wrote:

Stut wrote:

Al wrote:

What do you guys use for casual XML editing, besides plain text editors?

Ones that'll error check and allow fixing files with errors?

Thanks...


I tend to use Visual Studio for this sort of thing since I usually 
have it open anyway.


-Stut


eclipse + with the latest web plugin


-Stut

--
http://stut.net/

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Jim Lucas

Patrik Hasibuan wrote:

Dear Jim,

You've solved my problem, Jim. Thank you very much.

Now, my code give the output as my expectation:
"
superclass koneksi dipanggil
koneksi berhasil
negara->
". 
But come another problem, namely: the $negara is empty. I tried to read the documentation on 
"

http://www.php.net/manual/en/language.types.object.php#language.types.object.casting
"
but I didn't manage to find the answer.

I suspect the "return $kueri" could be only for 'returning' a variable of boolean or 
string or number but not 'returning' an array (such as the result of mysql_query("select 
country from countries",$koneksi) ) or an object (such as the result of mysql_connect() ).

So how should I get the content of mysql_query() so I can get the value with 
"mysql_fetch_row()" or inherit array?
Is is also possible to re-use the result of "mysql_connect()" or inherit the 
$konek?

Here is my current code:

//pelangganbaru.php


Try this instead

if ( mysql_num_rows($klas) > 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "$negara";
}
} else {
echo 'No results found';
}

And within your class change your mysql_query line to this

$kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] 
'.mysql_error($konek));


This will make the system fail and kill the script if the query fails for some 
reason.
The die() part will then print the error number and what mysql thinks is wrong.

This isn't the best way to use error reporting in a production system, but since you are new at 
this, this is a simple way to do error reporting.


It is always a good idea to use is_resource($resource_handle_from_mysql) as a test to see if you did 
in fact get a valid resource id from the mysql_connect() call.




$brs=mysql_fetch_row($klas->kueri);
list($negara)=$brs;
echo "$negara";

?>
=
//koneksi.php




  




";
$konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
if ($konek){
echo "koneksi berhasil";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>



Please keep telling me.

Thank you very much in advance.
ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds...

On Wed, 15 Aug 2007 09:00:56 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:


A few missing pieces in your code.  Take a look below within your class.  I 
corrected it.

try also using include_once instead of require

and make sure that your error level and reporting are turned on so you can see 
what is happening.


Patrik Hasibuan wrote:

Dear my friends,

This is the first time for me to use OOP concept of PHP. I wrote still a very simple 
codes but it doesn't work as my manual book taught. the book titled "MySQL/PHP 
Database Application" by Jay Greenspan say these lines should work but in fact it 
don't work as expected.
Here is my code:
===
//pelangganbaru.php

===
//koneksi.php




  





var $namakompie='127.0.0.1';

$un="root";

var $un='root';

$pw="mysqlpw";

var $pw='mysqlpw';

$sqlnya;

var $sqlnya;

$kueri;

var $kueri;

function koneksi($sqlnya){
echo "superclass koneksi dipanggil";
$konek=mysql_connect("$namakompie","$un","$pw");

$konek=mysql_connect($this->namakompie, $this->un, $this->pw);

if ($konek){
echo "koneksi berhasil (connection succeeded)";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>


=

Theoritically if Class "koneksi" is being initialized than it prints "koneksi 
berhasil (connection succeeded)" but it doesn't.

Please tell me what is my mistake.

Thank you very much in advance.


--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
 by William Shakespeare

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









--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] RE:www.soongy.com

2007-08-15 Thread Gevorg Harutyunyan
Hi,

 

Thank you very much for all emails.

I was trying to make it work in Opera, IE and FF and forgot such a simple
thing as screen resolutions.

 

I just fixed all.

 

Thanks once more,

Gevorg



Re: [PHP] OOP in PHP

2007-08-15 Thread Patrik Hasibuan
Dear Jim,

thanks for your help. I've modified my codes as you adviced.
But than the output is:
"
superclass koneksi dipanggil
koneksi berhasil
No results found
"

The column 'country' of table 'countries' already really contents complete all 
contry name from all over the earth. How come the query of "select country from 
countries" results empty value. So I believe the problem is still on the my OOP 
programming because if I do the query only with the "procedural concept" the 
$kueri will content the complete record of the column "country".

Please keep telling what is my mistake on my OOP PHP5 codes.
-
//pelangganbaru.php
 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "negara->$negara";
}
} else {
echo 'No results found';
}
?>
-
//koneksi.php




  




";
$konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
if ($konek){
echo "koneksi berhasil";
$mybd=mysql_select_db("survey",$konek);
//$kueri=mysql_query($sqlnya,$konek);
$kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR 
['.mysql_errno($konek).'] '.mysql_error($konek));
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>


===
On Wed, 15 Aug 2007 13:13:18 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:

> Patrik Hasibuan wrote:
> > Dear Jim,
> > 
> > You've solved my problem, Jim. Thank you very much.
> > 
> > Now, my code give the output as my expectation:
> > "
> > superclass koneksi dipanggil
> > koneksi berhasil
> > negara->
> > ". 
> > But come another problem, namely: the $negara is empty. I tried to read the 
> > documentation on 
> > "
> > http://www.php.net/manual/en/language.types.object.php#language.types.object.casting
> > "
> > but I didn't manage to find the answer.
> > 
> > I suspect the "return $kueri" could be only for 'returning' a variable of 
> > boolean or string or number but not 'returning' an array (such as the 
> > result of mysql_query("select country from countries",$koneksi) ) or an 
> > object (such as the result of mysql_connect() ).
> > 
> > So how should I get the content of mysql_query() so I can get the value 
> > with "mysql_fetch_row()" or inherit array?
> > Is is also possible to re-use the result of "mysql_connect()" or inherit 
> > the $konek?
> > 
> > Here is my current code:
> > 
> > //pelangganbaru.php
> >  > include_once "koneksi.php";
> > $sqlnya="select country from countries";
> > $klas=new koneksi($sqlnya);
> 
> Try this instead
> 
> if ( mysql_num_rows($klas) > 0 ) {
>   while( list($negara) = mysql_fetch_row($klas) ) {
>   echo "$negara";
>   }
> } else {
>   echo 'No results found';
> }
> 
> And within your class change your mysql_query line to this
> 
> $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR 
> ['.mysql_errno($konek).'] 
> '.mysql_error($konek));
> 
> This will make the system fail and kill the script if the query fails for 
> some reason.
> The die() part will then print the error number and what mysql thinks is 
> wrong.
> 
> This isn't the best way to use error reporting in a production system, but 
> since you are new at 
> this, this is a simple way to do error reporting.
> 
> It is always a good idea to use is_resource($resource_handle_from_mysql) as a 
> test to see if you did 
> in fact get a valid resource id from the mysql_connect() call.
> 
> 
> > $brs=mysql_fetch_row($klas->kueri);
> > list($negara)=$brs;
> > echo "$negara";
> > 
> > ?>
> > =
> > //koneksi.php
> > 
> > 
> > 
> > 
> >   
> > 
> > 
> > 
> > 
> >  > class koneksi{
> > var $namakompie="127.0.0.1";
> > var $un="root";
> > var $pw="mysuccess";
> > var $sqlnya;
> > var $kueri;
> > 
> > function koneksi($sqlnya){
> > echo "superclass koneksi dipanggil";
> > $konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
> > if ($konek){
> > echo "koneksi berhasil";
> > $mybd=mysql_select_db("survey",$konek);
> > $kueri=mysql_query($sqlnya,$konek);
> > }else{
> > echo "I can't talk to the server";
> > exit();
> > }
> > return $kueri;
> > }
> > 
> > }
> > ?>
> > 
> > 
> > 
> > Please keep telling me.
> > 
> > Thank you very much in advance.
> > ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds...
> > 
> > On Wed, 15 Aug 2007 09:00:56 -0700
> > Jim Lucas <[EMAIL PROTECTED]> wrote:
> > 
> >> A few missing pieces in your code.  Take a look below within your class.  
> >> I corrected it.
> >>
> >> try also using include_once instead of require
> >>
> >> and make sure that your error level and reporting are turned on so you can 
> >> see what is happening.
> >>
> >>
> >> Patrik Hasibuan wrote:
> >>> Dear my friends,
> >>>
> >>> This is the first time for me to use OOP concept of PHP. I wrote still a 
> >>> very simple codes but it doesn't work as my manual book taught. the book 
> >>> titled 

Re: [PHP] adding "Back to Search results" link

2007-08-15 Thread Jim Lucas

Derek Moon wrote:

I am trying to imporve a web application that my group uses.

Basically there are 3 forms that work together Form 1 > form 2

Form 1 - searchs for enterend values
Form 2 - returns search results, letting you individually select any item
Form 3 - lets you edit a specific individual item

I want to make a link on the Form 3 that returns you to form Form 2
basically a "Back to Search results" link.

I'm thinking that there is a way to pass the query string, but I am a newbie 
and I'm not sure that I am going about this the right way.


Anyone have any advice or knowledge to share? 



I would personally just use the back button. Isn't that what it is there for?

But seriously, if you changed the method on Form 1 to use get instead of post, you could then just 
have a button that sends you back 1 in your history, or 2 in this case.

...
...

Actually wait, it would be 3

form 1 -> results -> edit -> save changes ->\
 \--/

hope the format is correct on my ascii art :)

nope, now that I read it again, it is only 2 back in the history

So something like this for the back button

Return to search results

That should do

GUIDE LINES FOR USE OF METHOD in forms
POSTOnly use post when you are submitting a form
that will change the data that you are submitting

GET Use this for forms that do not change get, but
only retrieve data.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] adding "Back to Search results" link

2007-08-15 Thread Derek
Jim and Brad.

Thanks for the feedback. I was thinking it was something simple like a back 
button. But the problem that arises when I use this method is on Form 3.

If I go through the steps, and make a change to an item on Form 3. Then use 
the Return to search 
results.everything works fine.
But if I dont make any changes to Form 3. then this takes me all the way 
back to the search page.

People in my group use this form to update database information for a number 
of items. Once they make changes, they would like to go back to the search 
results, instead of having to run the same search again and again.




"Jim Lucas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Derek Moon wrote:
>> I am trying to imporve a web application that my group uses.
>>
>> Basically there are 3 forms that work together Form 1 > form 2
>>
>> Form 1 - searchs for enterend values
>> Form 2 - returns search results, letting you individually select any item
>> Form 3 - lets you edit a specific individual item
>>
>> I want to make a link on the Form 3 that returns you to form Form 2
>> basically a "Back to Search results" link.
>>
>> I'm thinking that there is a way to pass the query string, but I am a 
>> newbie and I'm not sure that I am going about this the right way.
>>
>> Anyone have any advice or knowledge to share?
>
> I would personally just use the back button. Isn't that what it is there 
> for?
>
> But seriously, if you changed the method on Form 1 to use get instead of 
> post, you could then just have a button that sends you back 1 in your 
> history, or 2 in this case.
> ...
> ...
>
> Actually wait, it would be 3
>
> form 1 -> results -> edit -> save changes ->\
>  \--/
>
> hope the format is correct on my ascii art :)
>
> nope, now that I read it again, it is only 2 back in the history
>
> So something like this for the back button
>
> Return to search results
>
> That should do
>
> GUIDE LINES FOR USE OF METHOD in forms
> POST Only use post when you are submitting a form
> that will change the data that you are submitting
>
> GET Use this for forms that do not change get, but
> only retrieve data.
>
>
>
> -- 
> Jim Lucas
>
>"Some men are born to greatness, some achieve greatness,
>and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
> by William Shakespeare 

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



RE: [PHP] QuickTime question

2007-08-15 Thread Bastien Koert

Can't you just embed   the file in the page?
 
   http://www.apple.com/qtactivex/qtplugin.cab";  height="256"  
width="320">   ">  
   "  
pluginspage="http://www.apple.com/quicktime/download/";  type="video/quicktime"  
controller="true"  autoplay="true">   
 
bastien> Date: Wed, 15 Aug 2007 11:25:43 -0400> To: php-general@lists.php.net> 
From: [EMAIL PROTECTED]> Subject: [PHP] QuickTime question> > Hi gang:> > 
Given:> > http://www.webbytedd.com/bb/ice/> > How can I play the movie inside 
the page instead of going to another page?> > I know that I could use 
phpclasses, but that seems an overkill.> > I think something like this --> > 
$file_source = 'ice-fishing.mov';> $size = filesize($file_source,"","");> > 
header('Pragma: public');> header('Last-Modified: '.gmdate('D, d M Y H:i:s').' 
GMT');> header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');> header('Content-Transfer-Encoding: none');> header("Content-type: 
video/quicktime");> header("Content-Length: " . $size);> > -- but it's falling 
short.> > Thanks for any help.> > Cheers,> > tedd> > -- > ---> 
http://sperling.com http://ancientstones.com http://earthstones.com> > -- > PHP 
General Mailing List (http://www.php.net/)> To unsubscribe, visit: 
http://www.php.net/unsub.php> 
_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

Re: [PHP] OOP in PHP

2007-08-15 Thread Jim Lucas

Patrik Hasibuan wrote:

Dear Jim,

thanks for your help. I've modified my codes as you adviced.
But than the output is:
"
superclass koneksi dipanggil
koneksi berhasil
No results found
"

The column 'country' of table 'countries' already really contents complete all contry name from all over the 
earth. How come the query of "select country from countries" results empty value. So I believe the 
problem is still on the my OOP programming because if I do the query only with the "procedural 
concept" the $kueri will content the complete record of the column "country".

Please keep telling what is my mistake on my OOP PHP5 codes.
-
//pelangganbaru.php

ok, don't know why it took me this long to realize what the problem is.

The following line will return the object of a the class that you are initializing, not the result 
set pointer.


So, what you need to do is this

Change this

function koneksi($sqlnya){
...
}

to this

function getkoneksi($sqlnya) {
...
}

Then this
$klas=new koneksi($sqlnya);
to this
$o = new koneksi();
$klas = $o->get_koneksi($sqlnya);

Now all should work.


$klas=new koneksi($sqlnya);
if ( mysql_num_rows($klas) > 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "negara->$negara";
}
} else {
echo 'No results found';
}
?>
-
//koneksi.php




  




";
$konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
if ($konek){
echo "koneksi berhasil";
$mybd=mysql_select_db("survey",$konek);
//$kueri=mysql_query($sqlnya,$konek);
$kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR 
['.mysql_errno($konek).'] '.mysql_error($konek));
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>


===
On Wed, 15 Aug 2007 13:13:18 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:


Patrik Hasibuan wrote:

Dear Jim,

You've solved my problem, Jim. Thank you very much.

Now, my code give the output as my expectation:
"
superclass koneksi dipanggil
koneksi berhasil
negara->
". 
But come another problem, namely: the $negara is empty. I tried to read the documentation on 
"

http://www.php.net/manual/en/language.types.object.php#language.types.object.casting
"
but I didn't manage to find the answer.

I suspect the "return $kueri" could be only for 'returning' a variable of boolean or 
string or number but not 'returning' an array (such as the result of mysql_query("select 
country from countries",$koneksi) ) or an object (such as the result of mysql_connect() ).

So how should I get the content of mysql_query() so I can get the value with 
"mysql_fetch_row()" or inherit array?
Is is also possible to re-use the result of "mysql_connect()" or inherit the 
$konek?

Here is my current code:

//pelangganbaru.php

Try this instead

if ( mysql_num_rows($klas) > 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "$negara";
}
} else {
echo 'No results found';
}

And within your class change your mysql_query line to this

$kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] 
'.mysql_error($konek));


This will make the system fail and kill the script if the query fails for some 
reason.
The die() part will then print the error number and what mysql thinks is wrong.

This isn't the best way to use error reporting in a production system, but since you are new at 
this, this is a simple way to do error reporting.


It is always a good idea to use is_resource($resource_handle_from_mysql) as a test to see if you did 
in fact get a valid resource id from the mysql_connect() call.




$brs=mysql_fetch_row($klas->kueri);
list($negara)=$brs;
echo "$negara";

?>
=
//koneksi.php




  




";
$konek=mysql_connect("$this->namakompie","$this->un","$this->pw");
if ($konek){
echo "koneksi berhasil";
$mybd=mysql_select_db("survey",$konek);
$kueri=mysql_query($sqlnya,$konek);
}else{
echo "I can't talk to the server";
exit();
}
return $kueri;
}

}
?>



Please keep telling me.

Thank you very much in advance.
ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds...

On Wed, 15 Aug 2007 09:00:56 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:


A few missing pieces in your code.  Take a look below within your class.  I 
corrected it.

try also using include_once instead of require

and make sure that your error level and reporting are turned on so you can see 
what is happening.


Patrik Hasibuan wrote:

Dear my friends,

This is the first time for me to use OOP concept of PHP. I wrote still a very simple 
codes but it doesn't work as my manual book taught. the book titled "MySQL/PHP 
Database Application" by Jay Greenspan say these lines should work but in fact it 
don't work as expected.
Here is my code:

Re: [PHP] Re: PHP Books - A poll of sorts

2007-08-15 Thread jekillen


On Aug 15, 2007, at 4:28 AM, David Powers wrote:


Jay Blanchard wrote:

If there was a best practices book would you buy it?


I write books on PHP aimed at the beginner/intermediate level, and 
have a considerable collection of PHP books written by others. Two 
relatively recent books that struck me as being important are "Pro PHP 
Security" by Chris Snyder and Michael Southwell, and "Essential PHP 
Security" by Chris Shiflett. (I know there's also "php|architect's 
Guide to PHP Security" by Ilia Ashanetsky and Rasmus Lerdorf, but I 
haven't read it.)


The thing that struck me most about the books was that anyone thought 
there should be a need for them. Of course, there is a need - that's 
why they were written. However, surely security should be taught from 
the very beginning? Every book on PHP (or any other language) should 
be a "best practices" book.


The problem is that books are written by human beings, who are prone 
to mistakes (myself included), and whose own view of "best practice" 
might leave gaps in security. The other problem is that a lot of 
people who use PHP just want to copy and paste a script that "works". 
Even if the ready-made script has been designed with security in mind, 
using it without understanding *how* it works can lead to unforeseen 
problems.


By the way, I would welcome constructive criticism of the scripts in 
my books. I have tried to incorporate what I perceive to be the best 
practices at the time of writing, but I'm sure there's room for 
improvement.




If I can add some stuff here;
I have done a lot of php/javascript programming from scratch and being 
self taught, without
good texts on the subject in addition to the php manual, I would be at 
a loss. Copying and
pasting code is kind of like being a commercial designer who never does 
original art but
just use stock stuff and crams it into templates. That should be the 
difference between
a pro developer and 'paste up'  artist. Inevitably, even copied and 
pasted code has to be
adapted for a particular use, other wise it boarders on theft. Even if 
you do use open source
you do not have to be a charity (albeit, I have not made any money at 
it to speak of).
I would like to think that the money I have spent on books, lining 
authors' and publishers
pockets, the money I have spent on commercial software from Adobe, 
Quark, etc, etc,
and the thousands of dollars I have spent on computer hardware over the 
years has not
been in vain (even though I have no ' meal ticket' with student loans 
that may take the
rest of my life to pay off and won't ever be guaranteed that that 
investment would pay

for itself).
Just my two cents.
Jeff K

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



RE: [PHP] adding "Back to Search results" link

2007-08-15 Thread Bastien Koert

what about hadding the search form elements to the results page and letting the 
users search right from there
 
bastien> To: php-general@lists.php.net> From: [EMAIL PROTECTED]> Date: Wed, 15 
Aug 2007 15:44:46 -0500> Subject: Re: [PHP] adding "Back to Search results" 
link> > Jim and Brad.> > Thanks for the feedback. I was thinking it was 
something simple like a back > button. But the problem that arises when I use 
this method is on Form 3.> > If I go through the steps, and make a change to an 
item on Form 3. Then use > the Return to 
search > results.everything works fine.> But if I dont make any changes 
to Form 3. then this takes me all the way > back to the search page.> > People 
in my group use this form to update database information for a number > of 
items. Once they make changes, they would like to go back to the search > 
results, instead of having to run the same search again and again.> > > > > 
"Jim Lucas" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED]> > 
Derek Moon wrote:> >> I am trying to imporve a web application that my group 
uses.> >>> >> Basically there are 3 forms that work together Form 1 > form 2> 
>>> >> Form 1 - searchs for enterend values> >> Form 2 - returns search 
results, letting you individually select any item> >> Form 3 - lets you edit a 
specific individual item> >>> >> I want to make a link on the Form 3 that 
returns you to form Form 2> >> basically a "Back to Search results" link.> >>> 
>> I'm thinking that there is a way to pass the query string, but I am a > >> 
newbie and I'm not sure that I am going about this the right way.> >>> >> 
Anyone have any advice or knowledge to share?> >> > I would personally just use 
the back button. Isn't that what it is there > > for?> >> > But seriously, if 
you changed the method on Form 1 to use get instead of > > post, you could then 
just have a button that sends you back 1 in your > > history, or 2 in this 
case.> > ...> > ...> >> > Actually wait, it would be 3> >> > form 1 -> results 
-> edit -> save changes ->\> > \--/> >> > hope the 
format is correct on my ascii art :)> >> > nope, now that I read it again, it 
is only 2 back in the history> >> > So something like this for the back button> 
>> > Return to search results> >> > 
That should do> >> > GUIDE LINES FOR USE OF METHOD in forms> > POST Only use 
post when you are submitting a form> > that will change the data that you are 
submitting> >> > GET Use this for forms that do not change get, but> > only 
retrieve data.> >> >> >> > -- > > Jim Lucas> >> > "Some men are born to 
greatness, some achieve greatness,> > and some have greatness thrust upon 
them."> >> > Twelfth Night, Act II, Scene V> > by William Shakespeare > > -- > 
PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: 
http://www.php.net/unsub.php> 
_
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

Re: [PHP] OOP in PHP

2007-08-15 Thread Jim Lucas

Jim Lucas wrote:

Patrik Hasibuan wrote:

Dear Jim,

thanks for your help. I've modified my codes as you adviced.
But than the output is:
"
superclass koneksi dipanggil
koneksi berhasil
No results found
"

The column 'country' of table 'countries' already really contents 
complete all contry name from all over the earth. How come the query 
of "select country from countries" results empty value. So I believe 
the problem is still on the my OOP programming because if I do the 
query only with the "procedural concept" the $kueri will content the 
complete record of the column "country".


Please keep telling what is my mistake on my OOP PHP5 codes.
-
//pelangganbaru.php

ok, don't know why it took me this long to realize what the problem is.

The following line will return the object of a the class that you are 
initializing, not the result set pointer.


So, what you need to do is this

Change this

function koneksi($sqlnya){
...
}

to this

function getkoneksi($sqlnya) {


oops this should be get_koneksi($sqlnya)


...
}

Then this
$klas=new koneksi($sqlnya);
to this
$o = new koneksi();
$klas = $o->get_koneksi($sqlnya);

Now all should work.



--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] adding "Back to Search results" link

2007-08-15 Thread Kirk Friggstad
Derek:

Does "form 1" use POST or GET to call "form 2"? If it uses GET, you
could store the search page URL  in a $_SESSION variable - something
like this in your search results (form 2):

$_SESSION['search_results_querystring'] = $_SERVER['QUERY_STRING'];

and in your editing page (form 3):

Back
to search results

(You'll need session support in both pages, of course - make sure you
call session_start() before working with the $_SESSION array).

If "form 1" uses POST, then it'll get a little more complicated - you
could try saving the $_POST data in the session (think there was a
recent thread on this list regarding that) and creating a form with
hidden elements on "form 3" that does a POST back to "form 2".

I'm a bit of a PHP newbie myself (just coming out of a long career in
ASP/VBscript development), so I'd appreciate any comments, (gentle)
criticism, etc. Hope this helps.

Kirk

On 8/15/07, Derek <[EMAIL PROTECTED]> wrote:
> Jim and Brad.
>
> Thanks for the feedback. I was thinking it was something simple like a back
> button. But the problem that arises when I use this method is on Form 3.
>
> If I go through the steps, and make a change to an item on Form 3. Then use
> the Return to search
> results.everything works fine.
> But if I dont make any changes to Form 3. then this takes me all the way
> back to the search page.
>
> People in my group use this form to update database information for a number
> of items. Once they make changes, they would like to go back to the search
> results, instead of having to run the same search again and again.
>
>
>
>
> "Jim Lucas" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Derek Moon wrote:
> >> I am trying to imporve a web application that my group uses.
> >>
> >> Basically there are 3 forms that work together Form 1 > form 2
> >>
> >> Form 1 - searchs for enterend values
> >> Form 2 - returns search results, letting you individually select any item
> >> Form 3 - lets you edit a specific individual item
> >>
> >> I want to make a link on the Form 3 that returns you to form Form 2
> >> basically a "Back to Search results" link.
> >>
> >> I'm thinking that there is a way to pass the query string, but I am a
> >> newbie and I'm not sure that I am going about this the right way.
> >>
> >> Anyone have any advice or knowledge to share?

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



Re: [PHP] OOP in PHP

2007-08-15 Thread Patrik Hasibuan
Dear my friend, Jim Lucas.

Thank you very much for your help. You've solved my problem one more time.

I really appreciate your help.
===
On Wed, 15 Aug 2007 14:17:02 -0700
Jim Lucas <[EMAIL PROTECTED]> wrote:

> Jim Lucas wrote:
> > Patrik Hasibuan wrote:
> >> Dear Jim,
> >>
> >> thanks for your help. I've modified my codes as you adviced.
> >> But than the output is:
> >> "
> >> superclass koneksi dipanggil
> >> koneksi berhasil
> >> No results found
> >> "
> >>
> >> The column 'country' of table 'countries' already really contents 
> >> complete all contry name from all over the earth. How come the query 
> >> of "select country from countries" results empty value. So I believe 
> >> the problem is still on the my OOP programming because if I do the 
> >> query only with the "procedural concept" the $kueri will content the 
> >> complete record of the column "country".
> >>
> >> Please keep telling what is my mistake on my OOP PHP5 codes.
> >> -
> >> //pelangganbaru.php
> >>  >> include_once "koneksi.php";
> >> $sqlnya="select * from countries";
> > ok, don't know why it took me this long to realize what the problem is.
> > 
> > The following line will return the object of a the class that you are 
> > initializing, not the result set pointer.
> > 
> > So, what you need to do is this
> > 
> > Change this
> > 
> > function koneksi($sqlnya){
> > ...
> > }
> > 
> > to this
> > 
> > function getkoneksi($sqlnya) {
> 
> oops this should be get_koneksi($sqlnya)
> 
> > ...
> > }
> > 
> > Then this
> > $klas=new koneksi($sqlnya);
> > to this
> > $o = new koneksi();
> > $klas = $o->get_koneksi($sqlnya);
> > 
> > Now all should work.
> > 
> 
> -- 
> Jim Lucas
> 
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
> 
> Twelfth Night, Act II, Scene V
>  by William Shakespeare
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

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



Re: [PHP] About Buggy SQL Query

2007-08-15 Thread Kelvin Park

Chris wrote:

Kelvin Park wrote:
mySQL database becomes inaccessible after a buggy sql string gets 
queried.
The SQL server runs fine, however it seems like just the database is 
being

looped infinitely so to say.
Here is an example:

(PHP)
$sql = "SELECT * FROM DB_TABLE WHERE PR_NUMBER = $whatever, DFLJJ =
$SD;LOOE"; (<-- invalid sql query string)
mysql_query($sql);

When this query string is queried during the (webpage) loading 
process, the

webpage just gets timed out without any error nor warning messages.

Does anyone know if there is a certain way to prevent mysql database 
from

stalling due to buggy sql strings?


use mysql_real_escape_string to stop it from happening.

I've tried the mysql_real_escape_string, however it seemed like it was 
working well at first, but the problem is that when I do the following 
query, the database crashes:


$query = "SELECT * FROM PRODUCT_TABLE WHERE MATCH (product, description) 
AGAINST('whatever') OR MATCH(categoryname) AGAINST('whatever')";


It seems like putting two match functions in the same query might have 
caused the crash.


My question is, how could I immediately just have one of my databases in 
the Database Server restarted (w/o affecting any of the data)?


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



Re: [PHP] About Buggy SQL Query

2007-08-15 Thread Chris

Kelvin Park wrote:

Chris wrote:

Kelvin Park wrote:
mySQL database becomes inaccessible after a buggy sql string gets 
queried.
The SQL server runs fine, however it seems like just the database is 
being

looped infinitely so to say.
Here is an example:

(PHP)
$sql = "SELECT * FROM DB_TABLE WHERE PR_NUMBER = $whatever, DFLJJ =
$SD;LOOE"; (<-- invalid sql query string)
mysql_query($sql);

When this query string is queried during the (webpage) loading 
process, the

webpage just gets timed out without any error nor warning messages.

Does anyone know if there is a certain way to prevent mysql database 
from

stalling due to buggy sql strings?


use mysql_real_escape_string to stop it from happening.

I've tried the mysql_real_escape_string, however it seemed like it was 
working well at first, but the problem is that when I do the following 
query, the database crashes:


$query = "SELECT * FROM PRODUCT_TABLE WHERE MATCH (product, description) 
AGAINST('whatever') OR MATCH(categoryname) AGAINST('whatever')";


It seems like putting two match functions in the same query might have 
caused the crash.


Why are they separate? Just include another field in the first match part.

If that's not an option, union the results:

select * from table where match(product) against('whatever')
union all
select * from table where match(categoryname) against('whatever')

See http://dev.mysql.com/doc/refman/4.1/en/union.html

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] maintaining session information

2007-08-15 Thread Vic Agnews
is there a way we can maintain session information across two sub-domains
(on two different servers though)  ... kinda like how google does it?
- vic


Re: [PHP] maintaining session information

2007-08-15 Thread Nathan Nobbe
you can do whatever you want w/ a custom session handler, just so long as
you implement all the methods.
you could for instance have the session handler do network i/o to a 'session
box' or something.
thats my initial guess at a solution.

-nathan

On 8/15/07, Vic Agnews <[EMAIL PROTECTED]> wrote:
>
> is there a way we can maintain session information across two sub-domains
> (on two different servers though)  ... kinda like how google does it?
> - vic
>