Re: [PHP] limiting rows and pages like google

2001-09-13 Thread Julian Wood


It's not too hard to do the next/previous through all your results, as 
has been shown by several people. What is a little trickier, at least 
when using mysql and trying to take advantage of the limit clause, is 
how to display how many results you have (ie 1 to 10 of 107 results). If 
you use the limit, you can't get the total number of rows, without doing 
a second search sans limit. It's also harder to do the next link, 
because you don't necessarily know if there are any more rows (imagine 
you are displaying 10 rows at a time, you are on page 3 and there are 30 
total rows). Conversely, if you do a single query without the limit, 
then you're doing a slower search (limiting a search is way faster), and 
I'm not sure of the implications of the full result set residing 
serverside - maybe higher memory requirements. So what do people do to 
take advantage of limit? Two queries or a single query? Any other 
solutions? Any more insights on how limit works?

Julian

On Wednesday, September 12, 2001, at 10:16 PM, Adrian D'Costa wrote:

>
> Hi,
>
> I am trying to find out the the best way to do the following:
>
> I have a script that select records from a table.  The problem is that I
> need to limit the rows to 20. I know that I can use limit 20.  But 
> what I
> want to do is give the view a link to the next 20 till all the records 
> are
> shown.  What I don't know is how to maintain the search query and I want
> to use the same script.
>
> The logic would be to check if the script is called the first time, then
> the sql statement would be select travel.*, city.city from travel, city
> where travel.cityid=city.id limit 0,20.
> The second time or based on what has been selected on the page (1-20,
> 21-40, etc) add that to the sql statement.  My question is how?
>
> Can someone guide me or give me some example.
>
> TIA
>
> Adrian
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

--
Julian Wood

Programmer/Analyst
University of Calgary

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




Re: [PHP] Re: Data duplication in databases

2001-08-29 Thread Julian Wood

The only problem is detecting that the data is identical in the first 
place. If I have to do a select with 7 AND statements to see if I have 
identical data, I'm going to take a huge performance hit. I was hoping 
this had been done at a very low level, but it doesn't look like it. 
Maybe it's just as unrealistic at  a low level, but I could swear I had 
heard of this feature before.

Oh well.

J

PS. I didn't mention this before, but a link table (ie a relational 
structure) is not possible in my situation.

On Wednesday, August 29, 2001, at 01:47 PM, james wrote:

>
> Julian,
>
> I am not aware of any databases smart enough to decide to create 
> references
> for rows whose data is identical to an existing row.  If the duplicate 
> data
> is creating resource issues, there's a couple things that you can do to
> eliminate the duplicate data.  Probably the easiest would be, in the 
> case of
> varchar data, to add a column for a row number.  If the data to be 
> inserted
> is identical to data in a row that's already in the database, an encoded
> reference to the row number of the row with the original data could be
> stored.  That way, you're just storing the reference to the original 
> data.
>
> Example:
>
> RowNum ProdNum Revision Description_varchar
> 455333101
> XXXYYYXXXYYYXXXYYYXXXYYYZZZ
> 873245102   <<-455333->>
> 934532103   <<-455333->>
>
> If you don't want to do the encoding thing, you could create a "link" 
> table
> to accomplish the same thing.
>
> HTH,
> James Potts
>
>
> "Julian Wood" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>
>> Hi,
>>
>> Don't know if this is the best place to ask, but I thought I would give
>> it a try.
>>
>> I was just wondering if anyone knows of any databases which deal with
>> data duplication (at a low level). Say I have two (or ten) identical
>> records, does anyone know of any databases which would only keep one
>> copy of the data and use references for the other records? Does this
>> work if 7 out of the 8 columns (for instance) are identical (ie the
>> primary key is different but everything else is identical). Do such 
>> db's
>> exist? Or do they all do this? Or am I just dreaming?
>>
>> J
--
Julian Wood

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



[PHP] Data duplication in databases

2001-08-28 Thread Julian Wood


Hi,

Don't know if this is the best place to ask, but I thought I would give 
it a try.

I was just wondering if anyone knows of any databases which deal with 
data duplication (at a low level). Say I have two (or ten) identical 
records, does anyone know of any databases which would only keep one 
copy of the data and use references for the other records? Does this 
work if 7 out of the 8 columns (for instance) are identical (ie the 
primary key is different but everything else is identical). Do such db's 
exist? Or do they all do this? Or am I just dreaming?

J
--
Julian Wood

Programmer/Analyst
University of Calgary

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




Re: [PHP] Script timeout

2001-08-23 Thread Julian Wood


Well just to follow up, Apache was the culprit. There is an Apache 
timeout directive that was set to 300 s that I somehow missed  on my 
first glance.

The things that timeout, as far as I know, are PHP, Apache, and several 
commands within PHP (such as fsockopen()). The Apache directive is 
called Timeout, conveniently enough. It actually indicates the amount of 
time between successive TCP packet transmissions before a timeout 
occurs, which threw me for quite a loop. I could make a script which 
took 20 minutes to complete and get no timeouts anywhere, so I was 
convinced there was something wrong with my code. The difference was 
that this 20 min script outputted data along the way, so no timeouts 
ever occurred. The problem script didn't output anything until it was 
finished processing. Christian hit it on the nail. You can set the php 
timeout within the apache config file like so: php_value 
max_execution_time 120. This time is not real time, but the time the 
script actually gets access to cpu resources, or something like that. In 
my case, a setting of 30 was about 300 s.

I don't know if the browser itself will ever timeout as long as it makes 
the initial handshake.

J

On Thursday, August 23, 2001, at 09:43 AM, Johnson, Kirk wrote:

>
>> Why timeout at 300s instead of the 30s or the 12000s which
>>> are the only two values reported?
>>
>> Looks like some HTTP timeout, i.e. either Apache or the browser is
>> getting bored. Try outputting something from time to time.
>
> Can anybody point me to information on all the possible HTTP timeouts 
> there
> are (Apache, browser, ???), or care to discuss it here? We occasionally 
> see
> "timeouts" that are not due to PHP, and I'm wondering where they are 
> coming
> from.
>
> TIA
>
> Kirk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

--
Julian Wood

Programmer/Analyst
University of Calgary

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




[PHP] Script timeout

2001-08-22 Thread Julian Wood


I have a script which has to do a *lot* of work. In fact, it times out 
after 300 seconds, but is only about half done at that point. So I  
tried using set_time_limit(0) to no avail (php is *not* running in safe 
mode). So next I tried this directive in the apache config file: 
php_value max_execution_time 12000 (and various other values too). Now 
this changed the value of the constant correctly as reported by 
phpinfo(), but not as reported by get_cfg_var(max_execution_time), which 
still reported the default 30s. Empirically, the script would still time 
out at exactly 300 seconds, as before. So, any idea what is going on? 
Why timeout at 300s instead of the 30s or the 12000s which are the only 
two values reported? Any other workarounds? This is php 4.0

Thanks, J

--
Julian Wood

Programmer/Analyst
University of Calgary

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




Re: [PHP] assigning a part of the name of a variable with another variable before php replaces it with the value

2001-07-26 Thread Julian Wood


To answer your question:

$postfld = $HTTP_POST_VARS[$fname[$i]];

should work. BTW, I just use something like:

if ($client) { // or in your case: if (${$fname[$i]})
// code to be evaluated if $client exists and is not 0, not null/void/nil, and is
not an empty string
}

J

Matthew DeChant wrote:

> Specifically,
>
> If I have 3 HTTP_POST_VARS:
>
> HTTP_POST_VARS["client"] = test1
> HTTP_POST_VARS["directory"]= test2
> HTTP_POST_VARS["password"] =
>
> and I don't know the names of the vars ahead of time, how would I run a
> check to see if they exist and then get the specific POST_VARS's value. This
> is what I've got so far:
>
> $squery = "select * from $db where ";
> $qh = fw_query("select * from $db");
> $fields = odbc_num_fields($qh);
> for ($i=1;$i<=$fields;$i++) {
>   # assign $fname the possible field names in the database
> (client,directory,password)
> $fname[$i] = odbc_field_name($qh,$i);
>   # assign $postfld the variable name, ie. $HTTP_POST_VARS["client"]
> $postfld = $HTTP_POST_VARS["($fname[$i])"];
>   # check that it exists and is not blank
> if (isset($postfld) AND ($postfld != "")) {
> $value[$i] = $postfld;
> $squery.= "$fname[$i] like $value[$i] AND ";
> }
> }
> # pop last AND
> $squery= substr($squery, 0,-5);
>
> so how do you make this work:  $postfld = $HTTP_POST_VARS["($fname[$i])"];
>
> thanks,
>
> -m
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


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




Re: [PHP] Post a form within a running php-script

2001-07-10 Thread Julian Wood


A class which allows you to post from within a php script and retrieve 
the results:

http://px.sklar.com/code-pretty.html?code_id=313

Julian

On Sunday, July 8, 2001, at 11:22 PM, mike cullerton wrote:

>
> on 7/8/01 11:17 PM, Bob Horton at [EMAIL PROTECTED] wrote:
>
>> What if someone wanted to reply to a form but the form was expecting 
>> the
>> information to arrive using the POST method (and wasn't explicitly 
>> PHP)?
>>
>> Is there any way to do it if you want to submit to a POST method 
>> form?  Or
>> some way to simulate the entering of the information and clicking of 
>> the
>> submit button?
>>
>
> i'm not sure if this is what you are asking, but i can have an url like
> http://mysite.com/?submit=click_me&opt=my_option
>
> and refer to those inside my program as $submit and $opt
>
>
>  -- mike cullerton
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

--
Julian Wood

Multimedia developer
University of Calgary

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




Re: [PHP] Mac IE 5.0 upload problem

2001-05-18 Thread Julian Wood


I don't know what your problem might be, but there is nothing wrong with the
file upload on Mac IE5. We use it all the time, in connection with both perl
and php server-side and there is no problem. You do have to make sure the
file you upload is essentially flat (ie no resource fork, since that will be
stripped) but most file formats are flat these days anyway. I'm not sure
about Quark. IE 4.5 should *not* be uploading in MacBinary, so I guess
that's a bug they fixed for 5.0. See if you can upload a gif or a jpeg file
and retrieve it properly. There shouldn't be a problem.

Julian

on 5/18/01 6:57 PM, Jason Lam at [EMAIL PROTECTED] wrote:

> 
> Would any Mac expert help me out with this one.
> 
> I have created an upload script with works fine for PC file and Mac files
> with IE 4.5, but it just would not work with IE5.0
> 
> Whenever I upload file with IE 5.0, after it gets to the server, the size
> becomes smaller by few hundred bytes, this ruin the file. If I download the
> file to a mac again, it becomes a white icon and cannot be opened. The
> $file_type tells me that it is "application/octet-stream". But on the other
> hand, doing the same thing on IE 4.5 will make the filesize larger by a few
> hundred bytes when it arrive at the server (I think the resource fork is
> included) and the upload file type is "application/x-macbinary". Anyone know
> how come IE5.0 seems to lost those bytes? Is it losing the resource fork? Do
> I have any control over what the browser will upload? BTW, I was testing
> with some Quark Express file.
> 
> Any help is appreciated.
> 
> Jason Lam
> 
> 
> 

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] MySQL Query not working?

2001-05-15 Thread Julian Wood


You might also want to remove the comma after "url = '$url'" and try an echo
mysql_error($link) to see what the problem is.

Julian


on 5/14/01 5:46 PM, Peter Houchin - SunRentals Australia at
[EMAIL PROTECTED] wrote:

> change it to
> 
> $sql = "UPDATE CLASS_ADS
> SET client_id = '$client_id', date = '$date', category = '$category',
> title = '$title', description = '$description', contact_name =
> '$contact_name,  contact_number = '$contact_number', email =
> '$email',  url = '$url', WHERE client_id = '$client_id' ";
> 
> also if a MySQL query doesn't work I always try it on the command line :)
> 
> 
> Peter Houchin
> [EMAIL PROTECTED]
> =
>_  __   /\
>   /_/_/_\/  |_/  \
>  /_/_/___  __  __   __  / \
>  \_/_/_\  /_/ /_/ /_/  /_/  \   _ /
> ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/
> \_//_/_/ /_/_/_/ /_/ \/_/v
>   
>   /_/_/_/_/  /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>  /_/_ _/_/ __  __   __  /_/   __ __
> /_/_/_/_/ /_/_/_/ /_/  /_/ /_/ /_/\_\/_//_/_/_/
> /_/  \_\  /_/ _/  /_//\/_/ /_/ /_/__\_\  /_/___ _\_\_\
> /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/
> =
> Telephone : (03) 9329 1455  Facsimile : (03) 9329 6755
> * We rent the dot in .COM!  **
> 
> 
> -Original Message-
> From: Laurie Landry [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 15, 2001 9:23 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] MySQL Query not working?
> 
> 
> Hi, I've got this sql setup where
> 
> $sql = "UPDATE CLASS_ADS
> SET client_id = \"$client_id\", date = \"$date\", category = \"$category\",
> title = \"$title\", description = \"$description\", contact_name =
> \"$contact_name\",  contact_number = \"$contact_number\", email =
> \"$email\",  url = \"$url\", WHERE client_id = \"$client_id\" ";
> 
> and of course the following:
> 
>   $sql_result = mysql_query($sql)
>   or die("Couldn't execute query.");
> 
> which when I test the page, it tells me it couldn't execute the query.
> 
> I hope the information above is enough for someone to help me pinpoint where
> I went wrong.
> 
> (all the fields in the named table in the database is set accordingly with
> one thing: the client id number is autogenerated by the database, so I'm not
> sure if the client_id should be there.)
> 
> Thanks in advance:
> 
> Laurie M. Landry
>  Design & Development
> 
> www.lmlweb.com
> [EMAIL PROTECTED]
> 
> T: (604) 872-6915
> F: (425) 732-1547
> 


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




Re: [PHP] Handling Macintosh filenames in PHP

2001-04-19 Thread Julian Wood


On a Mac it is just diskname:folder1:folder2:blah.txt  The colon is the path
delimiter, and is the only illegal character in a mac path.

But I'm most curious as to why you would need this. Presumably you're
writing your client in a web browser? In that case you're never really
exposed to the peculiarities of the client filesystem. And if you're writing
a network client, this would be taken care of by the API.

Julian


on 4/19/01 7:52 PM, Shawn Reed at [EMAIL PROTECTED] wrote:

> 
> Greetings all,
> 
> I'm currently in the middle of developing a rather large piece of software
> written in PHP.  I'll spare you the details, but essentially it is a glorified
> FTP client.  The goal here, of course, is to develop a client that will work
> on any platform.  In theory, this SHOULD work, because PHP runs server-side,
> therefore eliminating any problems that would normally arise from differences
> between the various platforms.
> 
> However, it occurred to me that there isn't really a way (that I know of) to
> directly address a specific filename on a Macintosh as there is in other
> operating systems.  For example, in Windows I could type
> C:\WINDOWS\SYSTEM\BLAH.EXE or in Unix I could type /var/spool/mail/whatever
> ... but is there a way to do such a thing on a Mac?  Can you directly address
> a file several levels deep in the filesystem without using the MacOS interface
> itself to do so?  The project I'm doing relies on the ability to do just that,
> and it would appear that I've hit a bit of a snag.
> 
> If anyone can offer any suggestions or advice, I'd really appreciate it.
> Thanks in advance.

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Add data to three tables at once from one form

2001-04-19 Thread Julian Wood


> That's it.  There's nothing special to do.

Except if one insert fails and the others succeed, you run into a bit of
sync trouble. This is what transactions are for. You might want to consider
a BDB table type, which supports transactions, then you have the option to
rollback the other inserts if one of them fails.

Julian

on 4/18/01 6:33 PM, Steve Werby at [EMAIL PROTECTED] wrote:

> 
> "Fates" <[EMAIL PROTECTED]> wrote:
>> I know how to add data to one table but how do I add data to three
>> tables from one form?
>> 
>>  I want to do this with just one form and on one web page so it doesn't
>> post to another page.
>> 
>> How do I set up the insert statement?
>> 
>>$query = "INSERT INTO $table VALUES ('$menu_id', '$server',
>> '$menunumber', '$menuname')";
>> 
>>  $result = mysql_db_query($dbname, $query);
> 
> Add two more sets of statements like those you have for the first query.
> That's it.  There's nothing special to do.
> 
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
> 


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




[PHP] mySQL - select column

2001-04-17 Thread Julian Wood


Hi all,

Given that the resultset from a mysql query is a 2-d array (of sorts - I
don't know), if I retrieve only a single column, is there an easy way to
grab it as a linear array? For example - old way:

$uids=array();
$res = mysql_db_query("db", 'select uid from tbl;', $link);
while ($row = mysql_fetch_row($res)) {
array_push ($uids, $row[0]);
}

It seems a little redundant to make another array if one already exists. The
end idea is to get to a list of uids ($uid_str = join(',',$uids)) that can
be used in a second query to the db (to make up for the lack of subqueries
in mysql). I guess what I'm asking - can you do a join on the mysql
resultset array somehow. I know in the perl DBI you can get a column of
results, but can't find it in php.

Thx.

J

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Problems uploading Files

2001-03-22 Thread Julian Wood


Sebastian,

Apache is running as a user, usually nobody:nobody, or sometimes www:www.
That user is trying to move the file when you do the move in php. When you
login through an ftp client, a different user is doing the move (you). You
need to make sure that the user nobody has enough permissions on your target
directory to do the move. Depending on how locked down you want it, there
are several options: rwx for owner only, make the owner/group of the
directory nobody. rwx for group - change the directory's group to nobody, or
add nobody into another group (along with, for instance, yourself) and make
that directory belong to this new group. There are several more ways, but
you probably want to keep away from 777 permissions on the directory if
possible.

John - you want to do what Sebastian is doing. Check out Chapter 19.
Handling file uploads in the php manual. It has everything you need to get
going.

Julian


-- 
Julian Wood

Multimedia Developer
University of Calgary



on 3/22/01 11:28 AM, John Almberg at [EMAIL PROTECTED] wrote:

> 
> Hello Sebastian,
> 
> What a timely posting! I am trying to figure out how to allow a user (using
> any internet-connected pc) to upload a file to my PHP-enabled server. I am
> trying to use PHP and the FTP functions, but can't figure out how to address
> the file on the user's machine. Any hints from anyone as to how to do this?
> Or am I on the wrong track, altogether? Someone else suggested that I use an
> HTML 'upload', but I can't find anything about this in my HTML
> documentation.
> 
> Any help much appreciated!!!
> 
> John
> 
>> -Original Message-
>> From: Renzi, Sebastian [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, March 22, 2001 1:18 PM
>> To: PHP General List
>> Subject: [PHP] Problems uploading Files
>> 
>> 
>> Hello again ! , i have a script that uploads a file , when i use the
>> function move_uploaded_file() an error raises ,"Permission denied ."
>> ,but if i upload the same file thru an ftp client it works correctly !
>> 
>> 
>> Sebastián Renzi
>> Consultoría & Desarrollo de Sistemas.
>> CODES S.A
>> 
>> 


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




Re: [PHP] JDBC? Was: [PHP] Hello! PHP

2001-03-17 Thread Julian Wood


No - PHP has it's own drivers, just like perl has it's own (DBI), and java
has it's own (JDBC). As for PHP's abstraction layer, PHP comes built with
one for dbm style db's (http://www.php.net/manual/en/ref.dba.php), but not
for sql type db's. Several abstraction layer projects for sql db's have been
mentioned on the list - I have never used any of them - just the db-specific
API's. Try ADODB - there's a tutorial here:
http://php.weblogs.com/adodb_tutorial

J

on 3/17/01 1:10 PM, andrew at [EMAIL PROTECTED] wrote:

> 
> actually, just wondering if PHP can use JDBC drivers to connect to
> databases. what is the 'abstracted db layer' that you mention?
> 
> regards,
> andrew
> 
> 
> On 3/17/01 2:52 PM, "Julian Wood" <[EMAIL PROTECTED]> wrote:
> 
>> 
>> I'm not quite sure what you mean. You use a JDBC driver to connect your java
>> program to an sql db. PHP has an abstracted db layer which parallels the
>> function of JDBC for the php environment. PHP also has db-specific API's,
>> which tend to be somewhat faster and can take advantage of specific db
>> features. Does that help?
>> 
>> J
>> 
>> on 3/16/01 7:36 PM, andrew at [EMAIL PROTECTED] wrote:
>> 
>>> 
>>> On a related noted, does PHP have JDBC support?
>>> 
>>> I'm unable to find anything about this - anyone know if it's possible?
>>> 
>>> regards,
>>> andrew
>>> 
>>> 
>> --
>> Julian Wood
>> Learning Technologies and Digital Media
>> University of Calgary
>> 
>> 
> 
> 

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] JDBC? Was: [PHP] Hello! PHP

2001-03-17 Thread Julian Wood


I'm not quite sure what you mean. You use a JDBC driver to connect your java
program to an sql db. PHP has an abstracted db layer which parallels the
function of JDBC for the php environment. PHP also has db-specific API's,
which tend to be somewhat faster and can take advantage of specific db
features. Does that help?

J

on 3/16/01 7:36 PM, andrew at [EMAIL PROTECTED] wrote:

> 
> On a related noted, does PHP have JDBC support?
> 
> I'm unable to find anything about this - anyone know if it's possible?
> 
> regards,
> andrew
> 
> 
--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] MySQL problem - stumped

2001-03-10 Thread Julian Wood


Well, PHP seems to think that $link is not working, so your db_connect() is
in fact, the problem. You say you use db_connect several times in this
script without problem - why do you keep connecting to the same database
repeatedly in the same script - one connection will do for all your queries.

HTH,

Julian

on 3/10/01 12:11 PM, John Vanderbeck at [EMAIL PROTECTED] wrote:

> 
> 
> Ok,
> 
> Well I got 3 replies saying that my use of && is incorrect, and that I
> should use AND.  This confused me for 2 reasons. First, is that I use && in
> all my other SELECT queries, with no problems.  In fact, the MySQL docs,
> show the use of &&, not AND. Secondly, because if I had a bad query, it
> should have given me some sort of error when I output mysql_error(). No?
> 
> However, I did of course try changing it to AND instead of &&.  But the
> problem remains.  Same error.
> Any other ideas?
> 
> - John Vanderbeck
> - Admin, GameDesign
> 
>> -Original Message-
>> From: Rick St Jean [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, March 10, 2001 2:09 PM
>> To: PHP User Group
>> Subject: Re: [PHP] MySQL problem - stumped
>> 
>> 
>> At 01:58 PM 3/10/01 -0500, John Vanderbeck wrote:
>> 
>> 
>> You are using && in your statement ... should be "AND"
>> 
>> .
>> 
>> 
>>> The following code is giving an me problems, I can't figure it
>> out to save
>>> my soul.  The last line gives:
>>> 
>>> Here is the code:
>>> 
>>> $link = db_connect();
>>> $query = "UPDATE Users SET firstname='$firstname', lastname='$lastname'
>>> WHERE username='$user' && password='$password'";
>>> $result = mysql_query($query, $link);
>>> $err = mysql_error();
>>> echo "Errors:".$err;
>>> $rows = mysql_affected_rows($result);
>>> 
>>> And here is the output:
>>> Errors:
>>> Warning: Supplied argument is not a valid MySQL-Link resource in
>>> /****/*//**..***/db.php on line 147
>>> 
>>> Line 147, is the last line in the above snippet.  I cleared out the path
>>> name for security, no offense intended :)
>>> 
>>> Now, I KNOW that the db_connect() function is not the problem,
>> as I use it
>>> in many other places in this script with no errors.  What am I missing?
>>> 
>>> - John Vanderbeck
>>> - Admin, GameDesign
>>> 
>>> 

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Calling Perl from PHP -- Help --

2001-03-06 Thread Julian Wood


I think you're looking for passthru (or perhaps system or exec). If your php
is like this:



and hello.pl is like this:

#!/usr/bin/perl
print 'Args:'.join(' ', @ARGV);

Your web page will read:

Args:yay

You'll probably need to change the method of input (to use @ARGV instead of
<>) on your Porter stemmer program to make it work properly.

J

-- 
Julian Wood

Multimedia Developer
University of Calgary


on 3/5/01 11:53 PM, Matt Friedman at [EMAIL PROTECTED] wrote:

> I'm stumped. I've searched all over and can't figure this one out.
> 
> I have a perl script that waits for input on the command line. You type in a
> string and it returns a string.
> 
> I'd like to be able to this via php, since I can't rewrite the script in php,
> since it's a little over my head.
> 
> So, how do I open the perl script in php, send it some input and read the
> output?
> 
> Thanks,
> Matt.
> 


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




Re: [PHP] Is it odd or even??? Optimize!!!

2001-03-05 Thread Julian Wood


Clever. For those of us unfamiliar with bitwise ops, here's how this works:

The bitwise and op (&) works on bits like this:

dig1 dig2 Result
000
010
100
111

An even number's binary representation always ends with 0 (ie 12 = 1100)
while an odd ends with 1 (ie 13 = 1101).

So doing a bitwise & with 1 will only produce 1 if the last binary digit is
1 (ie an odd num), otherwise 0 (see table).

And, like Nathan implies, this will be very fast (way faster than modulus),
since you only ever deal with 2 bits of info.

For an explanation of other bitwise operators, look here:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/bitwise.html

J

on 3/5/01 12:36 PM, Nathan Cassano at [EMAIL PROTECTED] wrote:

> 
> You all are a bunch of un-optimizing novices. Just do some bit banging.
> 
> i.e.
> 
> if(1 & number){
> echo "$number is odd";
> }else{
> echo "$number is even";
> }
> 
> 
> -Original Message-
> From: Brandon Orther [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 05, 2001 12:18 PM
> To: PHP User Group
> Subject: [PHP] Is it odd or even???
> 
> 
> Hello,
> 
> Is there an easy way to check and see if a number is odd or even?
> 
> Thank you,
> 
> 
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> 
> 


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




Re: [PHP] Re : [PHP] NETSCAPE screws QUERY STRING

2001-03-04 Thread Julian Wood


Where is the string 'value+value2' coming from? $myrow[title]? If it is
coming from the db (I'm guessing - it seems a little strange to me that this
would be your title, but in this code we're discussing there is no other
possible source), and it has slashes in it, you may need to use stripslashes
to get rid of the slashes. Also, why are you using printf, but not
formatting your string at all? Why don't you just use echo? I assume we're
still dealing with this line of code:

printf("")

J

on 3/4/01 12:20 PM, Thomas Edison Jr. at [EMAIL PROTECTED] wrote:

> 
> Julian,
> 
> i tried this out  it's giving the single quotes in
> the value... 'value+value2'
> 
> and on the next page where i'm printing the
> value...the backslashes are also being added in front
> of single quotes :
> 
> \'value value2\'
> 
> where can i go from here? this has made the urlencode
> function to work...only part left now...
> 
> T. Edison jr.
> 
> --- Julian Wood <[EMAIL PROTECTED]> wrote:
>> 
>> Try  printf("> 
> href=\"pro_page1.php3?title='".urlencode($myrow[title])."'\">")
>> 
>> J
>> 
>> on 3/4/01 11:55 AM, Thomas Edison Jr. at
>> [EMAIL PROTECTED] wrote:
>> 
>>> 
>>> The urlencode() is working fine with an echo
>> statement
>>> & normal query string.
>>> 
>>> But it's NOT working with complex query string in
>>> printf() including $myrow[something] being picked
>> up
>>> by mySQL db. 
>>> 
>>> this works :
>>> 
>>> 
>>> 
>>> this doesn't work :
>>> 
>>> printf(">> 
>> 
> href=\"pro_page1.php3?title='urlencode($myrow[title])'\">")
>>> 
>>> OR such combinations as given in the manual. I
>> tried
>>> out almost all!!!
>>> 
>>> HELP
>>> 
>>> T. Edison jr.
>>> 
>> 
>> 
>> --
>> Julian Wood
>> Learning Technologies and Digital Media
>> University of Calgary
>> 
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail:
>> [EMAIL PROTECTED]
>> For additional commands, e-mail:
>> [EMAIL PROTECTED]
>> To contact the list administrators, e-mail:
>> [EMAIL PROTECTED]
>> 
> 
> 
> =
> Rahul S. Johari (Director)
> **
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> ***
> 
> __
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Re : [PHP] NETSCAPE screws QUERY STRING

2001-03-04 Thread Julian Wood


Try  printf("")

J

on 3/4/01 11:55 AM, Thomas Edison Jr. at [EMAIL PROTECTED] wrote:

> 
> The urlencode() is working fine with an echo statement
> & normal query string.
> 
> But it's NOT working with complex query string in
> printf() including $myrow[something] being picked up
> by mySQL db. 
> 
> this works :
> 
> 
> 
> this doesn't work :
> 
> printf(" href=\"pro_page1.php3?title='urlencode($myrow[title])'\">")
> 
> OR such combinations as given in the manual. I tried
> out almost all!!!
> 
> HELP
> 
> T. Edison jr.
> 


--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Odd PHP/MySQL Question

2001-03-01 Thread Julian Wood


select count(*), year from students group by year;

on 3/1/01 12:07 PM, Kath at [EMAIL PROTECTED] wrote:

> I have a user database where a year has to be put in.
> 
> Now, I want to compile a list of each different year and how many users are in
> that year.
> 
> Is there a way to do this beyond coding for each year:
> 
> SELECT * FROM students WHERE year = '1983' ?
> 
> - Kath
> 


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




Re: [PHP] big database with php ?

2001-03-01 Thread Julian Wood


Definitely something wrong with your setup, if a query takes as long as 2
hours. I could see maybe 2 seconds to return all 31000 rows, but why would
you ever need all 31000 rows? Put a limit on it to say 20 or 30 and you'll
get fast performance. If your columns are indexed, the order by won't take
as long as you indicate.

As for joins, mysql is very fast in my experience. Take this for instance,
operating on several tables with about 2 rows:

select a.description as project, b.phase, c.worktype, d.description,
d.regular, d.ot, d.uid, d.sync, d.ot15, d.ot2, d.project_id, d.phase_id,
d.worktype_id, DATE_FORMAT(d.date, '%a, %b %d, %Y') as date from project a,
phase b, worktype c, hours d where week(d.date) = week('2001-02-03') and
year(d.date) = year('2001-02-03') and d.project_id = a.code and d.phase_id =
b.code and d.worktype_id = c.code and d.personnel_id = 1139 order by d.date
asc;

22 rows in set (0.07 sec)

A count for 1 col on the same table takes 0.01 seconds. This is on a slower
machine than yours - but for the join it's only returning the important
rows. I think that might be where you're interpreting the slow performance,
unless you're missing indexes on the pertinent joins.

Julian


-- 
Julian Wood

Multimedia Developer
University of Calgary



on 3/1/01 6:52 AM, Chris Lee at [EMAIL PROTECTED] wrote:

> on a 45mb table with 31,470 rows mysql takes this long.
> 
> mysql> SELECT stockno from products;
> ...
> 31470 rows in set (2.34 sec)
> mysql>
> 
> not exactly great performance, if I put two 'LIKE' statments and an 'ORDER BY'
> clause then we're at 8 sec
> 
> this is on a PII500 512mb ram linux.mysql 3.23.28 this is not a lightning fast
> server, but I am not impressed with mysql speed. if you ever have todo any
> table joins I would highly recommend against mysql
> 
> people has 161 rows.
> products has 31,470 rows
> 
> select count(stockno), count(customernum) from products, people;
> ...
> 1 row in set (12.34 sec)
> mysql>
> 
> try adding a third table, oi. or a fouth, I timedout at nearly 2 hours with
> four tables. postgres (7.1beta) could do the same four tables in less then
> 0.9sec.
> 
> I use mysql because I use mysql. I would like to use postgres but everyone
> seems to use mysql and clients know the name. they request it. I hear problems
> about un-stability of 7.0 on phpbuilder.com, are they warented? I am
> interested in hearing strong customer testomonials for postgres or against it.
> I have little info other then a few benchamrks I ran myself.
> 


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




Re: [PHP] PHP trace route?

2001-02-26 Thread Julian Wood


Use passthru to run traceroute on the ip of interest, then output the
results of that command, line by line, starting with the last line.

J

on 2/26/01 9:48 AM, Brandon Orther at [EMAIL PROTECTED] wrote:

> 
> Hello,
> 
> I am looking for a php trace route that I can have get the IP of the person
> browsing the site and do a trace route from the server.  Then I want to
> reverse the results so It looks like they are doing a trace route on the
> server rather than the server doing a trace route on them.
> 
> Thank you,
> 
> 
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------
> 

-- 
Julian Wood

Multimedia Developer
University of Calgary


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




Re: [PHP] HTTP POST Question

2001-02-20 Thread Julian Wood


Hmmm, I'm sorry - I didn't see any mention of flash in this thread. That is
a completely different story from what has been talked about so far.

What do you mean you can't write the unlink code? You mean you want to
delete a file somewhere from flash? That shouldn't be a problem - post from
flash to a php script - the script can do the unlink (make sure you have
correct permissions and *build* the correct path), then return a result code
back to flash. Not sure if I'm on target for your question or not.

HTH,

J
-- 
Julian Wood

Multimedia Developer
University of Calgary


on 2/20/01 9:46 AM, Jan Grafström at [EMAIL PROTECTED] wrote:

> 
> Thankyou Julian but I am posting my variable from flash5.
> The posting is not my problem. I just can`t write the unlink code.
> 
> Julian Wood wrote:
> 
>> Check out http://px.sklar.com/code-pretty.html?code_id=313
>> 
>> It is a post class written by Alan van den Bosch which will do what you want
>> (post to a perl script, retrieve the results, and let you manipulate them
>> from within the posting php script). Here's some code using this class. I've
>> simplified this so it is untested in its current state, but should work.
>> I've used this class in many projects and it works very well.
>> 
>> > 
>> include("post.php");
>> 
>> $a=new http_post;
>> 
>> #where do you want to post today
>> $a->set_action("http://$SERVER_ADDR/cgi-bin/hello.pl");
>> 
>> # add some post arguments
>> $a->set_element('foo','bar');
>> 
>> #do the post
>> $res = $a->send();
>> 
>> #strip header
>> $res = strstr($res, "\r\n\r\n");
>> 
>> #display the results
>> echo $res;
>> 
>> ?>
>> 
>> HTH,
>> 
>> J
>> 
>> --
>> Julian Wood
>> 
>> Multimedia Developer
>> University of Calgary
>> 
>> on 2/19/01 10:15 AM, John Monfort at [EMAIL PROTECTED] wrote:
>> 
>>> 
>>> 
>>> 
>>>> 1. It appears if I use the header function I have to redirect the page to
>>>> another page, it doesn't appear possible to retrieve a page into the
>>>> current
>>>> page?  Unless someone can show me some code that would do that.
>>>> 
>>> 
>>> If all you want is to display the remote page, within the local page,
>>> then all you need is fpassthru()
>>> 
>>> ex.
>>> 
>>> $server = "http://www.site.com";
>>> 
>>> $fp = fopen($server,"r")// "r" is for reading
>>> fpassthru($fp);
>>> 
>>> This will display the results of the remote file (html or whatever) into
>>> the local file (in this case, your PHP file).
>>> 
>>> 
>>>> 
>>>> 
>>>>> -Original Message-
>>>>> From:Milan Mlynarcik [SMTP:[EMAIL PROTECTED]]
>>>>> Sent:Monday, February 19, 2001 7:33 AM
>>>>> To:Montgomery-Recht, Evan
>>>>> Subject:Re: [PHP] HTTP POST Question
>>>>> 
>>>>> You have to use header() function and how POST work you can find in HTTP
>>>>> RFC
>>>>> at http://www.w3.org/Protocols/rfc2616/rfc2616.html
>>>>> -
>>>>> Milan Mlynarcik
>>>>> Web Programmer
>>>>> Charmed Technology Slovakia
>>>>> Nam. sv. Egidia 16/37
>>>>> 058 01 Poprad, Slovakia
>>>>> E-mail: [EMAIL PROTECTED]
>>>>> Office: 00421 92 7881 874
>>>>> Mobile: 00421 905 964 535
>>>>> Web page: http://www.charmed.com/
>>>>> -
>>>>> - Original Message -
>>>>> From: "Montgomery-Recht, Evan" <[EMAIL PROTECTED]>
>>>>> To: <[EMAIL PROTECTED]>
>>>>> Sent: Monday, February 19, 2001 1:06 PM
>>>>> Subject: [PHP] HTTP POST Question
>>>>> 
>>>>> 
>>>>>> Good morning...
>>>>>> 
>>>>>> This should be a good monday morning question.
>>>>>> 
>>>>>> I have a cgi-bin written in perl (it's actually, a interface to a
>>>>>> perl-module which is a interface to a telnet-like protocol).
>>>>>> 
>>>>>> Anyways what I need to do is I have already existing code

Re: [PHP] HTTP POST Question

2001-02-20 Thread Julian Wood


Check out http://px.sklar.com/code-pretty.html?code_id=313

It is a post class written by Alan van den Bosch which will do what you want
(post to a perl script, retrieve the results, and let you manipulate them
from within the posting php script). Here's some code using this class. I've
simplified this so it is untested in its current state, but should work.
I've used this class in many projects and it works very well.

set_action("http://$SERVER_ADDR/cgi-bin/hello.pl");

# add some post arguments
$a->set_element('foo','bar');

#do the post
$res = $a->send();

#strip header
$res = strstr($res, "\r\n\r\n");

#display the results
echo $res;

?>


HTH,

J

-- 
Julian Wood

Multimedia Developer
University of Calgary



on 2/19/01 10:15 AM, John Monfort at [EMAIL PROTECTED] wrote:

> 
> 
> 
>> 1. It appears if I use the header function I have to redirect the page to
>> another page, it doesn't appear possible to retrieve a page into the current
>> page?  Unless someone can show me some code that would do that.
>> 
> 
> If all you want is to display the remote page, within the local page,
> then all you need is fpassthru()
> 
> ex.
> 
> $server = "http://www.site.com";
> 
> $fp = fopen($server,"r")// "r" is for reading
> fpassthru($fp);
> 
> This will display the results of the remote file (html or whatever) into
> the local file (in this case, your PHP file).
> 
> 
>> 
>> 
>>> -Original Message-
>>> From:Milan Mlynarcik [SMTP:[EMAIL PROTECTED]]
>>> Sent:Monday, February 19, 2001 7:33 AM
>>> To:Montgomery-Recht, Evan
>>> Subject:Re: [PHP] HTTP POST Question
>>> 
>>> You have to use header() function and how POST work you can find in HTTP
>>> RFC
>>> at http://www.w3.org/Protocols/rfc2616/rfc2616.html
>>> -
>>> Milan Mlynarcik
>>> Web Programmer
>>> Charmed Technology Slovakia
>>> Nam. sv. Egidia 16/37
>>> 058 01 Poprad, Slovakia
>>> E-mail: [EMAIL PROTECTED]
>>> Office: 00421 92 7881 874
>>> Mobile: 00421 905 964 535
>>> Web page: http://www.charmed.com/
>>> -
>>> - Original Message -
>>> From: "Montgomery-Recht, Evan" <[EMAIL PROTECTED]>
>>> To: <[EMAIL PROTECTED]>
>>> Sent: Monday, February 19, 2001 1:06 PM
>>> Subject: [PHP] HTTP POST Question
>>> 
>>> 
>>>> Good morning...
>>>> 
>>>> This should be a good monday morning question.
>>>> 
>>>> I have a cgi-bin written in perl (it's actually, a interface to a
>>>> perl-module which is a interface to a telnet-like protocol).
>>>> 
>>>> Anyways what I need to do is I have already existing code written in
>>> PHP,
>>>> but at some point I need to call this cgi-bin and get a return code from
>>> it
>>>> and process (good/bad result) and return to completed php script that
>>> says
>>>> it called this cgi-bin.  It's not very clear how to set the
>>> HTTP_POST_VARS
>>>> for sending to a post command (which doesn't seem to exist);
>>>> 
>>>> Any ideas I don't see a function called:
>>>> 
>>>> $HTTP_POST_VARS =set variables;
>>>> $result = http_post("http://localhost/cgi-bin/script.pl");
>>>> 
>>>> Thanks,
>>>> 
>>>> evan
>>>> 
>>>> PS.  I'd appricate a working example, even if it's a dummy version.
>>>> 
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 


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




Re: [PHP] PHP Editors

2001-02-16 Thread Julian Wood


>From Allaire's (Homesite) web page:

"When InternetWorld surveyed 136 professional design firms (iXL, USWeb,
Modem Media, TVisions, Organic Online, etc.) in October 1999, HomeSite was
the most popular HTML tool:

Allaire HomeSite - 52.9%
Bare Bones BBEdit (Mac) - 42.6%
Microsoft FrontPage - 22.8%
Microsoft Visual InterDev - 19.1%
Sausage Software HotDog - 4.4%"


Granted this is over 1 year ago, and probably not the most scientific of
polls, how does BBEdit garner 42.6% of the share when the Mac has only a
3-5% share of the worldwide computer market?

J


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




Re: [PHP] Need to count number of rows per id! :(

2001-02-02 Thread Julian Wood


Are you looking for select topicID, count(*) from $secondtable group by
topicID? This will give you a count of each distinct topicID in
$secondtable.

Julian


-- 
Julian Wood

Multimedia Developer
University of Calgary




on 2/2/01 6:15 PM, Sandeep Hundal at [EMAIL PROTECTED] wrote:

> 
> Hey guys,
> 
> I need an answer to a problem I've been trying to work on for days :(
> 
> I made a message board, which has a front page which lists Topic
> name, topic started by, and what date. All this info, and the topic
> message is stored in one mysql table. when you click on any of the
> topics, it leads to a page which lists all replies to that topic by
> topic_id.
> 
> Now what I want to do is have a listen on the first index page, the
> number of replies for that particular topic. I know I need something
> like select id from $secondtable where topicid=$topicid, and then use
> mysql_num_rows, but I can't figure out how to integrate the first set
> of results from table 1 with the query on table 2.
> 
> This is the query on the front page on the main table :
> $query = "SELECT topicid, icon, name, topic, datestamp FROM
> $maintable ORDER by datestamp DESC LIMIT 40 ";
> $result = mysql_query($query);
> 
> TIA!
> 
> Sandeep
> 
> __
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/




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




Re: [PHP] Problem with a regex!

2001-01-27 Thread Julian Wood


Maybe I'm misunderstanding something. I'm suggesting that you not bother at
all with an ereg_replace system.

If you want to do a system like you're suggesting, you would use a variable
variable. That is, ${$var} will evaluate to 'Hello' when $var = 'title' and
$title = 'Hello'.

HTH,

Julian


on 1/27/01 6:56 PM, Zack Ham at [EMAIL PROTECTED] wrote:

> 
> I had it echo off the value of $var right before it ran the ereg_replace and
> it echoed "TITLE".  So there is a value... any ideas on fixing?
> 
> --- Julian Wood <[EMAIL PROTECTED]>
>> wrote:
>> 
>> Why not use the php mechanism itself? An easy way to do a template system is
>> make a normal php page as a template, and then include it from another page
>> after specifying a bunch of variables.
>> 
>> eg.
>> 
>> template.php:
>> =
>> 
>> 
>> 
>> calling page:
>> =
>> 
>> > 
>> $title = "My template system";
>> include ('template.php');
>> 
>> ?>
>> 
>> Hope this helps,
>> 
>> Julian
>> 
>> on 1/27/01 6:17 PM, Zack Ham at [EMAIL PROTECTED] wrote:
>> 
>>> 
>>> I'm trying to create a small template parser so I can fill my html pages up
>>> with data.  An example:  {title}>> 
>>> What I'm trying to do is run through it and replace {title} with an
>>> appropriate value.  I have tried running
>>> ereg_replace("{$var}",$value,$string)
>>> and ereg_replace("\{$var\}",$value,$string).  Neither work.  They either do
>>> nothing or produce the error "Warning: invalid content of \{\}".
>>> 
>>> Any help would be appreciated,
>>> Zack
>>> 
>>> _
>>> Free email provided by ---> http://sect0r.com
>> 
>> --
>> Julian Wood
>> Learning Technologies and Digital Media
>> University of Calgary
>> 
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> _
> Free email provided by ---> http://sect0r.com

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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




Re: [PHP] Problem with a regex!

2001-01-27 Thread Julian Wood


Why not use the php mechanism itself? An easy way to do a template system is
make a normal php page as a template, and then include it from another page
after specifying a bunch of variables.

eg.

template.php:
=



calling page:
=



Hope this helps,

Julian

on 1/27/01 6:17 PM, Zack Ham at [EMAIL PROTECTED] wrote:

> 
> I'm trying to create a small template parser so I can fill my html pages up
> with data.  An example:  {title} 
> What I'm trying to do is run through it and replace {title} with an
> appropriate value.  I have tried running ereg_replace("{$var}",$value,$string)
> and ereg_replace("\{$var\}",$value,$string).  Neither work.  They either do
> nothing or produce the error "Warning: invalid content of \{\}".
> 
> Any help would be appreciated,
> Zack
> 
> _____
> Free email provided by ---> http://sect0r.com

--
Julian Wood
Learning Technologies and Digital Media
University of Calgary



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