php-general Digest 11 Apr 2005 02:12:32 -0000 Issue 3390
Topics (messages 212762 through 212772):
loading data from database
212762 by: Micha Biegnolé
212765 by: Satyam
Re: Limiting Cpu usage
212763 by: Philip Hallstrom
212764 by: zini10
php and javascript
212766 by: PartyPosters
212767 by: Marek Kilimajer
Re: [PHP-I18N] Multilingual Web application - how to?
212768 by: Ligaya Turmelle
212770 by: php.electroteque.org
class calling script
212769 by: php.electroteque.org
Split command problem
212771 by: Russ
Re: Question about fsockopen
212772 by: php.warningnews.com
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi, I am a student of multimedia design.
I have two tables in a database with one same column(column:Name).
I ask data from table1 collumn:Name. In table2 I want to use the return of
data from table1 and search table2 collumn:Name for other information. I
tried joined SELECT, but it didn't work with me.
I hope someone understands what I mean, my english is not so great.
select data from table1.
SELECT name FROM table1 WHERE movies='yes'
Then I want to select from table2 using the result of select from table1.
SELECT * WHERE..?
Thank you!
--- End Message ---
--- Begin Message ---
You probably mean to make a joined query:
Select * from table1 inner join table2 on table1.name = table2.name where
movies = yes
Notice that the join clause has a few options, the most important you might
have to consider is the 'left join' or 'right join' which allows you to
still see the records of one table even if there is no corresponding record
on the other table.
Satyam
"Micha Biegnolé" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I am a student of multimedia design.
>
> I have two tables in a database with one same column(column:Name).
> I ask data from table1 collumn:Name. In table2 I want to use the return of
> data from table1 and search table2 collumn:Name for other information. I
> tried joined SELECT, but it didn't work with me.
>
> I hope someone understands what I mean, my english is not so great.
>
> select data from table1.
> SELECT name FROM table1 WHERE movies='yes'
>
> Then I want to select from table2 using the result of select from table1.
>
> SELECT * WHERE..?
>
> Thank you!
--- End Message ---
--- Begin Message ---
You might want to rethink your strategy. Consider the instance in which
only *one* person is hitting your server. That one person *will* get 100%
of your CPU since nothing else is going on at the time, so the system
might as well give them all the CPU to get their task done sooner.
You don't want to restrict them in that case do you?
Maybe look into bandwidth limiting, connection limiting, php per script
memory usage, and php timeout options...
Good luck!
On Sun, 10 Apr 2005, zini10 wrote:
hello, how can i limit cpu usage for shared hosting enviroment?
i mean , im hosting serveal sites and wish for all php scripts to have (for
example) no more than 5% of cpu usage so no one can bomb my server.
im currently using php as a module , i know i can do it if ill use php as a
cgi and limit apache with cpu usage , but wont it decrease dramtically my
preformance?
thanks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Thought about that, but its a free host that will host many many users.ill
prefer them to have low cpu usage limit also if the system is free of tasks
as that will never happen.
any user can come, prepare a script which will do a infinite loop and will
make the server slow for all other users.
thought about timeouts but the user can refresh and refresh the page for
ever.
the only idea other than limit cpu usage is to check for users which use to
much cpu power for too long, and block them for running any script at all,
but an "Evil" user can signup many many times.
--- End Message ---
--- Begin Message ---
Hello, I have a form that when I hit sumbit I want to test the varialble in
javascript. I can get it working using test variables in php but I want to be
able to call the input box in my form, the only problem is the name of the box
is in an array (i think) as it's in a list. You can see the 2 samples of the
code below which will hopefully make more sence.
Can anyone help me out?
Thanks.
<head>
<SCRIPT language=JavaScript>
function checkdata() {
alert(document.Selection.quantity[0].value)
alert("TEST")
return true
}
</SCRIPT>
</head>
---------------------------------------------------------------
while ($row=mysql_fetch_array($mysql_result))
{
echo "<TR>
<INPUT NAME = \"distID[]\" TYPE = \"HIDDEN\" VALUE=\"$distID\">
</TR>";
}
--- End Message ---
--- Begin Message ---
PartyPosters wrote:
Hello, I have a form that when I hit sumbit I want to test the varialble in
javascript. I can get it working using test variables in php but I want to be
able to call the input box in my form, the only problem is the name of the box
is in an array (i think) as it's in a list. You can see the 2 samples of the
code below which will hopefully make more sence.
Can anyone help me out?
Thanks.
<head>
<SCRIPT language=JavaScript>
function checkdata() {
alert(document.Selection.quantity[0].value)
alert("TEST")
return true
}
</SCRIPT>
</head>
---------------------------------------------------------------
while ($row=mysql_fetch_array($mysql_result))
{
echo "<TR>
<INPUT NAME = \"distID[]\" TYPE = \"HIDDEN\" VALUE=\"$distID\">
</TR>";
}
Assuming your form is named "Selection", you will have a javascript
array document.forms['Selection'].elements['distID[]'] available. You
can try:
alert(document.forms['Selection'].elements['distID[]'][0].value);
--- End Message ---
--- Begin Message ---
I am currently am using the IntSmarty extension to Smarty (you can get
it and more information at
http://www.coggeshall.org/oss/intsmarty/index.php/7/). With it the
translation(s) is stored as a flat file rather then a DB so it is easy
to pass along to the translators and load. I personally find it simple
to use and if the page is in the utf8 character set, capable of any
language (I have English and 2 Asian Languages). As for the current
language variable - it automagically loads the browsers current language
from the preferences. Let me know if you would be interested in it (I
have a _slightly_ hacked version to work with the utf8 character set
rather then the latin character sets).
other options I know of - gettext, PEAR has a couple of classes for
translations, and I also believe that there are a couple of classes at
phpclasses.org.
Denis Gerasimov wrote:
Hello list,
I need to develop a multilingual web site and I am looking for the best way
of handling this task. There are three main issues I know:
1. Storing multilingual data in a database. Possible solutions I know:
a. many tables, one per each supported language, e.g. news_en, news_de.
b. one table having many columns with translations, e.g. (id, date, text_en,
text_de)
We use MySQL 4.1 as a back-end.
2. Multilingual HTML templates, possible solutions:
a. one generic template for everything, one per each language, like
contents_en.tpl.html, contents_de.tpl.html
b. many localized templates for each page, e.g news_en.tpl.html,
news_de.tpl.html
Template engine is Smarty.
3. Storing current language variable, possible solutions:
a. inside the URL like /en/news/
b. using cookies
c. using sessions
Web server is Apache2+mod_rewrite with PHP5
What are pros and cons for each solution? What are other possible solutions
for the above issues?
Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru
--
Respectfully,
Ligaya Turmelle
"Life is a game.... so have fun"
--- End Message ---
--- Begin Message ---
> Web server is Apache2+mod_rewrite with PHP5
How is this working for you ? I think there is alot of anticipation to get
this combo working ok withthreading :)
--- End Message ---
--- Begin Message ---
Hi there, I have been testing a possible solution to reduce the ammount of
interface calling scriptsto my class files. Currently each class has a calling
script. I am
thinking of setting up a url like /currentdir/packagename/classname, mind you
this is only a test but is it a
good or bad bad idea ?I have run into troubles getting get queries because its
calling the
classname in the query alreadyso /packagename/classname?test=1 doesnt work.
I have also found that the javascript and stylesheets loaded as
stylesheet/styler.css and javascript/some.js dont load because of the extra
path in the name :| Is this
efficient enough to work or isthere similar systems doing this around the place
?
maps to a script
testcall.php?packagename/classname
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([/A-Za-z0-9_]*)?([A-Za-z0-9_]+)$
RewriteRule ^(.+) testcall.php?$1 [L]
the script then loads the file like
$arr = preg_split("/\?/",$_SERVER['REQUEST_URI']);
$key = array_keys($_GET);
$arr = preg_split('/\\//',$key[0]);
$package = ucfirst($arr[0]);
$class = ucfirst($arr[1]);
$filename = $package.'/'.$class.'.php';
$constructor = $package.'_'.$class;
require_once ''.$filename.'';
new $constructor;
--- End Message ---
--- Begin Message ---
I have been trying to get the following code working. I keep getting an error
on line nine. It looks simular to the example in the PHP online manual. If I
substitute a print command for line nine I get the correct information from
$_POST[username]. I must be missing or have an extra a quote but I cannot
figure out where.
<?php
//check for required fields from the form
if ((!$_POST[username]) || (!$_POST[password])) {
header("Location: memberlogin15.7.php");
exit;
}
if(preg_match("/[A-Z]/", substr("$_POST[username]", 0, 1)))
{
name($fname, $lname) = split('[/\s+/]', "$_POST[username]");
//echo "First Name: $fname; Last Name: $lname\n;
echo "first letter is uppercase";
}
else
{
echo "first letter is not uppercase";
}
Any help will be appreciated.
--
Russ
--- End Message ---
--- Begin Message ---
Dear lists,
I have tested it but it's not what I want to do. I am looking for any
method to make multi connection with many ip from my box to download email
from different mailserver.
Thank you
David T
> [EMAIL PROTECTED] wrote:
>
>>Dear list,
>>
>>I have several IP in one interface (eth0) in my server and I want make
>>connection to another server (check email, etc) using different ip for
>>every mail server. I was read the document, and there is no way how to
>>make this happen. Any idea?
>>
>>
>>Thank you
>>
>>
>>
> Take a look here : http://sourceforge.net/projects/snoopy/ , I'm not
> much sure but I think that it has that feature.
>
> --
> Josip Dzolonga
> http://josip.dotgeek.org
>
> jdzolonga[at]gmail.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---