[PHP] RE: [PHP-DB] How to optimize select of random record in DB ?

2004-10-15 Thread Bastien Koert
skip the two step process and use RAND in the sql statement
SELECT * FROM table1, table2 WHERE a=b AND c
bastien
From: -{ Rene Brehmer }- <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: [PHP-DB] How to optimize select of random record in DB ?
Date: Fri, 15 Oct 2004 07:41:44 +0200
I made this code to pick a random record from a changeable number of 
records in a given table.
I'm just curious if any of the more awake coders out there can see a way to 
optimize this for better performance, since there's several other DB 
queries on the same page.

  $records = mysql_query("SELECT COUNT(*) AS count FROM persons") or 
die('Unable to get record count'.mysql_error());
  $totalcount = mysql_result($records,0) - 1;
  $rndrecord = rand(0,$totalcount);
  $personquery = mysql_query("SELECT personID FROM persons LIMIT 
$rndrecord,1") or die('Unable to get random record'.mysql_error());
  $personID = mysql_result($personquery,0);
--
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP Database 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-DB] Re: Office document upload to website (and inserting in MySQL if possible)

2004-10-02 Thread Bastien Koert
here is some code i wrote for a guy.

// redefine the user error constants - PHP 4 only
define("FATAL", E_USER_ERROR);
define("ERROR", E_USER_WARNING);
define("WARNING", E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL);
//Declarations
$myfile   = "";
$article  = "";
$username = "";
$FileFlag = 0;
$DBFlag   = 0;
$ConStartFlag = 0;
$LoggedInFlag = 0;
//
//logon the user on
if (($_SESSION['username']=="")&&(!$_POST['submit']=="Log In")){
 logon();   
  //show the logon form
 die();
}

//logon form submitted so check button and logon state
if (($LoggedInFlag==0)&&($ConStartFlag==0)&&($_POST['submit']=="Log In")){
 confirm_logon();
}
//
//main form code
//handle the data inputs
if (!$_POST['submit']=="Submit Entry"){
 show_form();
 die();
}else{
 $article = $_POST['article'];
}//end if
 //check for the presence of a file
 $tempfile = $_FILES['userfile']['tmp_name'];   
  //get the temporary file name from the upload dir
 if (is_uploaded_file($tempfile)){
   upload();
 }else{
   $FileFlag = 0;
 }//end if

 //check there is a value for article
 if ($article!=''){
   echo "Processing entry.";
   load_db($article);
 }
 //article submission confirmed and records / files updated uploaded
 if ($DBFlag == 1){
   confirmation();
 }
function show_form()
{
?>
 
  
  Composition:
  
  Send this file: 
   
 


function upload()
{
 // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used 
instead
 // of $_FILES.

 global $article, $FileFlag,$myfile;
 $uploaddir  = '../bastien/uploads/';   
 //change to match your dir
 $uploadfile = $uploaddir . $_FILES['userfile']['name'];
 $myfile = $_FILES['userfile']['name'];
 //echo "Filename is:".$myfile."";

 print "";
 //check the file extension (only doc allowed) and check the mime type of 
the file
 if ($_FILES['userfile']['type']!='application/msword'){
   echo "filetype=".strtolower(substr($_FILES['userfile']['name'],-3));

   if (strtolower(substr($_FILES['userfile']['name'],-3))=="doc"){
 //check the file size
 if ($_FILES['userfile']['size']<3){
   if (copy($_FILES['userfile']['tmp_name'], $uploadfile)){ 
  //windows
   //if (move_uploaded_file($_FILES['userfile']['tmp_name'], 
$uploadfile)) {  //unix
  $FileFlag = 1;

   } //end if copy file
 }//end if file size
   }//end if file type
 }else{
   show_form($article);
   die("File is of the wrong format and has been rejected. Please try 
again.");
 }
 print "";
}//end function

function load_db($article)
{
 global $DBFlag, $myfile, $FileFlag;
//get the data to load into the db
$sql = "";
$time_out = "";
$time_out = date("Y-m-D H:i:s");
//get the connection info
require("dbconng.php");
 //create and run the query to load the data into the db
 $sql = "update contest set article = '$article', time_out = now() ";
 if ($FileFlag == 1){
$sql.=", file_name = '$myfile' ";
 }
 $sql.= "where user_id=".$_SESSION['user_id'];
 echo $sql;
 $result = mysql_query($sql,$conn)or die ("Can't insert data because 
".mysql_error());

 if (!$result){
   echo "There was an error with the database. Hit the back button and try 
again.";
 }else{
   $DBFlag = 1;
 }//end if

}//end function
function confirmation()
{
 global $FileFlag, $DBFlag;
 //show the confirmation screen
 if (($FileFlag == 1) && ($DBFlag ==1)){
   $msg = "File and contest entry have been successfully uploaded.Good luck in the contest";
 }else{
   $msg = "Contest entry have been successfully uploaded.Good luck in 
the contest";
 }

 echo $msg;
 session_destroy();
} //end function
function logon()
{
 //show the logon form
 echo "
 Rich's Writing Club Contest
 
   
  User Name:
  Password :
  
   
 
   ";

}//end function
function confirm_logon()
{
 global $ConStartFlag;
 //get the connection info
 require("dbconng.php");
 //do the logon check
 $username  = "";
 $user_id   = "";
 $pass  = "";
 $sql   = "";
 $sql2  = "";
 $time_in   = "";
 $time_in   = date("Y-m-D H:i:s");
 //assume only alpha and numeric chars allowed in username & passwords
 
if((eregi("[[:alnum:]]",$_POST['username']))&&(eregi("[[:alnum:]]",$_POST['pass']))){
$username = $_POST['username'];
$pass = $_POST['pass'];

 }else{
logon();
die("Invalid login attempt");
 }//end if
 $sql = "select user_id from users where user_name = '$username' and pass = 
'".md5($pass)."'";

 $result = mysql_query($sql,$conn)or die ("Can't insert data because 
".mysql_error());

 if (m

Re: [PHP] Days until Easter and Christmas

2008-11-17 Thread Bastien Koert
On Sun, Nov 16, 2008 at 1:18 PM, Yeti <[EMAIL PROTECTED]> wrote:

> > I guess Canadians are slower, eh?  :-)
> LOL
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Only cuz it colder here!

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: phpDesigner 2008?

2008-11-18 Thread Bastien Koert
On Tue, Nov 18, 2008 at 10:06 AM, Yeti <[EMAIL PROTECTED]> wrote:

> Yes, NetBeans became my favourite too a while ago. And it runs on many
> Operating Systems, is free and has a debugger.
> I also like the way it handles projects.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I found the licensing on phdesigner to be somewhat restrictive. Its not a
bad editor, but I have been playing with Aptana which has a slightly steeper
learning curve
-- 

Bastien

Cat, the other other white meat


Re: [PHP] while-question

2008-11-18 Thread Bastien Koert
On Tue, Nov 18, 2008 at 9:33 AM, Nathan Rixham <[EMAIL PROTECTED]> wrote:

> Craige Leeder wrote:
>
>> Jochem Maas wrote:
>>
>>> klieder ... kliederen
>>>
>>> the E sound is short.
>>>
>>>
>>>
>> Interesting to know. Thanks :D
>>
>> - Craige
>>
>
> don't believe him, "jochem" is really called Bob Davis, a slightly balding
> middle aged ASP developer from hull sent to infiltrate the PHP community and
> misguide the weak with tales of short sounding letters.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Is this where we starting singing

'Pass the dutchie on the left hand side'?



-- 

Bastien

Cat, the other other white meat


Re: [PHP] How to Execute Multiple SQL Updates Using PHP

2008-11-19 Thread Bastien Koert
On Wed, Nov 19, 2008 at 2:51 PM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> On Wed, 2008-11-19 at 18:51 +, Alice Wei wrote:
> > Hi,
> >
> >   I am inquiring on this list to see if it is possible to create a script
> that takes multiple update statements without my having to write one "SQL"
> statement for each of the updates.
> >
> >   I have a scenario of which I create a table of some sort with some
> existing information using Flex, and what I am told by my client is that no
> matter how many records there are on the screen, the users should be able to
> update any up to all the entries by simply pushing a button. I use Microsoft
> SQL, which I think that it does allow multiple update query execution. The
> problem is that I might have to come up with some method to accept all the
> "POST" variables the user provides into the script.
> >
> >Could anyone please give me some guidance on what kind of function I
> might use, or whether or not it is possible I can create a script that
> accepts as many "POST" variables as the users POST?
> >
> > Thanks a lot for your help.
> >
> > Alice
> >
> > _
> > Check the weather nationwide with MSN Search: Try it now!
> > http://search.msn.com/results.aspx?q=weather&FORM=WLMTAG
> When I'm stuck on queries I always fall back to see how phpMyAdmin would
> treat it. Do a dummy run in there by updating a few rows of information
> at once, and then see what the SQL it produces looks like. You can
> perform multiple queries by using semicolons. Bear in mind that the
> queries are still treated as separate, so you may want to do them as a
> transaction if you need to fall back in-case of a problem.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
One thing to watch there is that you don't exceed the max query size limit
(which looks to be about 64K in size) for the sql string

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: file_Exists() and case

2008-11-24 Thread Bastien Koert
On Mon, Nov 24, 2008 at 10:02 AM, Stut <[EMAIL PROTECTED]> wrote:

> On 24 Nov 2008, at 14:41, Stan wrote:
>
>> Shouting is something that happens when people are actually speaking and
>> listening.  In a medium where there is no other way to emphasize salient
>> points in a message, capitalization is all that works.  I'm sorry it
>> offended your sensabilities.
>>
>
> It's actually well-established that capital letters indicate shouting. To
> emphasise words or phrases you should surround them with _ or *. The is also
> common practice.
>
>
>  realpath() fails, just like file_exists() fails, to report the file as
>> non-existant.
>>
>> echo "realpath(\$basePicture) returns '" . realpath($basePicture) .
>> "'\n";
>> echo "when \$basePicture is '" . $basePicture . "'\n";
>> ---
>> generates
>> ---
>> realpath($basePicture) returns '/Stan-and-Jeanne.com/pictures/2008 west
>> coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg'
>> when $basePicture is '../pictures/2008 west coast trip/2008-06-10 first
>> week
>> at Chris'/DSC_0011.jpg'
>> ---
>> but ls DSC_0011.* in ../pictures/2008 west coast trip/2008-06-10 first
>> week
>> at Chris' returns only
>> ---
>> DSC_0011.JPG
>> ---
>> and
>> ---
>> try {$image = new IMagick($basePicture);
>> } catch (Exception $e) {
>>   echo 'Caught exception: ',  $e->getMessage(), "\n";
>> }
>> ---
>> results in
>> ---
>> Caught exception: unable to open image `/Stan-and-Jeanne.com/pictures/2008
>> west coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg': No such
>> file
>> or directory
>> ---
>> so ... the following takes care of the extension problem in a very time
>> expensive way
>> ---
>> try
>> {
>> $image = new IMagick($basePicture);
>> }
>> catch (Exception $e)
>> {
>> $basePicture =
>>  substr($basePicture, 0, strrpos($basePicture, ".")) .
>>  "." .
>>  strtoupper(substr($basePicture, strrpos($basePicture, ".") + 1));
>> }
>> unset($image);
>> ---
>> I don't actually consider this solved and I'll return to it after
>> everything
>> else at least works.
>>
>> Now I can proceed to my next problem.
>>
>
> You never answered one of my questions. Where are you getting $basePicture
> from? Why does it differ in case from the actual file on disk. If you ask me
> you'd be better off trying to resolve this problem further upstream at the
> point where the case gets changed but your workflow doesn't appear to notice
> it.
>
> -Stut
>
> --
> http://stut.net/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
why not just create a small script that will move the files into the correct
folder from a temp storage spot and rename them to lowercase, then you are
always dealing with the same case and it should make things easier for you.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Netbeans 6.5 WAS: phpDesigner 2008?

2008-11-27 Thread Bastien Koert
On Wed, Nov 26, 2008 at 7:34 PM, Daevid Vincent <[EMAIL PROTECTED]> wrote:

>  On Tue, 2008-11-18 at 10:32 +, Holografix wrote:
>
> Hi
> I tried PHPDesigner some time ago. It's not bad but now I'm using Netbeans
> and it's a good editor: http://www.netbeans.org/ (it's free!)
>
>  I watched the little movie demo and was impressed, so I just installed and
> tried the Netbeans 6.5 (.sh installer for Linux b/c the Ubuntu repository
> has 6.1 still) and am really disappointed at how pokey the GUI is?! It's so
> slow as to be unusable. I'm baffled by this, as I've been using Eclipse PDT
> (which is a pig) and that also uses Java, but it's nowhere near as slow as
> Netbeans is.
>
> My system is far from old:
>
> Intel P4 CPU 3.20GHz with 2GB RAM.
>
> java version "1.6.0_10"
> Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
> Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
>
> (also tried with the OpenJDK or whatever it's called, and had the same
> miserable experience)
>
> I tried to adjust some of the netbeans.conf that I saw in the FAQ to no
> avail:
>
> netbeans_default_options="-J-client -J-Xverify:none -J-Xmx256m -J-Xss2m
> -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m
> -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true
> -J-XX:CompileThreshold=100 -Dswing.aatext=true"
>
> The fonts also looked horrible! All pixeley and like I was back in the
> 1980's.
>
> I read the forums and searched for "slow" and saw other poor souls with
> similar experiences, but no solutions. [image: :(]
>
> Oh well... Guess I'll stick with Eclipse PDT (and how does Zend get off
> charging $400 for "Zend Studio" which amounts to a few Eclipse plugins?!?
> Seriously? That's $150 at best)
>
> Daevid.
> http://www.daevid.com 
>
>
I've installed it but have yet to use it. I am having a good time with
APTANA Studio, though there is a learning curve

-- 

Bastien

Cat, the other other white meat


Re: [PHP] IE8 and HTML5

2008-12-04 Thread Bastien Koert
On Thu, Dec 4, 2008 at 4:44 AM, Sancar Saran <[EMAIL PROTECTED]>wrote:

> On Thursday 04 December 2008 10:45:21 Richard Heyes wrote:
> > Hi,
> >
> > From a recent IEBlog post:
> >
> >
> http://blogs.msdn.com/ie/archive/2008/12/03/compatibility-view-improvements
> >-to-come-in-ie8.aspx
> >
> Microsoft and Standarts ?
>
> Ship load of crap...
>
> Every web developer should open class action suit against M$ because of IE
> and
> M$ should banned from to create web browser for ever...
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I am running IE8 beta and its a PoS. Constantly crashing and flaky as shit.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] IE8 and HTML5

2008-12-04 Thread Bastien Koert
On Thu, Dec 4, 2008 at 9:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:

> > I am running IE8 beta and its a PoS. Constantly crashing and flaky as
> shit.
>
> Point of Sale...?
>
> --
> Richard Heyes
>
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.rgraph.org (Updated November 29th)
>

haha

-- 

Bastien

Cat, the other other white meat


Re: [PHP] IE8 and HTML5

2008-12-04 Thread Bastien Koert
On Thu, Dec 4, 2008 at 11:57 AM, Jay Moore <[EMAIL PROTECTED]> wrote:

> I am running IE8 beta and its a PoS. Constantly crashing and flaky as shit.
>>
>>
> 
> It's a beta.  What do you expect?
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
How about not throwing a js error on opening a new tab? Kinda basic, even MS
should be able to handle that or so I would have hoped. I have less issues
with Chrome and its beta

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Help with IF ELSE

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 9:17 AM, tedd <[EMAIL PROTECTED]> wrote:

> At 7:19 AM -0500 12/5/08, David Stoltz wrote:
>
>> The problem turned out to be, since I'm using the MCRYPT function to
>> encrypt the password, once in a while the encrypted password will have a bad
>> character:
>>
> --snip--
>
>>
>> So then, how does one store this type of string? I can't do a string
>> replacebut there must be a way...
>>
>
> I use md5() -- it works great for passwords and I don't have that type of
> problem.
>
> 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
>
>
One option is to base64encode it before sticking it in the db and then doing
a base64decode upon retreival.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 3:18 PM, Ashley Sheridan <[EMAIL PROTECTED]>wrote:

> On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
> > Java Script should always be an option, unless you write the
> > validation for yourself or people you personally know only.
> >
> JavaScript is client-side, ergo untrusted. Javascript can be nice as an
> addition, but only that.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Never trust the user, always validate on the server


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Downloading file from local network machine

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 3:22 PM, Ashley Sheridan <[EMAIL PROTECTED]>wrote:

> On Fri, 2008-12-05 at 17:32 +, Mayer, Jonathan wrote:
> > Thanks Wolf :)
> >
> > Yup, I had considered that, although there could be up to 8 different
> servers so that's 8 seperately mapped drives.
> >
> > If that's the simplest/neatest way, I'll do that, although I did wonder
> whether there was some other clever another way around it.
> >
> > -Original Message-
> > From: Wolf [mailto:[EMAIL PROTECTED]
> > Sent: 05 December 2008 17:29
> > To: Mayer, Jonathan; php-general@lists.php.net
> > Subject: Re: [PHP] Downloading file from local network machine
> >
> > 
> > > I  would like to present users to our internal intranet with a link to
> > > download a file from a folder on a different machine on our local
> > > network (such as \\computername\folder\file)
> > 
> >
> > Map the drive to the server so that it is accessible as /folder/file on
> the website.
> >
> > Voila, no more problem.
> >
> > HTH,
> > Wolf
> >
> >
> I don't have the code to hand right now, but I can try and post it
> later. You were on the right track with fread() et al. Basically, set
> the correct headers for a download (application/octet-stream I believe)
> and print out the results of the fread(). Don't forget the binary flag
> on fread() if you are opening binary files, and it should create a file
> that auto-downloads. There are extra headers to set the default filename
> of the download, but I forget these at the moment. A Google should give
> you what you need though. This way, the file can even be delivered to
> someone outside of your network should you wish, without you needing to
> put the file in a web-accessible directory.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
function force_download($file)
{
$dir  = "../log/exports/";
if ((isset($file))&&(file_exists($dir.$file))) {
   header("Content-type: application/force-download");
   header('Content-Disposition: inline; filename="' . $dir.$file . '"');

   header("Content-Transfer-Encoding: Binary");
   header("Content-length: ".filesize($dir.$file));
   header('Content-Type: application/octet-stream');
   header('Content-Disposition: attachment; filename="' . $file . '"');
   readfile("$dir$file");
} else {
   echo "No file selected";
} //end if

}//end function


-- 

Bastien

Cat, the other other white meat


Re: [PHP] MSSQL_CONNECT problem

2008-12-08 Thread Bastien Koert
On Mon, Dec 8, 2008 at 9:45 AM, Dan Shirah <[EMAIL PROTECTED]> wrote:

> >
> > Can't seem to connect with MSSQL_CONNECT. The function IS available. I'm
> > in a Windows environment, connecting to a SQL 2000 instance. My code:
> >
> > mssql_connect('INTRA_SQL,1433', 'uname', 'password');
> > mssql_select_db('database');
> >
> > I've tried leaving the port out, tried using server IP address, all to
> > no avail. I've copied the "ntwdblib.dll" from my SQL 2000 box to my PHP
> > directory on the web server - no go. (this was suggested on the php
> > site).
> >
> > mssql.secure_connection = off (in the php.ini file)
> > extension=php_mssql.dll (is also included in the ini file)
> >
> > Keep getting error message: Unable to connect to server
> >
> > Does anyone have any ideas?
> >
> > Thanks!
> > Dave
>
>
> Dave,
>
> For my connection I didn't copy the ntwdblib.dll file from the SQL Server
> and paste it onto the PHP server...I believe there was an older version of
> the ntwdblib.dll that I had to download...the file had a modification date
> of I think 11/2003.
>
> Things to check.
>
> extension=php_mssql.dll uncommented in your PHP.ini
>
> See if your PHP server can talk to your SQL Server.  I would assume they
> are
> both inside the DMZ and that your DNS resolves the server names, correct?
>
> When making your connection try doing it like this:
>
> //Assign the server connection to a variable
> $connect = mssql_connect('SERVERNAME, 'USERNAME', 'PASSWORD');
>
> //Select your database and reference the connection
> mssql_select_db('DATABASE', $connection);
>
Have you created a mssql account to allow connetion from whereever you are
coming from?


-- 

Bastien

Cat, the other other white meat


Re: [PHP] A MySQL Question

2008-12-09 Thread Bastien Koert
On Tue, Dec 9, 2008 at 11:40 AM, <[EMAIL PROTECTED]> wrote:

>
> Perhaps you couldn't hear the big bang in this universe, but what about in
> the universe that spawned it?
> :-)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> The omniverse or the underverse?


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Poll of Sorts: Application Frameworks--Zend, Cake etc

2008-12-11 Thread Bastien Koert
On Thu, Dec 11, 2008 at 10:15 AM, Eric Butera <[EMAIL PROTECTED]> wrote:

> On Thu, Dec 11, 2008 at 9:56 AM, Terion Miller <[EMAIL PROTECTED]>
> wrote:
> > Hey Everyone, I am wondering if using a framework such as one of these
> may
> > make my life easier, which do any of you use and what has been your
> > experience with the learning curve of them?
> > I just put Cake on my local server, basically I want to know which is
> > easiest? LOL...
> > Terion
> >
>
> Define easiest.  What is it that you need to code?  If you mean cookie
> cutter sites that have been done a million times with minimal
> flexibility... :)  I'm in the same boat as you though.  I don't know
> which one meets the needs I have the best.  There's stuff like cake
> which is really easy to start up, then there's stuff like symphony
> that will let you do anything, but you really have to work at it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
There are definite learning curves when picking these up.

symfony and ZF have the largest because they either do more (symfony) or are
designed to be used piecemeal (ZF)

CodeIgnitor is one of the easiest ones to start using with Cake not far
behind

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Foreign Keys Question

2008-12-11 Thread Bastien Koert
On Thu, Dec 11, 2008 at 12:56 PM, tedd  wrote:

> Hi gang:
>
> I know this is a MySQL question, but I get a better reply from this group
> than the MySQL list (no offense meant to that list) -- In any event, here
> goes.
>
> I currently have a project that's a classic example of a relational
> database, namely the course, student, and instructor problem.
>
> I have my database set-up such that there are tables for courses, students,
> and instructors -- each table with it's own unique/primary ID.
>
> The Course table has a field for the Instructor, which is the primary ID
> found in the Instructor's table.
>
> Likewise, the Course table also has fields for up-to four students (a
> private tutorial service). These will be filled by the the respective
> primary ID's found in the Student's table.
>
> This configuration is "Second Normal Form".
>
> The Course table also has fields for date, times and such.
>
> If I want to see the schedule for any specific day, I simply open the
> Course table and search for date and time. From that I can retrieve the
> Student ID's and the Instructor ID.
>
> From those, I open the Student table and pull out all students who attend
> the class and then open the Instructor's table and pull out what data I need
> re the Instructor.
>
> Everything works.
>
> My question is, can using Foreign Keys make this work better? Can I
> retrieve all this data in one query? (I think that's what foreign keys do --
> but, I'm assuming that).
>
> I believe I can create the Course table (excluding everything not germane)
> like so:
>
> INDEX (student_id),
> FOREIGN KEY (student_id)
>   REFERENCES (students(id)),
> INDEX (instructor_id),
> FOREIGN KEY (instructor_id)
>   REFERENCES (instructors(id)),
>
> But how do I use Foreign Keys to retrieve data? What is the specific query
> to pull out data from all three tables at once?
>
> Does anyone have any example code to show me the actual syntax?
>
> Thanks and 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
>
>
Nope, You can't use Fks for this. Foreign keys are constraints and are used
to limit the data in the table. If you were to put an FK on the courses
table referencing the instructors table on the instructor id, the instructor
id must exist in the instructor table before db will allow the entry of the
instructor id in the courses table. The idea is to force data integrity in a
system such that certain records can't be created without having
the necessary backup data from another table.
Joins should allow you to pull the data from the table in one query

hth

-- 

Bastien

Cat, the other other white meat


Re: [PHP] First PHP program

2008-12-13 Thread Bastien Koert
On Sat, Dec 13, 2008 at 4:45 AM, Kevin Waterson  wrote:

> This one time, at band camp, Anwarulhaq  wrote:
>
> > I am working on MS.net.But now i days i want to work on PHP. I dont know
> the
> > basis of PHP. Can any one guide me how i have to start with PHP and which
> > editor i should use. Also the links of useful sites for help in PHP. I
> shall
> > be thankful.
>
> have a look at phpro.org and for an editor, well vi(m) of course ;)
> set yourself a project to make something, start coding, and ask lots
> of questions.
>
> Kevin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
There are a host of free editors that can be looked at
Apatana Studio and NetBeans are excellent editors

-- 

Bastien

Cat, the other other white meat


Re: [PHP] php client

2008-12-14 Thread Bastien Koert
On Sun, Dec 14, 2008 at 6:51 PM, Nathan Rixham  wrote:

> idan72 wrote:
>
>> Hi,
>>
>> I am new to PHP.
>> I want to write a web client in PHP that will data to a server written in
>> Java.
>> I want that the client will send an object to the server.
>>
>> What is the best way to do that?
>> Where can I find an example for doing that ?
>>
>> Thanks
>>
>>
>>
> Run you're java app as a soap 1.X web service, using jax-ws via cxf/axis2
> on tomcat/jboss if it's a spring app; or jax-ws via metro on glassfish/jboss
> if it's an EJB3 app.
>
> When you deploy all your input and return objects will be defined in WSDL.
>
> on the php side you'd probably be best to use WSO2 WSF/PHP, which will
> parse the wsdl and auto generate the input return objects from the wsdl.
>
> works a treat.
>
> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html
> http://wso2.org/projects/wsf/php
> https://jax-ws.dev.java.net/
> google
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hey, thats pretty cool. I have a project in mind where that may be very
useful. Thanks for the link, Nathan.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] new xampp server problem w/mail

2008-12-15 Thread Bastien Koert
On Mon, Dec 15, 2008 at 2:49 PM, Jim Lucas  wrote:

> Ian Lin wrote:
> > hi I have been searching for a way to get the php mail function to work
> and have had no luck. I was hoping you could address my situation:
> >
> > I have a fairly new xampp install and I need to know how to get mail() to
> work. I would like to know tha simplest way possible to get the mail
> function to work. I guess the major problem is that my xampp install doesn't
> have an email server. please advise my what I need to do to get one for a
> linux box.
> >
> > Please keep in mind that I am a newbie and need detailed instructions for
> installing any software and configuring any files that may need altered in
> the server's configuration files such as php.ini etc...
> >
> > email me at linia...@yahoo.com if you can help.
> >
> > Thanks,
> > Ian
>
> Why is it a requirement to use mail() ??  Why not use a package like
> phpmailer or some such email lib?
>
> --
> 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
>
>
Getting email to work on a Windows installed local machine is a pain in the
ass...I usually just code it and test it online since I tend to use the same
code all the time
-- 

Bastien

Cat, the other other white meat


Re: [PHP] Create unique non-autoincrement key for 700,000 records?

2008-12-15 Thread Bastien Koert
On Mon, Dec 15, 2008 at 9:29 PM, Rob Gould  wrote:

> I have a mySQL database with 700,000 records in it, which are presently
> keyed with an "auto-increment" field.
>
> What I'd like to do is create another field with a field where each and
> every record number has a unique keyvalue. Example:  "su5e23vlskd" for
> records 1, and "34fdfdsglkdj4" for record 2.  All that matters is that it's
> unique, and isn't a number that can be guessed or an "autoincrement" number,
> where a hacker can just figure out the keyvalue by incrementing numbers.  It
> doesn't matter to me if each keyvalue field is just numbers, or a
> number/letter combination - - - all that matters is that each keyvalue field
> is unique.  Is there an automatic way that mySQL could do that, or would I
> need to write a php script to somehow go through each record and create this
> unique value?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
update mytable set hash_field = md5(AutoIdField + unix_timestamp())

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Printing

2008-12-17 Thread Bastien Koert
On Wed, Dec 17, 2008 at 2:57 PM, Dan Shirah  wrote:

> Hello all,
>
> Could someone please point me in the right direction for printing files
> through PHP?
>
> I already have my application setup so that it creates documents and saves
> them to a folder.  How would I go about printing all of the files in the
> folder via PHP?
>
> I've looked into the Print functions in the manual (
> http://us2.php.net/manual/en/ref.printer.php) but this does not seem to be
> the right thing to use to print documents that already exist.
>
> Thanks,
> Dan
>
I would suggest sending a PDF to the client and allowing the client to
handle the rest.


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Printing

2008-12-17 Thread Bastien Koert
On Wed, Dec 17, 2008 at 3:16 PM, Dan Shirah  wrote:

> >
> >   Do you want to print this on your office printer or on the website
> users
> > printer?
> >
> > If you are looking for away to print it on their printer, why not just
> grab
> > all the files that need to be printed, make a PDF of it, and then use the
> > browsers print feature?
> >
> >
> >
> >  --
> > Jason Pruim
> > japr...@raoset.com
> > 616.399.2355
> >
>
> I want it to print to the users local printer.
>
> Basically the user has a form and based on their search criteria they will
> get multiple results.
>
> Next to each result I have a checkbox that the user will use to select the
> documents they want to print.
>
> Once they have selected everything they want to print, they click on a
> "Print Selection" link.
>
> The checkboxes all have the same name but different dynamically assigned
> values, so once they click to print, an array of values for the checkbox
> name is passed to my next page.
>
> I have a for () loop on the next page that extracts each individual value
> and uses it in a query to extract information and build a pdf which is
> automatically output to a file.
>
> Once a PDF has been generated I want to send it to the users printer to be
> printed.
>

You can't, the best you can do is send the PDF down and let the user choose
to do with it what they will

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Read/decode barcodes from an image

2008-12-17 Thread Bastien Koert
On Wed, Dec 17, 2008 at 7:42 PM, Al  wrote:

> If anything can do it, it'll be ImageMagick
>
> Adam Randall wrote:
>
>> I'm amazed that this either doesn't exist, or is hard to find. I
>> basically am looking for a way to read in an image into PHP, or shell
>> out to something on the Linux side, and determine, and see if it has a
>> barcode in it or not. If it does, I need to decode the barcode so that
>> I can identify the page as a separator page or not.
>>
>> Basically, what I'm doing is reading in a PDF or TIF which will
>> contain multiple pages (probably a lot of pages) and look for a page
>> containing a barcode. The barcode will identify the page as a
>> separator page which will be used to split the multipage document into
>> smaller single or multipage documents.
>>
>> Has anyone ever heard of anything that might help me in this process?
>>
>> Adam.
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
your best bet would likely be to find an open source OCR package (like
http://jocr.sourceforge.net/ ) and shell out to it to do the reading in. One
of our clients wrote a .NET app to just this that renames the file with the
ocr barcode after which we pick it up and handle the rest

hth

-- 

Bastien

Cat, the other other white meat


Re: [PHP] PHP Form email w/attachment

2008-12-17 Thread Bastien Koert
On Wed, Dec 17, 2008 at 11:02 PM, jeffery harris <
jhar...@harris4interactive.com> wrote:

> I need to create a php form and mail it to a recipient (that I can do). My
> question is how do I create an area for a file (.doc, or .pdf) to be
> attached emailed along with other form data as well?
>
> -Jeff
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> You need to allow the user to upload the file first, using the standard
http file upload. After its on the server, use phpmailer to handle the
mailing...easy peasy


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: HTTP Error 500 - IsapiModule

2008-12-19 Thread Bastien Koert
On Fri, Dec 19, 2008 at 11:48 AM, Jim Lucas  wrote:

> Gary Maddock-Greene wrote:
> > Yes .. thanks Stuart. If I comment out that line I now get a different
> > problem!!
> >
> > Unable to connect to database.
> >
> > One step closer!!!
> >
> >
>
> Well, now take and place a simple or die(mysql_error()); after your
> mysql_connect() call
>
> $rh = mysql_connect() or die(mysql_error());
>
> Mind you that the above is not recommended in production code.
>
> But, it works for trying to figure out this type of problem.
>
> --
> 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
>
>
Assuming you are using some flavor of IE, ensure the Always Show Friendly
Errors Messages is unchecked the browser's Tools > internet options >
advanced tab


-- 

Bastien

Cat, the other other white meat


Re: [PHP] ACL Framework / Library

2008-12-24 Thread Bastien Koert
On Wed, Dec 24, 2008 at 9:01 AM, Feris  wrote:

> Hi All,
> Is there any references for a good ACL framework / library ? I want to
> develop one but if there is any available I didn't want to reinvent the
> wheel.
>
> Thanks,
>
> Feris
>

Zend has their ACL as part of the framework

http://framework.zend.com/manual/en/zend.acl.html

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Since I speak with some of you more than people I see in person....

2008-12-30 Thread Bastien Koert
On Tue, Dec 30, 2008 at 4:32 PM, Daniel Brown  wrote:

>To hell with being on-topic, since this list is generally never
> on-topic for an entire thread anyway.
>
>This has been a roller-coaster year for some of us --- certainly
> myself included --- but the year has come to a close.  I want to take
> a moment to wish each and every one of you a safe and wonderful new
> year.  May 2009 be ten times healthier, happier, and more prosperous
> to you and yours than the three best years of your life so far, and
> may each year beyond that be better even than the one before.
>
>And as a side note (some of you already know): for my wife and I
> closing out the year, we heard the heartbeat of our first child for
> the first time today in the ultrasound.  Nothing else will ever again
> matter as much to me as what I am about to embark upon.  I don't think
> any song or sound I've ever heard in my entire life was as beautiful
> as those few seconds.  My heart literally feels so full that it could
> burst at any moment.
>
>To all of you, thank you for being a part of the PHP project, and
> many of you professional and personal parts of my life.  Of all of the
> communities I've been involved in the last sixteen years or so, this
> has always been my favorite.  And it's because of you folks.
>
>From the bottom of my (bursting!) heart, thank you, and I look
> forward to working alongside all of you in 2009.
>
>All the best
>
> --
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Unadvertised dedicated server deals, too low to print - email me to find
> out!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Congrats on the new critter to be...they are a lot of fun after the first
year of eating sleeping and pooping ;-)

-- 

Bastien

Cat, the other other white meat


Re: [PHP] IE Problem Detecting Post Variables

2009-01-01 Thread Bastien Koert
On Thu, Jan 1, 2009 at 11:59 AM, Ashley Sheridan
wrote:

> On Thu, 2009-01-01 at 11:25 -0500, Phpster wrote:
> > What about using the onclick to set a js variable to be sent to the
> > server? That should be more cross server compliant.
> >
> > Bastien
> >
> > Sent from my iPod
> >
> > On Dec 31, 2008, at 8:37 PM, "L. Herbert" 
> > wrote:
> >
> > > Bastien,
> > >
> > > Thanks for your response.  The curious thing is that the value is
> > > passed when using FF, but not passed when using IE.
> > >
> > > Here is the relevant form html:
> > >
> > >
> > >
> > >Flip It!
> > > > > value="default" />
> > > > > value="alternate" />
> > >
> > >
> > >
> > > The action attribute is left blank so the form posts to the current
> > > page.  The theme switcher script is at the top of each page and
> > > intercepts the posted variables.
> > >
> > > Any thoughts?
> > >
> > >
> > > On Dec 31, 2008, at 11:02 AM, Phpster wrote:
> > >
> > >> Try checking to see if the value was passed with var_dump($_REQUEST)
> > >>
> > >> Also try (!empty($_REQUEST['style']))
> > >>
> > >>
> > >> Bastien
> > >>
> > >> Sent from my iPod
> > >>
> > >> On Dec 31, 2008, at 10:24 AM, "L. Herbert"
> > >>  wrote:
> > >>
> > >>> Hello all,
> > >>>
> > >>> Anyone have insight to share on the following issue:
> > >>>
> > >>> I have a simple theme switcher script that functions as expected
> > >>> in FF, Safari, etc. but does not work in IE 6 or 7.  It appears
> > >>> that the posted form variables are not detected in IE.   I am
> > >>> using the following check within the script:
> > >>>
> > >>> if(isset($_REQUEST['style'])) {
> > >>>
> > >>>  $style = $_REQUEST['style'];
> > >>> }
> > >>>
> > >>> Thanks in advance for your assistance.
> > >>>
> > >>> --
> > >>> 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
> > >>
> > >
> >
> Which would make it as non-accessibility-friendly as possible...
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
There are always trade-offs

-- 

Bastien

Cat, the other other white meat


Re: [PHP] First steps towards unix and php

2009-01-08 Thread Bastien Koert
On Thu, Jan 8, 2009 at 11:45 AM, John Corry  wrote:

> Ubuntu linux has been really easy to set up, administrate and
> install/run programs.
>
> It has a huge user base, really good support forums and supports a
> large variety of hardware configurations. I'm running it on my
> Thinkpad T40, which I use for PHP development when travelling. It's
> rock solid and easy to work with.
>
> Definitely ought to be one of the packages you consider.
>
> On Thu, Jan 8, 2009 at 11:44 AM, Frank Stanovcak
>  wrote:
> > I've been a microshaft punk for some time now, and am just getting ready
> to
> > try to step over to unix on one of my own boxes.
> >
> > Does anyone have any suggestions on which flavor would be a good idea to
> > start with?  I'm looking mostly for compatibility with php, mysql, and
> other
> > web based programming languages.
> >
> > Thanks in advance!
> >
> > Frank
> >
> >
> >
> > --
> > 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
>
>
Ubuntu has my vote as well. Also has good support for wireless drivers and
other laptop goodies.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] How can a script tell if there's a MySQL problem?

2009-01-09 Thread Bastien Koert
On Fri, Jan 9, 2009 at 11:07 AM, Per Jessen  wrote:

> Brian Dunning wrote:
>
> > I have one server that's pretty busy and runs into "Too many
> > connections" from MySQL from time to time, and needs to have MySQL
> > restarted to clear it up.
>
> You need to restart MySQL just because of too many connections??
>
> > I've tried everything I can think of to have PHP take note of this
> > error but continue executing with other stuff, but no matter what I
> > try the PHP script stops whenever it encounters this and just displays
> > "Too many connections."
>
> Isn't that error returned by mysql_connect()?  Just write your code to
> work without the database connection.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
1. Make sure you are freeing up all resources as soon as you can ->
mysql_close();

2. Change the my.cnf file connection number to a larger amount -> *
max_connections*

3. cache what you can (memcache, apc, filesystem, etc)

-- 

Bastien

Cat, the other other white meat


Re: [PHP] iconv is messing up a spreadsheet generated by the Spreadsheet Excel Writer

2009-01-13 Thread Bastien Koert
On Tue, Jan 13, 2009 at 10:47 AM, Thodoris  wrote:

>
>  Is there any chance its characters creeping in from being copied from a
>> M$ program? I found that M$ software uses it's own character encodings
>> for multibyte characters which causes no end of problems for web-based
>> systems. A lot of it was where angled quotation marks were added my
>> Word, and not encoded using the UTF encodings, but the M$-style ones
>> instead.
>>
>>
>> Ash
>> www.ashleysheridan.co.uk
>>
>>
>>
>
> Well this not the case...
>
> This is a client list that is being exported from the mysql table and there
> is a whole web site that inserts, updates and manipulates in general this
> table. But all the data are being validated. The only thing that might be
> causing this is that you may import data massively using a csv file and I
> manged to resolve the encoding problem by asking the user to define it while
> importing.
>
> The thing that troubles me is that all data are imported correctly and
> something like a special character or something that Excel doesn't think is
> right a messing all up.
>
> I am really stuck so any help could be very useful...
>
> --
> Thodoris
>
>
Could you base64encode() the data? Or try HtmlEntities()? Is it text data
that is causing the issue?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] installing php 5 with pdflib

2009-01-13 Thread Bastien Koert
On Tue, Jan 13, 2009 at 4:38 PM, Merlin Morgenstern wrote:

> Hi there,
>
> I am still facing trouble with pdflib and php 5. After hours of research I
> found that I do have to install the pecl package. So I decided to compile it
> into php staticly like described here:
> http://www.php-resource.de/handbuch/install.pecl.static.htm
>
> The configure command stops with the error:
> configure: error: pdflib.h not found! Check the path passed to
> --with-pdflib=. PATH should be the install prefix directory.
>
> actually the file is and always was there. Does it have to be a new
> version? I am using pdflib 4.x which workes fine in the running php 4.x
> installation.
>
> Thank you for any help,
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
try dompdf from www.digitaljunkies.ca...its a class for pdf that I found
pretty simple to implement

-- 

Bastien

Cat, the other other white meat


Re: [PHP] developers life

2009-01-19 Thread Bastien Koert
On Mon, Jan 19, 2009 at 4:28 PM, Nathan Rixham  wrote:

> well just for the hell of it; and because I'm feeling worn..
>
> anybody else find the following true when you're a developer?
>
> - frequent bursts of side-tracking onto more interesting subjects


of course


>
> - vast amount of inhuman focus, followed by inability to remain focussed


uh?


>
> - general tendancy to keep taking on projects, often for no good reason


can't get enough


>
> - inability to flip out of work mode at 5pm like the rest of the world


what,  you mean they finish at 5? lazy bastards!


>
> -- [sub] not feeling normal unless worked you've extra; while other
> professions demand overtime as little as an extra 15 minutes
> - constant learning (positive thing)


always, flex & php at the moment


>
> - unlimited skill scope, if its on a computer you'll give it a go


try anything once!


>
> - amazing ability to prioritise (the wrong things)


thank god for management, esp when the boss has ADD!


>
> - all projects suddenly become uninteresting and all motivation is lost at
> approx 65-85 percent completion


You mean its supposed to get to 100% completion. But then how would I keep
getting paid if the project can drag on for 3 years?


>
> - the code seems more important than the app (even though its not)


Code is always the most important


>
> - lots more but lost interest / focus
>
>
>
> regards :-)
>
> i so have more important things to do
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 

Bastien

Cat, the other other white meat


Re: [PHP] maybe we could all?

2009-01-19 Thread Bastien Koert
On Mon, Jan 19, 2009 at 9:35 PM, Nathan Rixham  wrote:

> Daniel Brown wrote:
>
>> On Mon, Jan 19, 2009 at 19:58, Edmund Hertle
>>  wrote:
>>
>>
>>> Well, I think we should not go to fast... maybe we are setting up SVN,
>>> webspace, domain, mailing-list and in the end this is only used by 4-5
>>> people. Because than this can be discussed on this mailinglist. But if
>>> there
>>> are quite enough people interested, it would be indeed a good idea to
>>> start
>>> some other kind of communication...
>>>
>>>
>>
>>I flat-out disagree with this, Ed.  Nothing at all against you, though.
>>
>>This is the General list for PHP, and while this project is
>> PHP-related (and "general" in nature), if we allow even the "regulars"
>> to do so here, how can we then tell others that we won't allow them to
>> discuss their PHP-related projects on this list?
>>
>>
> have to agree dan, not to mention the noise; people needing genuine helps
> posts getting missed etc..
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I'm in, sounds like fun and a great way to learn new stuff

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Client/Server Printing

2009-01-21 Thread Bastien Koert
On Tue, Jan 20, 2009 at 8:00 PM, Tony Marston  wrote:

>
> "Paul M Foster"  wrote in message
> news:20090120151606.gu18...@quillandmouse.com...
> > I'd like a side check on what I'm doing to print on our internal
> > network.
> >
> > We have an internal server/site which uses PHP code I've written to
> > "run" the business-- invoicing, A/P, inventory, etc. Some things, like
> > invoices and reports, need to be printed. Now remember, the code is on
> > the server, and we access it from our client machines on our desks. When
> > we print, we do so to our local printers, attached to the client
> > machines.
> >
> > So the best way I could think of to making printing work was to generate
> > PDFs of whatever needs to be printed, dump the PDF on the server, and
> > provide a link to the PDF on the web page. The user clicks on the
> > generated PDF, and his/her browser opens up Acrobat or xpdf, and prints
> > from that application to their local machine.
> >
> > Is that a reasonable way to implement this? Any better ideas?
>
> I have built an application similar to yours, and I have solved the
> printing
> problem by using software from the following two companies:
> http://www.nicelabel.com and http://www.namtuk.com/autoprintemail.aspx
>
> Basically the user runs a web page which generates the required report, in
> either XML or PDF format (I believe others are available) and sends an
> email
> which identifies a particular client printer. At the client end, with any
> number of PCs and printers, there is a piece of software running which
> looks
> for these emails, and when one is received it sends the print to the
> designated printer. Each report can be tailored to output to any printer,
> including a specific printer for each user. This means that the user does
> not see the generated report in his web browser and then have to press the
> PRINT key and choose the printer before it gets printed. He simply presses
> a
> "Generate Report" button, and within a few seconds it is sent to the
> printer.
>
> It's not free, but it's worth the money (IMHO).
>
> --
> Tony Marston
> http://www.tonymarston.net
> http://www.radicore.org
>
> > Paul
> >
> > --
> > Paul M. Foster
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I still like dompdf from
http://www.digitaljunkies.ca

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Java / PHP Bridge

2009-01-23 Thread Bastien Koert
On Fri, Jan 23, 2009 at 10:02 AM,  wrote:

>
> Zero real experience, but what I hear is that the Java / PHP bridges are a
> bit brittle and difficult to shore up properly...
>
> You may want to consider going with HTTP REST / RPC services instead, as
> those are quite solid, and you can get what you want.
>
> Note that this is all hearsay on my part.
>
> ymmv
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Is that hearsay or heresy?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] New PHP User with a simple question

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 9:25 AM, Paul M Foster wrote:

> On Mon, Jan 26, 2009 at 12:03:20AM -0600, Micah Gersten wrote:
>
> > Paul M Foster wrote:
> > > 
> > > In case this has yet to be answered to your satisfaction...
> > >
> > > Your page will *have* to reload when the user presses the button, but
> > > the majority of content can look the same, except for the content you
> > > want to change.
> > > 
> > >
> >
> > This is absolutely not true.   You can make the button call a PHP script
> > with AJAX and just update the textbox.
> > Check out:
> > http://xajaxproject.org
> >
>
> Please show me how *without Javascript* and *only with PHP* you can
> change the content on a page interactively as the user described
> *without* reloading the whole page. Xajax contains Javascript, which is
> how it manages this feat.
>
> For Pete's sake people, this is a *new* PHP user who wanted a *simple*
> solution to a relatively simple webpage problem. He's not looking for a
> Javascript solution, or a framework solution, or an OOP solution. He's
> not necessarily looking for a bulletproof, high security solution. He's
> a *new* PHP user. He just wants to figure out how to do this simple
> thing. Give him a *simple* answer. If you have to give him provisos
> about security, OOP, or Javascript afterward, fine.
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
The only real way then to avoid a page refresh with just PHP / HTML (for the
links) would be to use (i)frames and load the new content into the frame

-- 

Bastien

Cat, the other other white meat


Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 12:21 PM, Per Jessen  wrote:

> Phpster wrote:
>
> > Dunno if it's a best practice, but I store all the translations in the
> > db for easy manipulation and extraction to a file for others to
> > translate. That obviously involves both import and export utilities.
>
> Hi Bastien
>
> interesting - does this mean you're also coding for language-awareness
> yourself?  I mean, you must have your own gettext() functionality?
>
> > A number of pup apps take the approach of storing the label
> > translations in variables inside language folders ( phpmyadmin has
> > this ). That is also not a bad approach but is slightly slower and I
> > can't help but feeling that serving up a static page created by code
> > is a better solution.
>
> That's part of what we're thinking of doing, but it's difficult to
> separate the language and code completely.  Which is where gettext()
> comes in.
>
> Does anyone on this list use gettext() ?
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
No, as all of our users have to authorized to use the app, we store the
desired language in a field in the user record. However, we also supply
functionality via a drop down to allow the user to change the language if
desired.

I agree its difficult to separate the language and the code, but if you
create xslt / html files for each language then its a much simpler matter,
and far less resouce intensive, to direct the user to that page in their
desired language. Again, you and just use PHP and handle the labels and
option (drop downs, radios etc) variables in real time  but I never see the
point in doing the same thing over and over again when its much cleaner (if
more management intensive)  to direct the user to a static resource and pass
in an XML string with the data in it.

At work, we don't use gettext() since :
a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
b) the db current doesn't support multi-byte charsets

My personal projects (or work on the side) are, of course, all php but so
far there has been no requirements for multi language support, though the
two projects that I am starting will both require it. Not sure if I will use
gettext(), I will research some more, but it will definitely support
multi-language and the db is unicode.


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Kinda 0.T... php site and maintenance

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 12:39 PM, Nitsan Bin-Nun  wrote:

> I have just quitted from my partial time job at the company.
> I did some personally sites like that for 2 banks here in Israel.
>
> When I do something like that I usually basing the whole thing on the known
> blogging platform WordPress, it has a massive power inside of it, the
> templating system is very easy and gives you the ability to dress it up
> without any extra knowledge except common sense and a bit of php knowledge,
> It supports creating galleries (using plugins, etc) and gives you the
> functionally you usually need when you write a personall website - free
> access to creating static pages, using wordpress integrated WYSIWYG editor,
> creating "updates" using the blog posts, etc.
>
> I found it very useful so far (I used this platform in 15 websites~) and I
> think you will find it more than great for your client's job.
>
> HTH,
> Nitsan
>
> On Mon, Jan 26, 2009 at 7:09 PM, Ryan S  wrote:
>
> > Hey,
> >
> > Got a question for you guys who make a lot of personal sites.
> >
> > I got a US client who wants me to make a personal site, 4-7 "sections"
> (eg:
> > about me, photos, whats new etc)
> > and have to put a yearly maintenance $$ amount...
> >
> > I thought i'll make most of the stuff using php rather than plain html so
> > the client can update different sections without me (eg: whats new, add
> > pics)
> >
> > What do you guys charge for something like this (dont count hosting and
> > domain fees)
> >
> > Thanks!
> > R
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

I usually charge around $75 / hr. Though I have a client with a larger app
that pays me about $1K / yr for all the continuing work on it.

But in this case, I think Nitsan is probably correct, in that you should
just use a preset template or blog software and change $250 flat for
it...the first few you might lose money on (if considered in a per hour
basis) but as you get faster and more familiar with it, you can get that
going more quickly.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Kinda 0.T... php site and maintenance

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 4:24 PM, Ryan S  wrote:

> Hey,
> Thanks everyone for replying, I really appreciate your input.
>
> One thing you forgot to mention, how much would it be for "maintenance" per
> year?
> Feel free to add anything you think you might have forgotten in your first
> emails to me.
>
>
> @ Nitsan, "I did some personally sites like that for 2 banks here in
> Israel."
>
> Israel!! Stay safe bro and god bless, you have some real crazies
> surrounding your country.
>
>
> @Michael Kubler,
> Not a problem, I like long replies.. by their very nature most of them are
> more detailed ;)
>
> Cheers!
> R
>
>
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
>
>
> - Original Message 
> From: Nitsan Bin-Nun 
> To: Ryan S 
> Cc: php php 
> Sent: Monday, January 26, 2009 6:39:19 PM
> Subject: Re: [PHP] Kinda 0.T... php site and maintenance
>
> I have just quitted from my partial time job at the company.
> I did some personally sites like that for 2 banks here in Israel.
>
> When I do something like that I usually basing the whole thing on the known
> blogging platform WordPress, it has a massive power inside of it, the
> templating system is very easy and gives you the ability to dress it up
> without any extra knowledge except common sense and a bit of php knowledge,
> It supports creating galleries (using plugins, etc) and gives you the
> functionally you usually need when you write a personall website - free
> access to creating static pages, using wordpress integrated WYSIWYG editor,
> creating "updates" using the blog posts, etc.
>
> I found it very useful so far (I used this platform in 15 websites~) and I
> think you will find it more than great for your client's job.
>
> HTH,
> Nitsan
>
> On Mon, Jan 26, 2009 at 7:09 PM, Ryan S  wrote:
>
> > Hey,
> >
> > Got a question for you guys who make a lot of personal sites.
> >
> > I got a US client who wants me to make a personal site, 4-7 "sections"
> (eg:
> > about me, photos, whats new etc)
> > and have to put a yearly maintenance $$ amount...
> >
> > I thought i'll make most of the stuff using php rather than plain html so
> > the client can update different sections without me (eg: whats new, add
> > pics)
> >
> > What do you guys charge for something like this (dont count hosting and
> > domain fees)
> >
> > Thanks!
> > R
> >
> >
> >
> >
> >
> > --
> > 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
>
>
You need to charge what you think is fair to support the application. If the
calls are few and far between and more related to new dev work, then maybe
$10/mth is fair...judge by how many support requests there are knowing that
in the first few months after launch there will be more than after 1 year


-- 

Bastien

Cat, the other other white meat


Re: [PHP] New to PHP question

2009-01-28 Thread Bastien Koert
On Wed, Jan 28, 2009 at 2:58 PM, Don Collier wrote:

>
>
> Paul M Foster wrote:
>
>> On Wed, Jan 28, 2009 at 12:05:34PM -0700, Don Collier wrote:
>>
>>
>>
>>> I am just learning PHP from the O'Reilly "Learning PHP 5" book and I
>>> have a question regarding the formatting of text.  Actually it is a
>>> couple of questions.
>>>
>>> First, when I use the \n and run the script from the command line it
>>> works great.  When I run the same code in a browser it does not put the
>>> newline in and the text runs together.  I know that I can use  to
>>> do the same thing, but why is it this way?
>>>
>>>
>>
>> Browser don't break lines on the \n character. They only break on 
>> or  tags. That's just the way it is. You can use the PHP function
>> nl2br() to insert  tags where the \n characters are.
>>
>>
>>
>>> The second question is closely related to the first.  When formatting
>>> text using printf the padding works great when running from the command
>>> line but not at all when in a browser.
>>>
>>>
>>
>> Browsers don't respect multiple spaces, etc., except in between certain
>> tags, like . Instead, they combine multiple spaces into a
>> single space and break lines where they like, based on layout. You can
>> use the HTML   character if you don't want lines or phrases to
>> break at the whim of the browser. If you want exact layout (columns
>> lined up, etc.), the simplest solution is to use HTML tables.
>>
>> Paul
>>
>>
>>
> Thanks to everyone that responded.
> From what I am seeing in the responses if I plan on using php for command
> line scripts things get written one way.  If, on the other hand, the php is
> written for a web page it gets written a slightly different way inserting
> html where necessary for formatting.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Not quite true in a properly layered application. Separating the data from
the display (whatever that is) is prime idea behind the MVC (Model View
Controller) design pattern. This way your code that runs via the CLI
(command line) can produce the same data as the code that gets the data for
the HTML. The only difference is what you plan to do with that data. You
could feed it to a controller and let the controller feed it to a View to
render in a browser, or send it to a FileOutput class to create a file of
the data for comsumption by another resource.


-- 

Bastien

Cat, the other other white meat


Re: [PHP] New to PHP question

2009-01-28 Thread Bastien Koert
On Wed, Jan 28, 2009 at 3:28 PM, Paul M Foster wrote:

> On Wed, Jan 28, 2009 at 03:06:36PM -0500, Bastien Koert wrote:
>
> > On Wed, Jan 28, 2009 at 2:58 PM, Don Collier  >wrote:
> >
> > >
> > >> On Wed, Jan 28, 2009 at 12:05:34PM -0700, Don Collier wrote:
> > >>
> > >>
> > >>
> > >>> I am just learning PHP from the O'Reilly "Learning PHP 5" book and I
> > >>> have a question regarding the formatting of text.  Actually it is a
> > >>> couple of questions.
> > >>>
> > >>> First, when I use the \n and run the script from the command line it
> > >>> works great.  When I run the same code in a browser it does not put
> the
> > >>> newline in and the text runs together.  I know that I can use 
> to
> > >>> do the same thing, but why is it this way?
> > >>>
>
> 
>
> > >>
> > >>
> > > Thanks to everyone that responded.
> > > From what I am seeing in the responses if I plan on using php for
> command
> > > line scripts things get written one way.  If, on the other hand, the
> php is
> > > written for a web page it gets written a slightly different way
> inserting
> > > html where necessary for formatting.
> > >
>
> 
>
> > >
> > Not quite true in a properly layered application. Separating the data
> from
> > the display (whatever that is) is prime idea behind the MVC (Model View
> > Controller) design pattern. This way your code that runs via the CLI
> > (command line) can produce the same data as the code that gets the data
> for
> > the HTML. The only difference is what you plan to do with that data. You
> > could feed it to a controller and let the controller feed it to a View to
> > render in a browser, or send it to a FileOutput class to create a file of
> > the data for comsumption by another resource.
>
> See? This is what I'm talking about.
>
> *I* understand what you're saying, Don, and I agree. But this guy is
> just learning PHP from what is arguably not one of the best books on PHP
> (IMO). And you're throwing MVC at him. Let him master the subtleties of
> the language first, then we'll give him the MVC speech.
>
> Yes, I know, they should learn proper programming practices from the
> beginning, blah blah blah. But think back to the first programming
> language you ever learned, when you were first learning it. If someone
> had thrown stuff like this at you, would you have had a clue? I had
> enough trouble just learning the proper syntax and library routines for
> Dartmouth BASIC and Pascal, without having to deal with a lot of
> "metaprogramming" stuff.
>
> This is the problem when you get newbies asking questions on a list
> whose membership includes hardcore gurus. The gurus look at things in
> such a lofty way that answering simple questions at the level of a
> beginner sounds like a dissertation on the subtleties of Spanish art in
> the 1500s.
>
> Just my opinion.
>
> Paul
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Paul,

You make a valid point, but I suggest that once you get beyonds the basics
of programming (loops, if then else, do while etc) and granted that I do not
know where the OP sits in this area, it would have saved me many hours of
frustration, having to unlearn what I know and force feed myself a new
paradigm.

To me its kind of 6 of one and half a dozen of the other...but the
requirement is having that basic programming knowledge that gives a solid
foundation to any language.

My 2 cents...

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Database Tables Relation Issue

2009-01-30 Thread Bastien Koert
On Fri, Jan 30, 2009 at 8:37 AM, Andrew Ballard  wrote:

> On Fri, Jan 30, 2009 at 3:38 AM, Nitsan Bin-Nun 
> wrote:
> > Hi there,
> >
> > I'm working on something similar to mailing list in which every
> registered
> > user has the ability to create a mailing list and join others mailing
> lists.
> >
> > My users table is something like that (in short):
> >
> > CREATE TABLE IF NOT EXISTS `users` (
> >`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
> >`email` VARCHAR( 255 ) NOT NULL,
> >`password` CHAR( 64 ) NOT NULL,
> >UNIQUE (`email`)
> > );
> >
> > And my mailinglists table is as following:
> > CREATE TABLE IF NOT EXISTS `lists` (
> >`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
> >`creator_id` INT( 11 ) UNSIGNED NOT NULL,
> >`name` VARCHAR( 255 ) NOT NULL,
> >`description` TEXT NOT NULL
> > );
> >
> > I must have relation between the users table and the lists table, but I'm
> > not sure what is the best way to implement it.
> >
> > I have thought of using comma-separated ID's in special field in the
> lists
> > table of the users who have joined that specific list, but I have also
> > thought of doing the same at the users table, then I had another solution
> > which is to create new table:
> >
> > create table `relations` (
> >  `listid` int(11),
> >  `userid` int (11)
> > );
> >
> > Which will contain the relations.
> >
> > I want it to be optimised so when I'm fetching the mailinglists that a
> > specific user is registered (by user id) to and when I'm fetching the
> users
> > in specific mailinglist (by mailinglist id) it will be the fastest.
> >
> > The question itself is kinda newbie but I have to make sure it is as
> > scalable as much because in few weeks it will have 10-20 unique
> visitors/DAY
> > ;)
> >
> > --
> > ?>
> > Nitsan Bin-Nun
> > Web Applications Developer
> > nit...@binnun.co.il
> > 972-52-5722039
> >
>
> I will second the other replies and say use the relation table. I
> would only add that your relation table definition should include a
> two-column primary key on both listid and userid, as this will ensure
> that each user can be subscribed to a list no more than one time.
>
> CREATE TABLE `relations` (
>`listid` int(11) UNSIGNED NOT NULL,
>`userid` int(11) UNSIGNED NOT NULL,
>PRIMARY KEY `PK_relations` ( `listid`, `userid`)
> );
>
>
> Another nice thing about this relations table is that you can later
> expand it to include other things, such as defining the relationship
> of a user to a list (moderator, administrator, subscriber, etc.) if
> that becomes necessary.
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Third table is the way to go. From a performance perspective, with a packed
field (values delimited in some way) you would likely be doing a LEFT LIKE
or FULL LIKE (%value or %value%) statement which causes full tables scans
since the index can't be used. That is much slower than querying a simple
table with single values where the index can be used.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] frameworks

2009-01-30 Thread Bastien Koert
On Fri, Jan 30, 2009 at 1:15 PM, Frank Stanovcak
wrote:

> Ok.  I've done some reading on frameworks for PHP now, and have this
> question.
>
> What are some good resources for learning about the various frameworks
> available, and do you recomend one over another?  If so why?
>
> I started using PHP before frameworks came into the picture, and then had
> to
> take my leave for a while.  I'm sure this information will also help others
> out there who are just learning the ropes as well.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Each of the frameworks has a site, which is the best place to learn about
them...

As for recommendations, it depends on what you are looking for

Flexibility - Zend  - you can use the pieces without needing the whole kit
and kaboodle

Speed - CodeIgniter seems to be the winner for now

Completeness - symfony has a full ORM layer

Mix of the above - cakephp

Each comes with its own learning curve from easy to steep... downloaded
several and play with them to work out what fits your needs


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-30 Thread Bastien Koert
On Fri, Jan 30, 2009 at 2:18 PM, Carlos Medina wrote:

> Nitsan Bin-Nun schrieb:
>
>> I was just wondering whether people enclosing their PHP tags declarations,
>> I don't close these > needs them,
>> and for the second reason - if a space/tab/new line/etc will beneath them
>> it
>> will cause
>> problems with output buffering and session handling.
>>
>> Do you close your PHP >
>> (at least I closed them here :P look down)
>>
> No,
> is not needed
>
> Regards
>
> Carlos
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> I usually do, only because I grew up using ASP with requires it...just
another bad habit


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Payment question in Canada

2009-01-30 Thread Bastien Koert
On Fri, Jan 30, 2009 at 2:11 PM, Ernie Kemp  wrote:

>   My question is one of pay; hope this is the correct forum.
>
>
>
> A couple of people have asked me to write some PHP code for their website
> backend.
>
>
>
> I need the money from this but I don't know what to charge them.  I think
> in total the work will be about 8-10 hours.
>
>
>
> Please indicate what hourly fee I should charge them as don't wish to
> overcharge them nor under value my services.
>
>
>
> If I have the wrong list, let me know which list to go to.
>
>
>
> Thanks in advance,
>
>
>
>
>
> Thanks,
>
> Ernie
>
>
>
>
>
> ...man will occasionally stumble over the truth, but usually manages to
> pick himself up, walk over or around it, and carry on.
>
>
>   Winston S. Churchill* *
>
>
>
>
>
>
>
>
>
I charge anywhere from $50-$75/hr depending on the project and exactly what
the client wants


-- 

Bastien

Cat, the other other white meat


Re: [PHP] why does a html mail send as text ?

2009-02-04 Thread Bastien Koert
2009/2/4 Bulend Kolay 

> I attached my code
> Thanks
>
>
>
>
>  Show your code, but it sounds like maybe the HTML flag is not set.
>>  Consider using a class like phpmailer or the mime mail class from
>> phpclasses.org
>>
>> Bastien
>>
>> Sent from my iPod
>>
>> On Feb 4, 2009, at 6:28, "Bulend Kolay"  wrote:
>>
>>  I use php-5.2.6 and apache2.2.x on opensuse11
>>>
>>> I have a file called mailsend.php to send a mail of html format.
>>> the server sends the mail form of html format. But I get it as text
>>>  instead of html.
>>> default_mimetype is set as text/html in php.ini file.
>>>
>>> How can I correct this ?
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>
>>
Looking the code quickly, the only thing I do differently is setting the
headers:

  //build the headers
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "From: \"Site Admin \n";


What mail client are you using? Does it / is it set to accept html mails?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Mutiple SQL request

2009-02-04 Thread Bastien Koert
On Wed, Feb 4, 2009 at 9:43 AM, Jônatas Zechim  wrote:

> Hi there, i've a system that do a query each 3s, does it impact on mysql
> Server?
> I mean, can this slow my Server?
>
> zechim
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It impacts system recources if this same query is run constantly for each
user. Example: if this runs a logon and you have 100 or 1000 users logging
on at roughly the same time, then you will have contention for the
resources.

Can you check your indeces and run explain plans on the queries to see if
any of them can be optimised to run quicker?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Mutiple SQL request

2009-02-04 Thread Bastien Koert
On Wed, Feb 4, 2009 at 10:54 AM, Jônatas Zechim wrote:

>  For example i've this query:
>
>
>
> *SELECT admin_nome FROM ctalk_admin WHERE admin_lastping <= '1233762658'
> AND admin_lastping >= '1233762608' AND admin_id='1'*
>
>
>
> I ran explain, the result for extra is 'Impossible WHERE noticed after
> reading const table...'
>
> How can i optimize this query?
>
> Is there some tutorial on the net?
>
>
>
> Thanks,
>
> Zechim
>
>
>
> *De:* Bastien Koert [mailto:phps...@gmail.com]
> *Enviada em:* quarta-feira, 4 de fevereiro de 2009 12:46
> *Para:* Jônatas Zechim
> *Cc:* php-general@lists.php.net
> *Assunto:* Re: [PHP] Mutiple SQL request
>
>
>
>
>
> On Wed, Feb 4, 2009 at 9:43 AM, Jônatas Zechim 
> wrote:
>
> Hi there, i've a system that do a query each 3s, does it impact on mysql
> Server?
> I mean, can this slow my Server?
>
> zechim
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> It impacts system recources if this same query is run constantly for each
> user. Example: if this runs a logon and you have 100 or 1000 users logging
> on at roughly the same time, then you will have contention for the
> resources.
>
> Can you check your indeces and run explain plans on the queries to see if
> any of them can be optimised to run quicker?
>
> --
>
> Bastien
>
> Cat, the other other white meat
>

Can you dump the table structure to show us how you've set it up?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] is this use of subquery "smart"

2009-02-04 Thread Bastien Koert
On Wed, Feb 4, 2009 at 4:33 PM, Chris  wrote:

>
>
>  Solution 2:
>> SELECT r.reg_id, r.date_registered, r.old_record, if(r.ghost_record!=0,
>> (SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people,
>> registrants WHERE people.instance_id=12 and
>> people.person_id=registrants.person_id AND
>> registrants.reg_id=r.ghost_record), 'y') as registered_by_name
>> FROM registrants r
>> WHERE r.org_id=12
>> AND r.reg_status=0
>> AND r.reg_id=r.person_id
>>
>> this way subquery will be executed "everytime", but I have everything on
>> one place?
>>
>
> Because it has to evaluate the whole 'if' statement (including your
> subquery) for each row in the result set.
>
> Best place to ask would be on the mysql mailing list:
>
> http://lists.mysql.com/
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
try a case when then statement.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Garbage Collection

2009-02-05 Thread Bastien Koert
On Thu, Feb 5, 2009 at 11:10 AM, Eric Butera  wrote:

> On Thu, Feb 5, 2009 at 11:06 AM, tedd  wrote:
> > Hi gang:
> >
> > A related question to my last "Clarity needed" post.
> >
> > I have a tutor table (showing all the tutors), a course table (showing
> all
> > the courses), and a course-to-tutor table (showing all the instances of
> what
> > tutor teaches what course).
> >
> > Okay, everything works. Whenever I want to find out what courses a
> specific
> > tutor teaches OR what tutors teach a specific course, I simply search the
> > course-to-tutor table and bingo out pops the answer.
> >
> > Now, how do you handle the situation when a tutor quits or when a course
> is
> > no longer offered?
> >
> > If I search the course-to-tutor table for all the tutors who teach a
> course
> > and find a tutor who is no longer there OR search the course-to-tutor
> table
> > for all the courses a tutor teaches and find a course that is no longer
> > offered, how do you handle the record?
> >
> > I realize that if either search turns up nothing, I can check for that
> > situation and then handle it accordingly. But my question is more
> > specifically, in the event of a tutor quilting OR removing a course from
> the
> > curriculum, what do you do about the course-to-tutor orphaned record?
> >
> > As I see it, my choices are to a) ignore the orphaned record or b) delete
> > the orphaned record. If I ignore the record, then the database grows with
> > orphaned records and searches are slowed. If I delete the orphaned
> record,
> > then the problem is solved, right?
> >
> > I just want to get a consensus of how you people normally handle it. Do
> any
> > of you see in danger in deleting an orphaned record?
> >
> > 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
> >
> >
>
> Could add a status flag to the records to indicate if they're active
> or not.  Or you could use InnoDB and have it cascade delete join
> records.  Status is nice though in case they come back or to provide
> an undelete type functionality.
>
> --
> http://www.voom.me | EFnet: #voom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
this gets my vote

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Clarity needed

2009-02-06 Thread Bastien Koert
On Fri, Feb 6, 2009 at 1:35 PM, Jochem Maas  wrote:

> ***RANT WARNING***
>
> Shawn McKenzie schreef:
> > Jochem Maas wrote:
> >> Daniel Brown schreef:
> >>> On Thu, Feb 5, 2009 at 07:56, Jochem Maas 
> wrote:
>  and the answer to you Q, like everyone else said: yup :-)
> 
>  PS - given you unlimited resources you might consider doing a
>  charitable donation to FoxNews aficionados :-)
> >>> Or reminding you how to speak English, Jochem.  What the hell are
> >>> you trying to say here?!? ;-P
> >> that tedd's unlimited educational resources (tutors/courses) might
> >> go someway to undoing all the harm Fox News inflicts on the masses.
> >>
> >>> Man, a guy disappears for a while and his speech goes to gibberish
> >>> almost as bad as my own.  ;-P
> >> almost :-P
> >>
> >>
> > Or fox may go someway towards dulling the socialist propaganda of the
> > tutors/courses.
>
> I didn't assume any particular leaning on the part of the education
> resource
> in question ... merely that to count as education I would require ciriculum
> to foster peoples ability to question/analyse/research for *themselves*,
> but heck, why bother when Bill O'Reilly can do it for you right?
>
> > We're headed there, but thank God I'm not schreefing
> > from an insanely socialist country!  :-)
>
> ir dismissive to call something insane just because you either
> don't understand it or don't agree with it.
>
> not to mention that my country 'boasts' a rather wide spectrum
> political viewpoints, many of which are hardly socialist.
>
> ... and it certainly wasn't socialists that shipped countless
> slaves from Africa to America ... but the culprits we're often
> dutch.
>
> oh and here's a bit of Socialist Doctrine:
> "We hold these truths to be self-evident, that all men are created equal
> ..."
>
> not that I'm much of a socialist, mainly because i think all politics
> is inherently bogus - just a bigpile of strawmen, but wait ...
> capitalism ... that's working out a treat isn't it (in a "gonna
> make the 'Great Depression' look like a day in park" kind of way).
>
> with regard to capitalism, were do you think the staple concepts and
> structures came from? 13th century europe, specifically the 'lowlands',
> not to mention the AEX (now Euronext), which is generally considered to be
> the oldest formal stock exchange.
>
> ... so stick that in your pipe and smoke it ... oh wait you can't,
> which is why there's a constant stream of planes touching down here,
> full of yanks gagging to get shitfaced.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
WOW! Jochem, you need to relax just a little bit and bring down that blood
pressure...

And the dutch were hardly the only ones in there..

Greets from Canada

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Simple Search Logic Issue...

2009-02-16 Thread Bastien Koert
[snip]
>
>
>
> For example LIKE 'c' will only match a field that contains just 'c'
>
> LIKE '%c' will match a field starting with 'c' and containing any number of
> characters
>
> [/snip]
> Cheers
> --
> David Robley
>
> Make like a banana and split.
> Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
hate to do this at a late date, but %c will match anything ending in
'c'...'c%' will match anything starting in 'c'

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: webapp to drive/monitor a bunch of system processes

2009-02-16 Thread Bastien Koert
On Wed, Feb 11, 2009 at 11:44 AM, Shawn McKenzie wrote:

> bruce wrote:
> > hi...
> >
> > i've got a project (goal) where i'm looking for a webbased app that
> > drives/runs/monitors different linux/system processes. i'm basically
> looking
> > for different apps that i can look at to get ideas/see their
> > layout/structure. i'm going to have to create a similar app to run some
> > processes that i'm dealing with.
> >
> > i'm currently looking/searchin sourceforge.net/freshmeat/etc.. but i
> thought
> > i'd fire off the question here as well, in case someone has an app that
> > they're aware of that you can pass on to me..
> >
> > my overall/ultimate goal is going to be to interface with underlying
> > database/tbls, to drive processes on a distributed network of machines
> that
> > i'm putting together... so i'm going to need to be able to to
> > monitor/start/stop a number of different apps that i create. i'm also
> > looking to be able to see past history of the apps that have been run
> using
> > the webapp...
> >
> > but for now, any app that i can find that allows a user to
> manage/start/stop
> > different processes on a server/network would be useful.. (already looked
> at
> > nagios!)
> >
> > thanks!!
> >
> >
> >
> Have you looked at webmin?  I haven't used it in a while but it ties in
> a lot of monitoring/control/config of the machine and I assume you could
> easily develop plugins for it.
>
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
what about xenoss? http://www.zenoss.com/

-- 

Bastien

Cat, the other other white meat


Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Bastien Koert
On Tue, Feb 17, 2009 at 7:28 AM, Richard Heyes  wrote:

> > Cats are the other white meat. Sorry have flu, may be delirious
>
> You haven't been around any birds recently have you?
>
> --
> (A concerned) Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.org (Updated February 14th)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Never met a pussy I didn't like :-P

-- 

Bastien

Cat, the other other white meat


Re: [PHP] function array problem

2009-02-17 Thread Bastien Koert
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
wrote:

> I've had a bit of a problem with a function I'm using for a form.
> Essentially, the function looks like this:
>
> function addEvent($values = Array('name' => '', 'venue' => '',
> 'description' => '', 'errors' => Array()))
> {
>// code here displays the form
> }
>
> The function is used to both display an empty form, and the form
> populated with values again should there be any validation errors.
>
> Now this works fine when the form has been filled out and there are
> errors present, as I can call the function with the correct array
> values. However, when I call the function with no arguments (intending
> the function to populate the $values array itself) all it does is
> present me with an empty array. A print_r($values) just returns
> Array( ), no key values defined.
>
> I altered the function to this:
>
> function addEvent($values = Array())
> {
>if(count($values) == 0)
>{
>$values = Array('name' => '', 'venue' => '', 'description' =>
> '', 'errors' => Array());
>}
>// code here displays the form
> }
>
> then all works as intended. Question is, am I being dense, or is there a
> reason why this shouldn't work?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

i tend to do

function addEvent($values='')
{
  if (!is_array($values))
 {
   $values = Array('name' => '', 'venue' => '', 'description' =>'',
'errors' => Array());
 }
  //rest of the code

}



-- 

Bastien

Cat, the other other white meat


Re: [PHP] escape your variables

2009-02-18 Thread Bastien Koert
On Wed, Feb 18, 2009 at 8:34 AM, PJ  wrote:

> To focus on mysql_real_escape_string, I am recapping... questions below
> QUOTE:==
> Instead of doing this (for an imaginary table):
> $sql = "insert into table1(field1, field2) values ('$value1', '$value2')";
>
> do
> $sql = "insert into table1(field1, field2) values ('" .
> mysql_real_escape_string($value1) . "', '" .
> mysql_real_escape_string($value2) . "')";
>
> Now $value1 and $value2 can only be used as data, they can't be used
> against you.
>
> If you don't do that, try adding a last name of O'Reilly - your code
> will break because of the ' in the name.
>
> When you say "escape all your inputs" - just what do you mean? Does that
> mean I need some special routines that have to be repeated over and over
> every time there is an input... but what do you mean by an "input"? And,
> from looking at all the comments in the manual, it's not clear just
> where to stop...
>
> "input" means anything a user gives you. Whether it's a first name, last
> name, a comment in a blog, a website url - anything you get from a user
> must be escaped.
> END QUOTE ===
>
> So, I am more confused than ever...
>
> TWO QUESTIONS:
>
> 1.  It seems to me that submitting username, password and database_name
> is pretty dangerous.
> How does one deal with that? Do you use mysql_real_escape_string?
> e.g.
>  $db_host = 'localhost';
> $db_user = 'root';
> $db_pwd = 'gu...@#$';
>
> $database = 'join_tutorial';
> $table = 'authorBook';
>
> if (!mysql_connect($db_host, $db_user, $db_pwd))
>die("Can't connect to database");
>
> if (!mysql_select_db($database))
>die("Can't select database");
>
> // sending query
> $result = mysql_query("SELECT * FROM {$table}");


Inputs are user supplied. Variables coming from inside the application code
are not really inputs. I prefer a two step approach to ensure that I am
(hopefully) free from potential problems.

1. Use filtering like regex and length checks [
http://ca2.php.net/manual/en/function.ereg.php]
2. Use mysql_real_escape_string in the query whereever the data is
potentially harmful.




>
>
> 2. How do you use mysql_real_escape_string on a string entered in a form
> page with input and $_POST where the inputs are strings like $titleIN,
> $authorINetc.?
>




>
> --
>
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Full versus relative URLs

2009-02-18 Thread Bastien Koert
On Wed, Feb 18, 2009 at 12:05 PM, PJ  wrote:

> Stuart wrote:
> > 2009/2/18 PJ :
> >
> >> Stuart wrote:
> >>
> > 
> >
> >> This generates a Fatal error: Cal to undefined function dirname() 
> 
> >>
> >
> > The dirname function is present in both PHP 4 and 5 and does not rely
> > on any external libraries. Are you sure you're spelling it right?
> >
> > http://php.net/dirname
> >
> >
> >> I must be really dense...
> >> What I don't understand in the above is this - dirname refers to what
> >> directory? -- the directory of the file that is including? what if the
> >> directory is the root directory of the site?
> >>
> >> (_FILE_) = what? - (_filename.ext_) or (filename.ext) --- what file is
> >> this, the file which is including the file header.php?
> >>
> >
> > The __FILE__ (note 2 _'s either side) constant is the full path and
> > filename to the current script. The dirname function knocks the
> > filename off it to give you the directory the current script is in.
> > You can then append a / and then the relative path to the script you
> > want to include. By doing this you're ensuring that all includes are
> > relative to the current script and are not affected by ini settings or
> > anything else.
> >
> >
> >> and what does the . mean and then "/../header.php" --- I don't
> >> understand what to enter here
> >>
> >
> > The . is the string append operator. I tend to assume the most basic
> > level of PHP knowledge from users of this list and I include the
> > string append operator in that set. You might want to find a beginners
> > tutorial for PHP and work through that to give you a solid foundation
> > before attempting to work with multiple scripts.
> >
> > -Stuart
> >
> >
> What confused me here is that often, in examples, there are all sorts of
> references to files and there seems to be no standard as to how to refer
> to them in non-scripts such as these e-mails. So, I thought that
> dirname(_FILE_) was a general reference to a directory name and a
> file... :-(
> I don't want to defend myself here, but I cannot be expected to know all
> functions and look up anything that might resemble a function...
> I still do not understand, and that is the keyword here, I am trying to
> understand things - what does /../header.php mean. I know the 2 dots
> mean a higher directory in Unix... but I understood that ../ would mean
> the root directory - so what is the / before the ../header.php mean?
> When including scripts or pages, i find that if I am referencing to the
> current directory, just the filename or /filename works. If the
> reference is up a level, ../ works
>
> e.g. to reference root/images/ from root/authors = ../images/file.ext
> from root = /images/file.ext or images/file.ext
>
> I haven't needed to go to a deeper level yet.
>
> --
>
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

../../ means go up two directories from the current working directory that
your file is in
-- 

Bastien

Cat, the other other white meat


Re: [PHP] Two troublesome fields

2009-02-19 Thread Bastien Koert
On Thu, Feb 19, 2009 at 3:21 PM, Terion Miller wrote:

> Hi all, I seem to be having a problem with getting two fields to insert
> into
> a table, the other fields insert but not these two
> its from a form that is a duplicate, basically I have a workorder that I
> want to make a copy of, I call it from the db, populate a form in case
> changes want to be made, and insert with a new unique ID as a new record,
> it's working great except Two fields will NOT insert and I'm at a loss for
> why ...
> the code is big so I will post snippets that I think may be the trouble
> spots
>
> Here is the insert:
>$sql = "INSERT INTO workorders (CreatedDate, Location, WorkOrderName,
> AdminID, FormName, Status, Notes) VALUES (";
>$sql .= "Now(), '$Location', '$WorkOrderName', '$AdminID', 'WorkOrder',
> 'New Order', '$Notes')";
>mysql_query($sql);
>$WorkOrderID = mysql_insert_id();
>
> Here is the part where it calls the old values:
>
>$sql2 = "SELECT Location, WorkOrderName FROM workorders WHERE
> WorkOrderID='$WorkOrderID'";
>$result2 = mysql_query ($sql2);
>$row2 = mysql_fetch_array($result2);
>
>
> Here is the form part:
>
>
> class="CaptionReq">Property:
> name="Location" value=""> $row2['Location']; ?> 
>
>
>Work
> Order Name: 
> name="WorkOrderName" size="35 " value=" ?>"/>
>
>
> I need some clues, everything works except the two fields Location, and
> WorkOrderName.
>
> Thanks
> Terion
>
> Happy Freecycling
> Free the List !!
> www.freecycle.org
> Over Moderation of Freecycle List Prevents Post Timeliness.
> 
> Twitter?
> http://twitter.com/terionmiller
> 
> Facebook:
> http://www.facebook.com/people/Terion-Miller/1542024891";
> title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
> alt="Terion Miller's Facebook profile">
> Bill Watterson  - "There is not enough time to do all the nothing we want
> to
> do."
>

Why not try a

insert into table select fields from table where id = $id

-- 

Bastien

Cat, the other other white meat


[PHP] mobile texting app question

2009-02-20 Thread Bastien Koert
All,

I am working on the design for an app that uses mobile phone texting to make
payments, but I am having some trouble finding out how the whole mobile
process works. I grow the CSC (common short code) set up and them acting as
a clearing house, but can anyone point me to some docs on how the process
works. From the user attempting to text a payment to my site getting the
data?

Its kinda off topic, other than the entire site / app will be php based.
Googling doesn't get me that far, but it might be more of a not knowing
exactly what its called to be able to narrow the search.

Appreciate any replies.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: how to deal with multiple authors for one book

2009-02-24 Thread Bastien Koert
On Tue, Feb 24, 2009 at 8:59 AM, PJ  wrote:

> Reinhardt Christiansen wrote:
> >
> >
> >
> >> From: PJ 
> >> To: MySql 
> >> Subject: how to deal with multiple authors for one book
> >> Date: Mon, 16 Feb 2009 17:20:54 -0500
> >>
> >> In my db there are a number of books with several authors; so, I am
> >> wondering how to set up a table on books and authors to be able to
> >> insert (via php-mysql pages) data and retrieve and display these books
> >> with several authors
> >> I suspect that to insert data for a multiple author book I will have to
> >> enter all data other than the author names into the book table and enter
> >> the authors in the author tables with foreign keys to reference the
> >> authors and their book.
> >> Then to retrieve and display the book,I would have to use some kind of
> >> join instruction with a where clause(regarding the position - 1st, 2nd,
> >> 3rd...) to retrieve the authors and their order. The order would
> >> probably be done by a third field (e.g. f_name, l_name, position) in the
> >> book_author table (tables in db -  book, author, and book_author)
> >> Am I on the right track, here?
> >>
> > Sort of, but not completely.
> >
> > I think you would really benefit from a tutorial or course on data
> > normalization. I haven't looked for one in several years so I can't
> > suggest a specific tutorial but if you google it, you may well find
> > something that you like.
> >
> > In a nutshell, you are trying to implement a many-to-many relationship
> > (a book can have several authors and an author can have several
> > books). These are not normally implemented directly in relational
> > databases. Instead, you typically have intermediate tables that are
> > usually called "association tables" (or "intersection tables") that
> > sit between the other tables. In your case, you might see something
> > like this:
> >
> > Book Table
> > ===
> > Book_codeTitle
> > --- --
> > Z1 The Mote In God's Eye
> > Z2  Ringworld
> > Z3  Janissaries
> > Z4  War and Peace
> >
> >
> > Author Table
> > 
> > Author_code   Author_name
> > --   --
> > 1   Larry Niven
> > 2  Jerry Pournelle
> > 87Leo Tolstoy
> >
> > Books Table (intersection table)
> > ===
> > Book_code Author_code
> > --- --
> > Z11
> > Z12
> > Z21
> > Z32
> > Z487
> >
> > In other words, the Books table identifies that The Mote in God's Eye
> > is written by Niven _and_ Pournelle; Ringworld is written by Niven
> > alone and Janissaries is written by Pournelle alone. And, of course,
> > War and Peace is written by Tolstoy.
> >
> > You're going to want to do something very much like this.
> >
> > A good tutorial will explain this well. I'm out of time; I have to go
> > now.
> >
> > --
> > Rhino
> >
> >
> >
> Thank you for your clear explanation.
> I have things set up rather well and have been able to generate a web
> page to insert most of the data in the db and retrieve it to display in
> another web page.
> I say most because I have several "small" problems which I have posted
> on mysql and php lists. Perhaps you can suggest something either where
> and how to post or what to do.
>
> Problem 1. How to SELECT and display multiple authors. Presently, my
> book_author(intersection table contains fields authID, bookID and
> ordinal. ordinal refers to the order of the author's name (1 if only 1
> or first in line; 2 if 2nd in line). To retrieve the author's name I use
> CONCAT_WS(' ', first_name, last_name) AS Author. So far, in my testing I
> only have 10 books in the db with only single authors. Undoubtedly this
> is not the way to go to retrieve 2 authors and display them as
> (first_name1 last_name1 and first_name2 lastname or "Joe Firstauthor adn
> Bob Secondauthor").
>
> The present query (works fine for 1 author):
> "SELECT b.title, b.sub_title, b.descr, b.comment, b.bk_cover,
> b.copyright, b.ISBN, b.sellers, c.publisher,
> CONCAT_WS(' ', first_name, last_name) AS Author
> FROM book AS b
> LEFT JOIN book_author AS ab ON b.id = ab.bookID
> LEFT JOIN author AS a ON ab.authID=a.id
> LEFT JOIN book_publisher as abc ON b.id = abc.bookID
> LEFT JOIN publishers AS c ON abc.publishers_id = c.id
> ORDER BY title ASC ";
>
> But to show 2 authors I think I need something of the order of:
> CONCAT_WS (' ', (CONCAT_WS (' ', [(first_name, last_name)WHERE
> book_author.ordinal = 1], [(first_name, last_name)WHERE
> book_author.ordinal = 2]) AS Author
>
> I suspect that one cannot nest the CONCAT_WS statement and I suspect the
> WHERE is not in the right place either, but this seems to be fairly
> logical... am I on the right track?
>
> Problem 2... is similar to Problem 1 but deals with multiple categories
> (62) and I

Re: [PHP] Getting An Inventory Product Count

2009-02-27 Thread Bastien Koert
On Fri, Feb 27, 2009 at 11:17 AM, revDAVE  wrote:

> Newbie question
>
> Hi folks,
>
> Currently, I have an inventory table that stores individual records for
> each
> single item in inventory - ( each item is on its own line because it has
> serial numbers associated with it) like:
>
> fields:
>
> Item - ModelID - sn
>
>
> item1 - 1 - sn xxx
> item1 - 1 - sn xxx
> item2 - 2 - sn xxx
> item2 - 2 - sn xxx
> item2 - 2 - sn xxx
> item3 - 2 - sn xxx
>
> Goal: I would like to give a report page with total counts for current in
> inventory like:
>
> COUNTS...
> item1 = 2
> item2 = 3
> item3 = 1
>
> so I created a fool around query that gets a count for just ModelID = 1
>
> $query_count_model1 = "SELECT count(inventory_id) as thecount FROM
> inventory
> WHERE ModelID = 1";
>
> BUT: - the I'm sure there is some better way to get a count for *each* of
> the ModelID that exist in any given time *all at once* in some kind of loop
> or xxx???... I just don't know how do that...
>
> (newbie alert) - I would appreciate any ideas or URL links etc. - please
> keep is simple for this newbie
>
>
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
select modelId, count(*) as total from table group by modelId

-- 

Bastien

Cat, the other other white meat


Re: [PHP] How important is your Express or Web Edition database? Please weigh in--

2009-02-27 Thread Bastien Koert
On Fri, Feb 27, 2009 at 2:04 PM, Bob McConnell  wrote:

> From: sstadel...@gmail.com
> >
> > Answering these 10 multiple choice questions--should take about 90
> > seconds--will help us understand what databases you need in your
> > professional life, and how to deliver them to you.
>
> Put it on a site that doesn't require blindly enabling JavaScript and I
> might be able to help.
>
> On the other hand, I had never heard of that product, so we're probably
> not using it. We do currently support Sybase ASA, Oracle, PosgreSQL and
> SQL Server.
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
MySQL, DB2, SQL Server

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--

2009-02-27 Thread Bastien Koert
On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie wrote:

> Stan Stadelman wrote:
> > Hello All:
> >
> > I'm trying to see how Web Edition databases are being used in your
> company
> > for PHP-driven web-apps.  Our strategy team thought that free and
> community
> > editions would be dominant, but we interviewed Zend Framework developers
> > using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks
> > like--surprise--that each vendors' market share is about the same as in
> the
> > broad commercial market.
> >
> > We think this means that you--the PHP developer community--aren't
> actually
> > using the lightweight Web/Express Edition for your corporate web-app
> > deployment, and instead are building out on the licenses for databases
> your
> > company is already running.
> >
> > Is the Express/Community/Web Edition important for you at work? Is it a
> > critical sandboxing step for you? Do you run it live for internal
> > applications?
> >
> > Answering these 10 multiple choice questions--should take about 90
> > seconds--will help us understand what databases you need in your
> > professional life, and how to deliver them to you.
> >
> > Happy cooking, and thanks!
> >
> > http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d
> >
>
> What exactly are, Express or Web Edition databases?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Just another marketing tool to sell a limited toolset db to punters who like
marketing hype


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Get a list of column field names from a MS Access table

2009-02-27 Thread Bastien Koert
On Thu, Feb 26, 2009 at 4:01 PM, revDAVE  wrote:

> Newbie question:
>
> I would like to get a list of column field names from a MS Access table and
> hopefully get them returned in the ORIGINAL order (as they appear in
> access)
>
> Is there a sql query I could do to get this result?
>
>
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
A dirty way is to query the table where 1=2 to return no results

select * from table where 1=2

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Bastien Koert
On Tue, Mar 3, 2009 at 3:51 PM, Ashley Sheridan 
wrote:

>  On Tue, 2009-03-03 at 14:36 -0600, Terion Miller wrote:
> > On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan <
> a...@ashleysheridan.co.uk>wrote:
> >
> > > On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
> > > > I'm trying to use the AdminID that returns from query #1 in the WHERE
> > > > AdminID = AdminID from Query 1
> > > >
> > > > $sql= "SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
> > > > AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID
> =
> > > > '".$row['AdminID']."' ";
> > > >
> > > > that isn't working and the query 1 does return in this case 3
> AdminID's
> > > so
> > > > I'm thinking it's just the .$row['AdminID'] part that is wrong
> > > > and I have tried some different things but am not sure the correct
> term
> > > for
> > > > what I'm trying to do so I can' t seem to google answers
> > > >
> > > > Here is my query #1
> > > >
> > > >   $query =  "SELECT `UserName`, `AdminID` FROM admin
> > > >   WHERE   Retail1 =  'YES' ";
> > > >
> > > > $result = mysql_query ($query) ;
> > > > //$row = mysql_fetch_array($result);
> > > > while ($row = mysql_fetch_row($result)){
> > > > for ($i=0; $i > > > echo $row[$i] . " ";
> > > >
> > > > }
> > > > Above returns 3 AdminID ... I also tried using the While statement in
> my
> > > > second query to return the sets but nothing... yet the code isn't
> > > breaking,
> > > > just returning 0
> > > >
> > > >
> > > >
> > >
> > > $query =  "SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
> > > 'YES' ";
> > >
> > > When you run this in phpMyAdmin, what is returned?
> > >
> > > Ash
> > > www.ashleysheridan.co.uk
> > >
> > > When I run the second query the one where the WHERE syntax is wrong if
> I
> > put it like this I still get one record:
> >
> > SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
> AdminID
> > , FormName,
> > STATUS , Notes, pod
> > FROM `workorders`
> > WHERE AdminID = '20'
> > AND '61'
> > AND '24'
> > LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin
> >
> > the first query works and returns the records it should... which are 3
> > usernames and 3 adminID
> What about joining the queries?
>
> SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
> workorders.CreateDate, workorders.Location, workorders.WorkOrderName,
> workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
> FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
> WHERE admin.Retail1 = 'yes'
>
> I know it looks like a mess, but it should do the trick
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
>  --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

incorrect syntax on your query

try

SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName, AdminID
, FormName,
STATUS , Notes, pod
FROM `workorders`
WHERE AdminID in ( '20','61','24')

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Strange charecters

2009-03-04 Thread Bastien Koert
On Wed, Mar 4, 2009 at 2:10 AM, Paul Scott  wrote:

> On Wed, 2009-03-04 at 10:09 +0530, Chetan Rane wrote:
> > I am using ob_start() in my application. However I am getting this error
> > about headers already sent.
> >
>
> _Any_ output will set that error off. Check for Notices, Warnings,
> echo's, prints and var_dumps in your code.
>
> -- Paul
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
check for a blank space above the 

Re: [PHP] verify another flavor

2009-03-06 Thread Bastien Koert
$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
LIKE 'first_nameIN' && last_nameIN LIKE 'last_nameIN')"

On Fri, Mar 6, 2009 at 11:36 AM, PJ  wrote:

> I know I'm a pain the butt but I just can't help asking for help. You
> guys are so nice... ;-)
> I am trying to do some checks if there are entries in the db so I can
> then insert the right stuff. And I'm looking for ways to simplify things.
> I probably dont understand the flow of things here, but this almost
> works. :-\
> $Author = $first_nameIN . ' ' . $last_nameIN;
> echo $Author;
> $sql1 = "SELECT CONCAT_WS(" ", first_name, last_name) as Author FROM
> author WHERE Author LIKE '$Author'";
>  $result1 = mysql_query($sql1);
> this would be instead of
> $sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
> LIKE 'first_nameIN' && last_nameIN LIKE 'last_nameIN')"
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You  need the % operator for a like comparison

$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
LIKE '%first_nameIN%' && last_nameIN LIKE '%last_nameIN%')"


but most likely, you really want a true comparison to see if that user
exists

$sql1 = "SELECT first_name, last_name) FROM author WHERE (first_name
= 'first_nameIN' && last_nameIN = 'last_nameIN')"

-- 

Bastien

Cat, the other other white meat


Re: [PHP] insert array values

2009-03-06 Thread Bastien Koert
On Fri, Mar 6, 2009 at 4:00 PM, PJ  wrote:

> I've been racking my little peanut-brain as well as big Google with
> little hope...
> I can retrieve the array from the multiple select dropdown box but I
> can't quite manage to insert the data which is just id numbers for a table.
> I've tried some while stuff but doesn't work. I know I don't have the
> right syntax on anything at this point. Here's an effort that doesn' work.
> Dont know if I should be using $categoriesIN[] type of stuff...
> but my tries were from web illustrations...
> the outcommented line returns the values of the array... but how to pass
> them to the query?
>
> foreach ($categoriesIN as $category) {
>//"$category";
> $sql = "INSERT INTO book_categories ( book_id, category )
>VALUES( book.id WHERE title = $titleIN, $category )";
>$result = mysql_query($query, $db);;
>}
> TIA
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
As its an array, you could join the data with an IMPLODE into a string, but
does that meet your needs? The other option is to create a sub-table for
this element and insert each item thru a loop individually.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] include_path

2009-03-06 Thread Bastien Koert
On Fri, Mar 6, 2009 at 4:21 PM, Eric Lease Morgan  wrote:

>
> On 3/6/09 4:19 PM, "9el"  wrote:
>
> >> Ironically, Smarty/Smarty.class.php IS located under /usr/lib/php. So is
> >> PEAR.php.
> >
> > /usr/lib/php is not in the default scope of webroot  ie. /var/www  :)
> > You have to allow apache to access  /usr/lib/php location
>
> Thank you for the prompt reply, and it seems very feasible, but how do I
> allow apache access to the /usr/lib/php locatdion?
>
> --
> Eric Lease Morgan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If the SMARTY call is the same to the same path, should it not be

require_once("Smarty.class.php");

and not

require_once("Smarty/Smarty.class.php");

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Header - Redirect Command Not Working

2009-03-10 Thread Bastien Koert
On Tue, Mar 10, 2009 at 3:13 PM, revDAVE  wrote:

> Newbie question...
>
> At the end of a php block I'm trying to use a redirect to go to another
> page.
>
> header('Location: show.php');
>
> It works on my test server w php 5.2.6 but not at the main server w v 5.12
>
> Is there a way to get it to go to the other page (even with a different
> command/function) - or am I doing something wrong?
>
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Are you getting an error? What does 'not working' mean?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Daily and Weekly Calendar classes

2009-03-12 Thread Bastien Koert
On Thu, Mar 12, 2009 at 9:05 PM, Jason Todd Slack-Moehrle <
mailingli...@mailnewsrss.com> wrote:

> Hi All,
>
> Does anyone have classes for creating a nice daily calendar? I can put the
> data in MySQL and be queried, etc.
>
> Something that when I add events to the calendar it puts them in the right
> time slot, etc, etc.
>
> I can do the rest of the coding
>
> Free is best!
>
> -Jason
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
check

www.hotscripts.com
www.phpclasses.org
http://sourceforge.net

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Export/Write rows from DBF to CSV

2009-03-13 Thread Bastien Koert
On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari <
sleepwal...@rahulsjohari.com> wrote:

> Ave,
>
> I'm trying to retrieve data from a DBF database and write it to a CSV file
> in a comma delimited format. I'm able to get the data and write it to CSV,
> but it only writes the last row/record ... not all the records. I know I
> don't have the correct code and I'm hoping someone can help me...
>
> _
> #CREATE CSV
> $date = date('mdy');
> $_file = 'CSV/TransferData_'.$date.'.csv';
> $_fp = @fopen( $_file, 'w' );
>
>#SELECT DBF TO OPEN - READ ONLY
>$db = dbase_open("mydata.dbf", 0);
>#PULL UP RECORD
>if ($db) {
>  $record_numbers = dbase_numrecords($db);
>  for ($i = 1; $i <= $record_numbers; $i++) {
>$row = dbase_get_record_with_names($db, $i);
>
>#WRITE ROWS TO VARIABLE
>$_csv_data =
> trim($row['PHONE']).",".trim($row['DATE']).","."\n"; <-- THIS is where my
> problem is! This only writes the last row!!
>  }
>}
>
> #WRITE TO CSV
> @fwrite( $_fp, $_csv_data );
> @fclose( $_fp );
> _
>
> Thanks!
>
> ---
> Rahul Sitaram Johari
> Founder, Internet Architects Group, Inc.
>
> [Email] sleepwal...@rahulsjohari.com
> [Web]   http://www.rahulsjohari.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You are overwriting the variable ($csv_data) that holds the row, add a
period (concatenator) operator to build the up the data

 #WRITE ROWS TO VARIABLE
   $_csv_data .=
trim($row['PHONE']).",".trim($row['DATE']).","."\n";
<-- THIS is where my problem is! This only writes the last row!!




-- 

Bastien

Cat, the other other white meat


Re: [PHP] PHP to create an ERD (sic) on the fly on a web page based on current DB records?

2009-03-13 Thread Bastien Koert
On Fri, Mar 13, 2009 at 9:37 AM, haliphax  wrote:

> On Thu, Mar 12, 2009 at 7:47 PM, scubak1w1  wrote:
> > Hello,
> >
> > Seeking some advice on how to create an ERD (sic) graphically on the page
> on
> > the fly when the page is 'called'...
> >
> > That is, I have a backend PostgreSQL database that I am getting data from
> > and putting data into via web page/s and PHP...
> >
> > I would like to be able to show graphically to the web site admins the
> > relationships between the pimary key contents of one table to all its
> > foreign keys in the daughter table in a form of a simple entity
> relationship
> > diagram.
> >
> > That is, a graphic showing (say) all of the PKs listed in the mother
> table,
> > all of the more voluminous (sic) FKs listed in another table - and
> > "connecting lines."
> >
> > This is to aid the admin users that are used to conceptualiazing this
> sort
> > of thing...
>
> PHPMyAdmin does exactly this sort of thing, as do a lot of SQL
> workbench programs. I'm sure there is one out there that will handle
> PostgreSQL. My advice to you is not to reinvent the wheel. If they're
> admin users, do you really need to wrap it up in a self-contained
> webpage for them, or could you just show them using an administrative
> tool that can handle ERD?
>
>
> --
> // Todd
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
there is a version of phpmyadmin for postgre. phppgadmin is available from
sourceforge.net

-- 

Bastien

Cat, the other other white meat


Re: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Bastien Koert
On Mon, Mar 16, 2009 at 10:06 AM, Alice Wei  wrote:

>
> Hi,
>
>  I use Linux, and I had installed PHP using yum install php. I am trying to
> use the pdf_new function to create pdfs from existing text files, but I get
> this error
>
>PHP Fatal error:  Call to undefined function pdf_new()
>
> I have noticed that when I run the phpinfo() command, I cannot find the PDF
> phrase at all. My php.ini file does not even have these two lines
>
>  extension=php_pdf.dll
>  extension=php_cpdf.dll
>
> Could anyone suggest me what kind of command I should use if I need to
> build PDFs using PHP on a Linux system?
>
> Thanks in advance.
>
> Alice
>
>
>
> _
> Express yourself with gadgets on Windows Live Spaces
> http://discoverspaces.live.com?source=hmtag1&loc=us


I like dompdf from www.digitaljunkies.ca Its a class that takes html and
creates a pdf from it

-- 

Bastien

Cat, the other other white meat


Re: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Bastien Koert
On Mon, Mar 16, 2009 at 11:32 AM, Alice Wei  wrote:

>
> On Mon, Mar 16, 2009 at 10:06 AM, Alice Wei  wrote:
>
>
>
> Hi,
>
>
>
>  I use Linux, and I had installed PHP using yum install php. I am trying to
> use the pdf_new function to create pdfs from existing text files, but I get
> this error
>
>
>
>PHP Fatal error:  Call to undefined function pdf_new()
>
>
>
> I have noticed that when I run the phpinfo() command, I cannot find the PDF
> phrase at all. My php.ini file does not even have these two lines
>
>
>
>  extension=php_pdf.dll
>
>  extension=php_cpdf.dll
>
>
>
> Could anyone suggest me what kind of command I should use if I need to
> build PDFs using PHP on a Linux system?
>
>
>
> Thanks in advance.
>
>
>
> Alice
>
>
>
>
>
>
>
> _
>
> Express yourself with gadgets on Windows Live Spaces
>
> http://discoverspaces.live.com?source=hmtag1&loc=us
> I like dompdf from www.digitaljunkies.ca Its a class that takes html and
> creates a pdf from it
> I saw online at http://us3.php.net/manual/en/pdf.installation.php that I
> could build PDF from some extension. However, I use Linux, and I don't think
> this installation using dll extension supports it. I ran the code and still
> get this error.
>
> Any ideas?
> Thanks for your help.
>
> Alice
> --
>
> Bastien
>
> Cat, the other other white meat
>
> _
> Search from any Web page with powerful protection. Get the FREE Windows
> Live Toolbar Today!
> http://get.live.com/toolbar/overview

for PECL based windows installation see
http://us3.php.net/manual/en/install.pecl.downloads.php

another option is FPDF from www.fpdf.org another class

the classes are nice since they don't generally require the module to be
installed.

If you are on Linux, another option might be FOP...
http://xmlgraphics.apache.org/fop/

-- 

Bastien

Cat, the other other white meat


Re: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Bastien Koert
[snip]
>
>
> [/snip]
> another option is FPDF from www.fpdf.org another class
>
> the classes are nice since they don't generally require the module to be
> installed.
>
> If you are on Linux, another option might be FOP...
> http://xmlgraphics.apache.org/fop/
>
>   I checked out the first link you provided, and downloaded it. I don't
> think I need to edit anything else from the file according to the
> webpage http://www.digitaljunkies.ca/dompdf/install.php. I put the
> entire extracted directory at my /var/www/html directory. Is there any
> suggestion you could provide on how to "install" it? I don't see any
> commands that it provides in its manual.
>
>
>
> Thanks for your help.
>
>
>
> Alice
>
>
>
> _
> Express yourself with gadgets on Windows Live Spaces
> http://discoverspaces.live.com?source=hmtag1&loc=us
>


Its a class set of files, so there is no real install. I just placed the
folder containing the class files in my dir and in the calling page,
required() the main file.


The dompdf.inc.php file is where i handle the filesystem links
-- 

Bastien

Cat, the other other white meat


Re: [PHP] pdf_new() uncalled Function

2009-03-16 Thread Bastien Koert
On Mon, Mar 16, 2009 at 1:48 PM, Alice Wei  wrote:

>  [/snip]
> another option is FPDF from www.fpdf.org another class
>
> the classes are nice since they don't generally require the module to be
> installed.
>
> If you are on Linux, another option might be FOP...
> http://xmlgraphics.apache.org/fop/
>
>   I checked out the first link you provided, and downloaded it. I don't
> think I need to edit anything else from the file according to the
> webpage http://www.digitaljunkies.ca/dompdf/install.php. I put the
> entire extracted directory at my /var/www/html directory. Is there any
> suggestion you could provide on how to "install" it? I don't see any
> commands that it provides in its manual.
>
> Thanks for your help.
>
>
> Its a class set of files, so there is no real install. I just placed the
> folder containing the class files in my dir and in the calling page,
> required() the main file.
>
>
> The dompdf.inc.php file is where i handle the filesystem links
> Looks like the files I wanted to turn into PDF are not web pages, but most
> of them are text files. I am still hoping to use the function pdf_new to get
> this to work by assembling some modules. Is what I am trying to do here not
> possible?
>
> Thanks for your help.
>
> Alice
> --
>
> Bastien
>
> Cat, the other other white meat
>
> --
> Search from any Web page with powerful protection. Get the FREE Windows
> Live Toolbar Today! Try it now! 
>

I don't see why not, just create a page that will pull in the data and then
format it nicely

-- 

Bastien

Cat, the other other white meat


Re: [PHP] "Default" field

2009-03-18 Thread Bastien Koert
On Wed, Mar 18, 2009 at 4:18 PM, Paul M Foster wrote:

> Slightly OT, but here's the question. Normally when a form paints, the
> cursor isn't in any particular field. If you want to have the cursor
> show up in a particular field, how do you do that? I knew at one time
> and now can't find how it's done.
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 11:06 AM, Bob McConnell  wrote:

> From: Virgilio Quilario
> >> That looks nice, but how do I get to the point where I can understand
> >> how to use it?
> >>
> >> I have also looked at the Smarty site , but
> >> their documents assume significant experience in building and using
> >> templates.
> >>
> >> Where can I find guidance or tutorials on how to do all of this,
> >> starting with only a rudimentary knowledge of HTML and PHP. It would
> be
> >> best if they also focused on procedural rather than object oriented
> >> code.
> >
> >
> > When I started learning smarty, I spent most of my time doing research
> > and that's really tiresome and it is so hard to find examples.
> > Experimented a lot and listed those what's possible, then applied them
> > to my projects.
> >
> > Now to make them handy I posted them to my site so i can have a look
> > whenever and wherever.
> >
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> tips-and-techniques-to-make-templates-smarter.html
> >
> > As a first step, maybe you should see the crash course at smarty
> > http://www.smarty.net/crashcourse.php
>
> Hi Virgil,
>
> After your last post here, I looked at your site, then the Smarty site.
> That was what triggered this question. Templates are a black art to me.
> I don't even know where to begin to understand them. Every reference I
> have looked at so far assumes that I already understand the MVC pattern,
> which is also one of the dark arts.
>
> Let me put it simply. I can't grok OO. I tried to do OOP for several
> years, but it simply does not make any sense to me. As a direct result,
> I don't understand the concept nor application of patterns. So how do I
> figure out how to use templates without having to absorb those first?
> Can I learn enough this way to determine if a site can be converted from
> the current state (PHP and XHTML spaghetti) into templates and begin
> that transformation?
>
> Thank you,
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Bob,

You really would need to learn those concepts first OOP / MVC. There is a
learning curve, but you really don't need OOP to be able to do an MVC style
application, but it does make the code neater.

One of the books that really helped me grok OOP is Head First OOP...another
is Martin Fowlers Patterns of Enterprise Architecture.

The MVC pattern is explained well in a number of places, but worth checking
out are both the cakephp framework site and the codeingniter site.

You'll find that there are people from both camps here, pure OOP and other
just as happy with procedural coding styles. Many use both, using objects to
handle common tasks like DB interaction or filesystem processes.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Smarty Tips and Techniques

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 12:36 PM, Bob McConnell  wrote:

> From: Shawn McKenzie
>  > Bob McConnell wrote:
> >> From: Virgilio Quilario
>  That looks nice, but how do I get to the point where I can
> understand
>  how to use it?
> 
>  I have also looked at the Smarty site , but
>  their documents assume significant experience in building and using
>  templates.
> 
>  Where can I find guidance or tutorials on how to do all of this,
>  starting with only a rudimentary knowledge of HTML and PHP. It
> would
> >> be
>  best if they also focused on procedural rather than object oriented
>  code.
> >>>
> >>> When I started learning smarty, I spent most of my time doing
> research
> >>> and that's really tiresome and it is so hard to find examples.
> >>> Experimented a lot and listed those what's possible, then applied
> them
> >>> to my projects.
> >>>
> >>> Now to make them handy I posted them to my site so i can have a look
> >>> whenever and wherever.
> >>>
> >>
> http://www.jampmark.com/php-programming/16-very-useful-smarty-scripting-
> >> tips-and-techniques-to-make-templates-smarter.html
> >>> As a first step, maybe you should see the crash course at smarty
> >>> http://www.smarty.net/crashcourse.php
> >>
> >> Hi Virgil,
> >>
> >> After your last post here, I looked at your site, then the Smarty
> site.
> >> That was what triggered this question. Templates are a black art to
> me.
> >> I don't even know where to begin to understand them. Every reference
> I
> >> have looked at so far assumes that I already understand the MVC
> pattern,
> >> which is also one of the dark arts.
> >>
> >> Let me put it simply. I can't grok OO. I tried to do OOP for several
> >> years, but it simply does not make any sense to me. As a direct
> result,
> >> I don't understand the concept nor application of patterns. So how do
> I
> >> figure out how to use templates without having to absorb those first?
> >> Can I learn enough this way to determine if a site can be converted
> from
> >> the current state (PHP and XHTML spaghetti) into templates and begin
> >> that transformation?
> >
> > You don't need OOP to use templates.  Smarty is OOP. but there are
> some
> > lighter faster template solutions, as well as just creating your own
> > templates  that you either parse and replace vars in or just use PHP
> > code.  As long as you keep the PHP in your templates display oriented
> > and not business/app logic based then it should be a nice solution.
> >
> > You might also look at a framework (codeignitor, cakephp) and go
> through
> > their tutorial, though these are undoubtedly MVC/OOP, it may make more
> > sense once you start building something with it.
>
> Well, I installed CodeIgniter on one of my home servers last night, but
> have not yet started through the manual. That will be an interesting
> experiment. I am hoping to create a simple recipe management system
> there, similar to ReciPants, but in PHP.
>
> At work the problem is more basic; 162 files of interleaved database
> access, business logic and presentation, all written by a civil
> engineering student with no software training at all. He has moved on,
> but five of us working on three products are now dealing with the mess
> he left behind.
>
> Thank you,
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Just 162 files? I don't mean to sound condescending but if the code is that
much trouble, chuck it out and start over. Build it properly by separating
out the db interaction stuff ( and there are great patterns to use there as
well like Active Record or work with an ORM layer like propel or doctrine ).
Then separate out the presentation layer, and define a transport to that
layer from the business logic layer. I like XML for this, passing it to XSLT
for client side transformations into html. Then the DB passes to the
business layer, which does its stuff and then passes the results to the
presentation layer. And the same in reverse, the presentation layer never
talks to the db layer directly.

Creating that separation should make the whole maintenance issue better.
Parts that need to be shared can be copied across to the other applications
so that each app lives in isolation. If that is not possible, the consider
breaking the shared bits into smaller pieces to limit the exposure to
potential issues when you have to make changes. PCI is a pain in the ass and
the rules that govern that make things very difficult, though I can see why
it all needs to be there.

The application I support (classic ASP) comprises 149 Mb of code in some
1500 + files scattered across some 50+ folders each with their own db access
code. Nightmare isn't the word for it. It uses some 160+ DB tables as well.
Rebuilding it is a task that I am looking forward to and am definitely using
the MVC pattern with OOP to some extent. I am looking at codeig

Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:

> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
> spaces in it
> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>
> I'm exploring your reply regarding proc_open, but how exactly does
> proc_open
> separate the arguments from the command?
>
> Unless i'm mistaken, data written to the process's stdin (for the other
> process) is not treated like an argument.
>
> If I add the arguments to the process name/path? I'm back to square one.
>
> Luke.
>
> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >wrote:
>
> > Kyohere Luke wrote:
> > > Hi,
> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> > >
> > > This works from commandline:
> > >
> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> > >
> > > But if I run it through php like this:
> > >
> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> > > test2\"".;
> > > @exec($command, $response, $retval);
> > >
> > > This always fails, returns 1 and the response is empty.
> > >
> > > If the last argument is a string with no spaces, and the double quotes
> > were
> > > omitted, it works perfectly.
> > >
> > > If the double quotes are added around the string with no spaces, it
> fails
> > > again, which makes me believe that the problem is with the double
> quotes.
> > >
> > > I've used procmon and it shows that when the double quotes are added
> > around
> > > the last argument, gammu.exe is not even called at all.
> > >
> > > Problem is that the double quotes are required by gammu to send an sms
> > with
> > > spaces in it.
> > >
> > > Any ideas? :-(
> > >
> > > Luke
> > >
> >
> > Why not try:
> >
> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
> >
> > --
> > Thanks!
> > -Shawn
> > http://www.spidean.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

try double slashes for the path and wrap the pathin quotes if there are
spaces in it. Or if possible get rid of the spaces in the folder names

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Read Text Content from PDF file

2009-03-20 Thread Bastien Koert
On Fri, Mar 20, 2009 at 9:48 AM, Andrei Bintintan  wrote:

> Hi to all,
>
>
>
> I have to read the texts from PDF documents with PHP. A solution would be
> to
> use http://www.foolabs.com/xpdf, but it is not installed on the server
> that
> I work with and it is not wanted to be installed. So I have to look for
> another solution.
>
>
>
> Is there a possibility, PHP library, something with which I can READ the
> texts from a PDF document with PHP?
>
>
>
> Thanks a lot,
>
> Andy.
>
>
>
>
http://www.setasign.de/products/pdf-php-solutions/fpdi FPDI makes it
possible.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Read Text Content from PDF file

2009-03-20 Thread Bastien Koert
On Fri, Mar 20, 2009 at 10:23 AM, Andrei Bintintan wrote:

>  Could you be more precise? I’m looking at that class, but I can’t see any
> function that does that.
>
> Andy.
>
>
>
> *Von:* Bastien Koert [mailto:phps...@gmail.com]
> *Gesendet:* 20 March 2009 14:57
> *An:* Andrei Bintintan
> *Cc:* php-general@lists.php.net
> *Betreff:* Re: [PHP] Read Text Content from PDF file
>
>
>
>
>
> On Fri, Mar 20, 2009 at 9:48 AM, Andrei Bintintan 
> wrote:
>
> Hi to all,
>
>
>
> I have to read the texts from PDF documents with PHP. A solution would be
> to
> use http://www.foolabs.com/xpdf, but it is not installed on the server
> that
> I work with and it is not wanted to be installed. So I have to look for
> another solution.
>
>
>
> Is there a possibility, PHP library, something with which I can READ the
> texts from a PDF document with PHP?
>
>
>
> Thanks a lot,
>
> Andy.
>
>
>
> http://www.setasign.de/products/pdf-php-solutions/fpdi FPDI makes it
> possible.
>
> --
>
> Bastien
>
> Cat, the other other white meat
>


http://www.setasign.de/support/manuals/fpdi/

that is what a manual is for

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Frameworks / obstinate?

2009-03-23 Thread Bastien Koert
On Mon, Mar 23, 2009 at 10:43 AM, tedd  wrote:

> At 10:24 AM -0400 3/23/09, Robert Cummings wrote:
>
>>
>> My point is, just because new techniques and technoloigies
>> come out, is in no way a boundary condition on an existing technology's
>> lifespan or efficacy in any particular environment. The deprecation of
>> usefulness of any technology is based on many more variables than
>> "Jquery - The New Game just began". Jquery runs in the browser, it will
>> never replace server side data acquisition, caching, and manipulation.
>> It will merely augment. Moreover, it is completely useless when
>> JavaScript is disabled. Your post also made the assumption that PHP is
>> used for web sites only. Many people are using it for other tasks too.
>> Popularity is also not a useful metric of the demise of a language. It
>> may just be that less people are familiar with JQuery and so there are
>> more questions whereas PHP has been around long enough that the bulk of
>> people interested in it have a good enough foundation in it that they
>> don't need to ask questions.
>>
>> Cheers,
>> Rob.
>>
>
> Rob:
>
> All good and excellent points.
>
> However, I have heard of "new" javascript being run server-side. What's the
> likelihood of that "catching on" and surpassing php?
>
> 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
>
> Tedd,

JS has been running on MS servers for a long time. It was always viewes as
an acceptable replacement for vbscript.


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Form To Mail script generators for Linux

2009-03-23 Thread Bastien Koert
On Mon, Mar 23, 2009 at 10:33 AM, Jacques Manukyan
wrote:

> Take a look at
> http://php.resourceindex.com/Complete_Scripts/Form_Processing/
>
> Note that not all the scripts there are free though so look at type.
>
> By the way, as long as the server can run PHP and there are no specific
> shell commands in the script, it should run on any operating system.
>
> -- Jacques Manukyan
>
>
> Linda Stark wrote:
>
>> Hi,
>>
>> I am trying to find out if there are any “form to mail” php script
>> generators that run on Linux available - that would generate the script
>> needed
>> to profess web mail forms such as a “contact us” page or a
>> “mail us”  page on a web site.
>> There was one in patricular I was looking at that is windows based, called
>> “Forms To Go”,
>> a commercial package, which from what I have gathered is the most popular
>> in it’s
>> class and apparently it generates secure code.
>> Thanks for any info.
>>
>>
>> _
>> Internet Explorer 8 – Now Available. Faster, safer, easier.
>> http://clk.atdmt.com/MRT/go/141323790/direct/01/
>>
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
http://www.hotscripts.com/category/php/scripts-programs/form-processors/ is
another place to look

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Frameworks / obstinate?

2009-03-23 Thread Bastien Koert
On Mon, Mar 23, 2009 at 11:35 AM, Shawn McKenzie wrote:

> Arno Kuhl wrote:
> > -Original Message-
> > From: Sancar Saran [mailto:sancar.sa...@evodot.com]
> > Sent: 23 March 2009 11:52 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Frameworks / obstinate?
> >
> > Probably a bit off topic and
> >
> > The Game is over man.
> >
> > Javascript coming with flank speed. Next generation JS Framworks will
> take
> > html generation jobs from server side.
> >
> > Whole thing of Server Side MVC and other yada yada was became joke. Those
> > server siders become JSON pushers for JS frameworks.
> >
> > Astrosurfing ?
> >
> > Yeah, just compare PHP mailing list vs Jquery Mailing list activity.
> >
> > And The New Game just begun...
> >
> > Regards
> >
> > Sancar
> >
> > --
> > You seem to suggest the more you do on client side the less you do on the
> > server. Not sure where you get that from. I'm inclined to think the
> opposite
> > - the more you do on the client the more you'll need to do on the server.
> > Sure there will be certain types of client apps that will all but
> eliminate
> > the need for server-side processing, but it's likely more power on the
> > client will mean internet apps are going to be more powerful all round,
> both
> > client and server side.
> >
> > Arno
> >
> >
>
> Yes, it's very difficult (and probably insecure) to distribute your
> entire database to all of the clients that might use it.  Not to mention
> all of the libraries:  image manipulation, pdf generators, etc...
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Flex is gonna be a bigger player in this than js query type manipulation

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Error printer_open()

2009-03-27 Thread Bastien Koert
On Fri, Mar 27, 2009 at 8:37 AM, Gerardo Picotti wrote:

> Hi.
> I'm trying to use the printer functions in my php development.
> I add the php_printer.dll in the "c:/php/ext/" path.
> I add the line in the php.ini file like that: extension=php_printer.dll.
> But that doesn't work and gives the next error:
>
> Fatal error: Call to undefined function printer_open().
>
> What can I do?
> Thanks for your help!
>
>
> Gerardo
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Does the php_printer.dll exist in the EXT folder?


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Help figuring out an uploading script problem...

2009-03-30 Thread Bastien Koert
2009/3/30 Terion Miller 

> I have this script that is no longer working to upload files, it goes thru
> the motions and says the file is uploaded but then there is NO file in the
> ArtWork folder
>
> any ideas?
>if ($_FILES) {
>for ($x=0; $x < 15; $x++) {
>if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) {
>$ImageExt = strtolower(end(explode('.',
> $_FILES['Artwork']['name'][$x])));
>$ImageName = $_FILES['Artwork']['name'][$x];
>$ImageSize = $_FILES['Artwork']['size'][$x];
>list($width, $height, $type, $attr) =
> getimagesize($_FILES['Artwork']['tmp_name'][$x]);
>
>$sql = "INSERT INTO images (ImageDate, ArtID, AdminID,
> ImageName, ImageType, ImageType2, ImageSize, ImageHeight, ";
>$sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(),
> '$ArtID', '$AdminID', '$ImageName', '$ImageExt',";
>$sql .= " '$type', '$ImageSize', '$height', '$width',
> '$attr', '$Notes2')";
>mysql_query ($sql);
>$ImageID = mysql_insert_id();
>
>$uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".".
> $ImageExt;
>move_uploaded_file($_FILES['Artwork']['tmp_name'][$x],
> $uploadfile);
>chmod($uploadfile, 0666);
>}
>}
>}
>
> Thanks
> Terion
>
> Happy Freecycling
> Free the List !!
> www.freecycle.org
> Over Moderation of Freecycle List Prevents Post Timeliness.
> Report Moderator Abuse Here:
> http://www.freecycle.org/faq/faq/contact-info
> Or Email Your Complaint to:
> f...@freecycle.org or i...@freecycle.org
> 
> Twitter?
> http://twitter.com/terionmiller
> 
> Facebook:
> http://www.facebook.com/people/Terion-Miller/1542024891";
> title="Terion Miller's Facebook profile" target=_TOP>http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
> alt="Terion Miller's Facebook profile">
>

Perchance did the permissions change on the folder or has the ini changed to
limit the uploaded data? Is the folder full to disk capacity of the OS?

-- 

Bastien

Cat, the other other white meat


Re: [PHP] time() TIMER in seconds or just numbers

2009-03-30 Thread Bastien Koert
On Mon, Mar 30, 2009 at 12:05 PM, haliphax  wrote:

> On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes  wrote:
> >> When someone does that, it means the execution time between $t1 and
> $t2...
> >
> > Is that for my benefit? Believe it or not, I do know the arcane art of
> > subtraction...
>
> I would subtract more often, but sacrificial farm animals and black
> candles are so hard to come by these days...
>
>
> --
> // Todd
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> I have a couple of managers you can have...they bleat like sheep most of
the time any way and don't provide much other than dung...


-- 

Bastien

Cat, the other other white meat


Re: [PHP] Java applet clearing session variables?

2009-04-02 Thread Bastien Koert
On Thu, Apr 2, 2009 at 3:26 PM, Dan King  wrote:

> It seems that our java applet is clearing our php session variables.
>
> I have an html form that saves user information as session variables. These
> session variables are used to create folders, where uploaded files can be
> saved. I've tested my php script that uses the session variables to create a
> folder and then moves uploaded files to that folder with a traditional html
> upload form.
> However, when I use a java applet in place of the traditional html form the
> php script does not create the folder, and thus it obviously cannot move the
> uploaded files.
>
> I've tested the applet and it does successfully upload files to the server.
> When I printed the session array variable after using the applet, I noticed
> the session array was empty. Does anyone know why this the applet clears the
> session variables? Or how to stop/work around it so I can use the applet and
> the php script?
>
> Thanks,
>
> Dan
>
>
>
>


Add the session hash to the page as a hidden field and revalidate
/regenerate the session when the page gets submitted?

-- 

Bastien

Cat, the other other white meat


Re: [PHP]scheduled task in php IN FIREFOX

2009-04-03 Thread Bastien Koert
On Fri, Apr 3, 2009 at 9:02 AM, Michael A. Peters  wrote:

> Andrew Williams wrote:
>
>> HOW DO YOU CONFIGURE scheduled task to use firefox instead of Internet
>> Explorer
>>
>>
> Install Linux ;)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
instead of loading the php.exe, load FF and point to the script, note that
this will open a browser window and you will need to close that in order to
keep the resources on the server from being exhausted due to many windows
being opened.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] difficult select problem

2009-04-06 Thread Bastien Koert
On Mon, Apr 6, 2009 at 12:32 PM, PJ  wrote:

> I've searched the web, the tutorials, etc. with no luck and have asked
> on MySql list with no luck and have even posted here with no replies.
> So, let's try again:
>
> I am trying to limit the search for books to only those that start with
> "A" (does not have to be case sensitive); but within that selection
> there may be a second author whose name may start with any letter of the
> alphabet.
>
> So, the real problem is to find if there is a second author in the
> selection of books and to display that name.
> My query shows all the books that begin with A:
>
> $SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
>FROM book AS b
>LEFT JOIN book_publisher as bp ON b.id = bp.bookID
>LEFT JOIN publishers AS c ON bp.publishers_id = c.id
>LEFT JOIN book_author AS ba ON b.id = ba.bookID
>LEFT JOIN author AS a ON ba.authID = a.id
>WHERE LEFT(last_name, 1 ) = '$Auth' ";
>
> Within the results there are some books that have 2 authors and now I have
> to find if
> there is a second author in the results and then be able to echo the second
> author.
> So far, I have not been able to figure out how to go about that.
> Do I need to do another query to find the second author or can it somehow
> be incorporated into the original query? Or can it be done with a UNION ?
> Please help.
>
>
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -
> Phil Jourdan --- p...@ptahhotep.com
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
$SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
   FROM book AS b
   LEFT JOIN book_publisher as bp ON b.id = bp.bookID
   LEFT JOIN publishers AS c ON bp.publishers_id = c.id
   LEFT JOIN book_author AS ba ON b.id = ba.bookID
   LEFT JOIN author AS a ON ba.authID = a.id
   WHERE last_name like '$Auth%' ";


The above assumes that $Auth has a value of A and should pull all the
authors whose last name starts with the letter A

-- 

Bastien

Cat, the other other white meat


Re: [PHP] difficult select problem

2009-04-07 Thread Bastien Koert
On Tue, Apr 7, 2009 at 1:10 PM, Michael A. Peters  wrote:

> PJ wrote:
>
>> Bob McConnell wrote:
>>
>>> From: PJ
>>>
 First, let me thank you all for responding and offering suggestions. I
 appreciate it and I am learning things.
 However, it looks like my message is not getting across:
 The problem is not to retrieve only the authors whose last names begin
 with A:

>>> Actually, it appears you simply don't like the accurate answers you have
>>> been given.
>>>
>> First, let me say that I am pretty fresh to all this.
>> Second, I believe I can get the authors with several more queries as I
>> have done for listings of all the books and by categories, but I am
>> trying to limit the queries thinking that that will speed up the data
>> retrieval.
>>
>
> A friend of mine who manages many large scale websites with massive
> databases says that isn't always the case, especially if you don't have a
> dedicated SQL server with very fast disks and lots of memory.
>
> He's found that in many situations it is faster to do several sql queries
> and let php sort it out then to use a bunch of joins, subselects, etc. in
> order to reduce the number of sql queries.
>
> Has to do with how sql works on the filesystem, and the IO that can result
> from sql needing to do a more complex query, and what is fastest varies upon
> your setup. I think he said sub-selects are the worst because sql has to
> create a virtual table for the subselect and that can really slow the query
> down, but I might be mistaken about that.
>
> Thus unless he has a problem application that is way too slow on hardware
> he can't upgrade, he opts for what is easier code to read and maintain.
> Sometimes that's faster than hard to read queries anyway.
>

Simple queries will almost alwasy be faster than a large join. Join query
response times can be affected by the order of the join if  the primary
table is not the largest one amoung other factors.

Another thing to consider here is that the data is relatively static.
Perhaps you could build a xml representation on the first display of the
book and pay the piper once in building the data. From there build an xml
snippet ( and store it in the database perhaps in the main books table. Then
on future calls to that book to display the same data, request the xml and
use that to display all the data. That way you get the search functionality
you are looking for and a one time hit to build that data into one common
format. That would make the future reads of that data much quicker.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] PHP bandwidth control

2009-04-07 Thread Bastien Koert
On Tue, Apr 7, 2009 at 1:36 PM, Michael A. Peters  wrote:

> tedd wrote:
>
>> At 2:46 PM +0100 4/7/09, Nick Cooper wrote:
>>
>>> Sorry to side track the issue, but when did this happen to you on
>>> GoDaddy?
>>> I have never experienced this problem. I have been using them for two
>>> years
>>> and I often leave domains in the checkout and come back sometimes days
>>> later
>>> and they're still $7.95.
>>>
>>
>> This is of interest to me as well.
>>
>> My old registrar iyd.com was sold to hover.com and the new guys have some
>> serious problems.
>>
>> I've been thinking about combining my ~70 domain names into a single
>> registrar and GoDaddy looks good thus far.
>>
>> So, I would like to know what problems people have-had/are-having with
>> GoDaddy.
>>
>
> My only problem is that their interface is crappy and inconsistent.
> However, managing domain names is cake - they do it well.
>
> Their domain manager web app is fairly well done.
>
> Buying domains can be a PITA as they try to sell you all kinds of stuff
> with it, and their pages are really busy so you have to scroll down to the
> continue button for continue after deciding you don't want any of their
> superfluous stuff.
>
> Anyway - within 15 minutes of changing what nameserver should be used with
> a registered domain name, my ISP nameserver starts using it, every time -
> and never a problem.
>
> e-mail support has been answered within 24 hours, and once with a phone
> call because the tech didn't understand my question.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I like and have used www.misk.com for the last three years. Its got a nice
interface and domains are $10/year

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Hello, I have a question about php array max number

2009-04-09 Thread Bastien Koert
On Thu, Apr 9, 2009 at 2:36 PM, PeterDu  wrote:

> Hello,
>
> I have an array including 2000 records in database,
>
> but when fetch all of them, why just get 1500 records?
>
> Does that depend on my computer?
>
> Peter
>
> __ Information from ESET NOD32 Antivirus, version of virus
> signature database 3997 (20090409) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Could be the memory limit on the server, could be the query only returning
1500 rows.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] pear mdb2 and null

2009-04-13 Thread Bastien Koert
[snip]
>> I need it to error when an attempt to create a record without setting that
>> field is attempted, but setting the field to an empty string is fine.
>>
>> Attempting to insert data without defining that field indicates there is
>> not sufficient information to create a record. Setting that field to a zero
>> length string however indicates that there is enough information to create a
>> record. Assuming that no information is the same as an zero length string is
>> not OK.
>>
>> Call it bad design if you want, by MySQL knows the difference between NULL
>> and an empty string, so should my database abstraction layer.
>>
>>
> Even if the default is set to '' - pear mdb2 refuses to do the insert.
> So it looks like pear mdb2 does not know the difference between NULL and a
> zero length string.
>
> Hopefully that is configurable somewhere.
>
  

Re: [PHP] try - catch is not so clear to me...

2009-04-14 Thread Bastien Koert
On Mon, Apr 13, 2009 at 11:34 PM, Lamp Lists  wrote:

>
>
>
> 
> From: Marc Steinert 
> To: Lamp Lists 
> Cc: php-general@lists.php.net
> Sent: Monday, April 13, 2009 11:27:08 AM
> Subject: Re: [PHP] try - catch is not so clear to me...
>
> Basically try-catch gives you the ability to handle errors outside a class
> or method scope, by the calling instance.
> This comes in handy, if you are programming in an object orientated way and
> thus enables you to seperate error handling from the rest of your
> functionality.
> Means, your methods do only the things, they are meant to do, without
> bothering to handling occuring errors.
> Hope, that made things clearer.
>
> Greetings from Germany
>
> Marc
>
> Lamp Lists wrote:
>
> >>  hi to all!
> >>
> >> actually, the statement in the Subject line is not 100% correct. I
> understand the purpose and how it works (at least I think I understand :-))
> but to me it's so complicated way?
> >>
>
>
> -- http://bithub.net/
> Synchronize and share your files over the web for free
>
>
> My Twitter feed
> http://twitter.com/MarcSteinert
>
>
>
>
> Looks like I still didn't get it correctly:
>
> try
> {
>if (!send_confirmation_email($email, $subject, $content))
> {
>throw new Exception('Confirmation email is not sent');
>}
>
> }
> catch (Exception $e)
> {
> send_email_with_error_to_admin($e, $content);
> }
>
> why am I getting both emails? I'm receiving confirmation email and email
> with error message - that I'm supposed to get if the first one is not sent
> for some reason?!?!?!?
>
> thanks for any help.
>
> -LL
>
>
>


what does this function [send_confirmation_email($email, $subject,
$content)] return?

-- 

Bastien

Cat, the other other white meat


  1   2   3   4   5   6   >