|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 13 Aug 2005 11:18:16 -0000 Issue 3622
php-general-digest-help
lists.php.net
Date: Sat Aug 13 2005 - 06:18:16 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 13 Aug 2005 11:18:16 -0000 Issue 3622
Topics (messages 220530 through 220549):
Migrating to PHP 5 - Cannot Load mySQL
220530 by: Bagus Nugroho
one more mysql question
220531 by: afan.afan.net
220533 by: Philip Hallstrom
220535 by: afan.afan.net
220537 by: John Nichel
220538 by: afan.afan.net
220539 by: afan.afan.net
220540 by: Sebastian
220541 by: Sebastian
220546 by: John Nichel
Re: PHP & smarty - nested queries and arrays
220532 by: Daevid Vincent
Re: frame help!
220534 by: George B
header redirect not working
220536 by: Pablo Gosse
220542 by: Jasper Bryant-Greene
220544 by: Chris Shiflett
ALLOW FILE UPLOADS...?
220543 by: z a p a n
Help Building Dynamic Checkboxes
220545 by: zedleon
Mail-id validation script
220547 by: Nahalingam Kanakavel
220548 by: Jasper Bryant-Greene
curl?
220549 by: Wong HoWang
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hello,
I have problem 'cannot load mysql' with MySQL on PHP5( recently migrating grom PHP4 to PHP5).
I was do the following actions to resolve the problem, but failed .
1. uncommented > extension=php_mysql.dll
2. put php_mysql.dll on c:/php/ext
3. put libmysql.dll both on c:/winnt and c:/winnt/system32 (Windows 2000)
4. edit > extension_dir = "c:/php/ext"
5. restart apache server(2.0).
Any missing of my act?
Thanks in advance
Rgds
attached mail follows:
I apology for mysql question posted here, but, as I said once, I like
you guys more! :)
have two tables: orders and special_orders. foreign key is trans_no.
I can't figure it out how to create a query that pulls orders from the
"orders" tables that are NOT in "special_orders" table?
Thanks for any help.
-afan
attached mail follows:
> I apology for mysql question posted here, but, as I said once, I like you
> guys more! :)
>
> have two tables: orders and special_orders. foreign key is trans_no.
> I can't figure it out how to create a query that pulls orders from the
> "orders" tables that are NOT in "special_orders" table?
I can never remember the syntax, but you want to LEFT JOIN the tables and
then only return rows where the resulting special_orders column is NULL.
something like this (most likely wrong syntax):
SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders s ON
o.trans_no = s.trans_no WHERE s.trans_no IS NULL
But that should get you started...
-philip
attached mail follows:
I tried this one:
SELECT trans_no
FROM orders
WHERE trans_no IN (
SELECT trans_no
FROM special_orders )
but gives me an error:
You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near 'SELECT
trans_no FROM special_orders )' at line 5
???
Philip Hallstrom wrote:
>> I apology for mysql question posted here, but, as I said once, I like
>> you guys more! :)
>>
>> have two tables: orders and special_orders. foreign key is trans_no.
>> I can't figure it out how to create a query that pulls orders from
>> the "orders" tables that are NOT in "special_orders" table?
>
>
> I can never remember the syntax, but you want to LEFT JOIN the tables
> and then only return rows where the resulting special_orders column is
> NULL.
>
> something like this (most likely wrong syntax):
>
> SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders s
> ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL
>
> But that should get you started...
>
> -philip
>
>
>
attached mail follows:
afan
afan.net wrote:
> I apology for mysql question posted here, but, as I said once, I like
> you guys more! :)
I like my wife more than I like the people on these lists, but I don't
go asking her my MySQL questions. I go to the MySQL list for that.
What you like doesn't make your post any less off topic, or any less
against netiquitte. To me, it's even a bigger offense than the newbie
wo doesn't know any better...you know you're question is off topic, and
yet you ask anyway...numerous times.
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
attached mail follows:
don't get this one:
from mysql.com:
SELECT s1 FROM t1 WHERE s1 NOT IN (SELECT s1 FROM t2);
my query:
select trans_no from orders where trans_no not in (select trans_no from
special_orders);
and I'm getting an error:
You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near 'select
trans_to from printed_orders)' at line 1
Syntax error?
???
-afan
afan
afan.net wrote:
> I tried this one:
> SELECT trans_no
> FROM orders
> WHERE trans_no IN (
> SELECT trans_no
> FROM special_orders )
>
> but gives me an error:
> You have an error in your SQL syntax. Check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'SELECT trans_no FROM special_orders )' at line 5
>
> ???
>
>
> Philip Hallstrom wrote:
>
>>> I apology for mysql question posted here, but, as I said once, I
>>> like you guys more! :)
>>>
>>> have two tables: orders and special_orders. foreign key is trans_no.
>>> I can't figure it out how to create a query that pulls orders from
>>> the "orders" tables that are NOT in "special_orders" table?
>>
>>
>>
>> I can never remember the syntax, but you want to LEFT JOIN the tables
>> and then only return rows where the resulting special_orders column
>> is NULL.
>>
>> something like this (most likely wrong syntax):
>>
>> SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders
>> s ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL
>>
>> But that should get you started...
>>
>> -philip
>>
>>
>>
>
attached mail follows:
ok. accept critique. :(
moderator: please take my mysql questions off the php list.
I apology to everybody for any inconviniance.
-afan
John Nichel wrote:
> afan
afan.net wrote:
>
>> I apology for mysql question posted here, but, as I said once, I like
>> you guys more! :)
>
>
> I like my wife more than I like the people on these lists, but I don't
> go asking her my MySQL questions. I go to the MySQL list for that.
> What you like doesn't make your post any less off topic, or any less
> against netiquitte. To me, it's even a bigger offense than the newbie
> wo doesn't know any better...you know you're question is off topic,
> and yet you ask anyway...numerous times.
>
attached mail follows:
afan
afan.net wrote:
> I tried this one:
> SELECT trans_no
> FROM orders
> WHERE trans_no IN (
> SELECT trans_no
> FROM special_orders )
>
> but gives me an error:
> You have an error in your SQL syntax. Check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'SELECT trans_no FROM special_orders )' at line 5
>
> ???
>
>
> Philip Hallstrom wrote:
>
>>> I apology for mysql question posted here, but, as I said once, I
>>> like you guys more! :)
>>>
>>> have two tables: orders and special_orders. foreign key is trans_no.
>>> I can't figure it out how to create a query that pulls orders from
>>> the "orders" tables that are NOT in "special_orders" table?
>>
>>
>>
>> I can never remember the syntax, but you want to LEFT JOIN the tables
>> and then only return rows where the resulting special_orders column
>> is NULL.
>>
>> something like this (most likely wrong syntax):
>>
>> SELECT o.trans_no, s.trans_no FROM orders o LEFT JOIN special_orders
>> s ON o.trans_no = s.trans_no WHERE s.trans_no IS NULL
>>
>> But that should get you started...
>>
>> -philip
>>
>>
>>
try this (untested):
SELECT * FROM trans_no
LEFT JOIN special_orders ON (trans_no.id = special_orders.id)
WHERE special_orders.id IS NULL;
just change id to the primary key...
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.8/71 - Release Date: 8/12/2005
attached mail follows:
take what other say with a grain of salt.. im sure you're using php to
pull info from mysql anyway..
the fact is without mysql php would be nowhere where it is today.. its
like peanut butter w/o the jelly..
see my reply in the other email.. im sure it will work for you.
afan
afan.net wrote:
> ok. accept critique. :(
>
>
moderator: please take my mysql questions off the php list.
>
> I apology to everybody for any inconviniance.
>
> -afan
>
>
> John Nichel wrote:
>
>> afan
afan.net wrote:
>>
>>> I apology for mysql question posted here, but, as I said once, I
>>> like you guys more! :)
>>
>>
>>
>> I like my wife more than I like the people on these lists, but I
>> don't go asking her my MySQL questions. I go to the MySQL list for
>> that. What you like doesn't make your post any less off topic, or any
>> less against netiquitte. To me, it's even a bigger offense than the
>> newbie wo doesn't know any better...you know you're question is off
>> topic, and yet you ask anyway...numerous times.
>>
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.8/71 - Release Date: 8/12/2005
attached mail follows:
Sebastian wrote:
> take what other say with a grain of salt.. im sure you're using php to
> pull info from mysql anyway..
And he might be using Apache on Linux like the majority of PHP users.
More than likely outputting some HTML and maybe some JavaScript.
Probably using a PC too. So what?
> the fact is without mysql php would be nowhere where it is today.. its
> like peanut butter w/o the jelly..
The fact is, without IBM, PHP would be nowhere it is today. Say, here's
an idea, let's just make this the "IBM and anything which relates to it"
list.
> see my reply in the other email.. im sure it will work for you.
I'll be sure to tell everyone on the MySQL list that they can shut it
down, since you have it covered over here.
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
attached mail follows:
First I'll appologize for the cheuvanistic remark the other poster had. I
know he had good intentions...
So I don't know smarty, but it seems to me you're grabbing only one row
here:
$projects = $db->getAssoc()
Normally in straight PHP, I would do something like.
While ($row = $db->getAssoc($query, DB_FETCHMODE_ASSOC))
{
$projects[] = $row;
}
The [] just adds a new element to the array and is dumping in the entire
$row array to it.
Ala, multi-dimensional array.
Then I would do something like:
foreach ($projects as $key => $value)
{
echo "[".$key."] has a name value of ".$value['project_name'];
}
Remember that you have a multi-array in $projects, so that's why I split it
into the key/value pair where value is actually another array, and you
access the elements via it's hash key.
Hope this helps.
D.Vin
http://daevid.com
> -----Original Message-----
> $query ="SELECT * FROM projects WHERE parent_project_id is NULL OR
> parent_project_id = ''";
>
> $projects = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
>
> foreach ($projects as $key => $project) {
> $query ="SELECT * FROM projects WHERE parent_project_id =
> $projects[$key]['project_id']";
> $sub = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
> $projects[$key]['subs'] = $sub;
> }
> $tpl->assign('projects', $projects);
>
> SMARTY STUFF
> {foreach from=$projects item='entry'}
> <b>{$entry.short_name}</b><br />
> <ul>
> {foreach from=$entry.subs item='sub'}
> <li>{$sub.short_name}</li>
> {foreachelse}
> <li>No subs for this project</li>
> {/foreach}
> </ul>
> {foreachelse}
> <b>No projects found</b>
> {/foreach}
>
> Can anyone point me in the right direction?
>
> Thanks,
> Amanda
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
George B wrote:
> I made a left frame, then made the three pages, and all the frames show
> fine. But this is not my problem! I made a "leftpane" which has code to
> check if user exists (its for a login script). In the code for the login
> FORM I set it to go directly to the "userpane" file. It works fine! It
> recognizes me and all, says I am logged in. But if I set the Login FOrm
> to the main frame file (which shows the 2 frames) it says wrong user and
> password. What do I do to make this work?!?!?!
Well can anyone help? :( :( I really need to know how to do this :(
attached mail follows:
Hi, folks. I'm running into an incredibly bizarre problem with a
header() redirect of which I cannot see the cause.
We have a CMS here where I work, in two separate production and training
environments.
Last night I implemented a new events manager module, copying all
necessary files from training to production, adding database tables,
etc. etc.
Everything worked, except for one redirect which happens after a user
deletes an event. For some reason, the redirect is simply reloading the
event detail page from which the user clicked the delete link.
But the truly bizarre thing is that in the training environment it
works!!!
There is nothing different between the two files except for '-test'
being added to the subdomain (so it's cms-test.mydomain.com instead of
cms.mydomain.com) in any full paths.
The code that deletes the event, and then redirects the user is:
$conn->Execute("delete from cms_events where e_id = {$fd['e_id']}") or
$this->CMS_error(2,$this->mod_name,$query,$conn->ErrorMsg());
header("Location:{$this->CMS_base_path}mods/events_manager/cms.events_ma
nager.dsp.php");
Not to much to see here. If the query doesn't execute the CMS_error
method is called, and the header would never be reached.
However, the query does execute, the event is deleted, but instead of
going to the appropriate location, it's simply redirecting back to:
/mods/events_manager/cms.events_manager.event_detail.dsp.php?e_id=15
where 15 is whatever the number of the event that was just deleted was,
and ergo it brings up an "Invalid event" error, and the user can then
click a link at the bottom of the page to go back to the main events
manager page.
Can anyone think of any reason why the above code, just those two lines,
would redirect correctly in one environment, yet simply redirect to the
currently existing page in another?
There are a number of other redirects in the events module that are
working fine, so why this one would work in the training environment and
not in the production environment is mystifying me.
Cheers, and thanks very much in advance for any help. This one hurt my
brain this afternoon.
Pablo
attached mail follows:
Pablo Gosse wrote:
> [snip]
> $conn->Execute("delete from cms_events where e_id = {$fd['e_id']}") or
> $this->CMS_error(2,$this->mod_name,$query,$conn->ErrorMsg());
>
> header("Location:{$this->CMS_base_path}mods/events_manager/cms.events_ma
> nager.dsp.php");
> [snip]
> Can anyone think of any reason why the above code, just those two lines,
> would redirect correctly in one environment, yet simply redirect to the
> currently existing page in another?
Can you place the following code just before the header() line, and post
what it prints?
die($this->CMS_base_path);
In other words, tell us what the $this->CMS_base_path field contains
when that line is executed.
Jasper
attached mail follows:
Pablo Gosse wrote:
> Can anyone think of any reason why the above code, just those two lines,
> would redirect correctly in one environment, yet simply redirect to the
> currently existing page in another?
I can think of a few, and my first instinct is to check to see whether
your script produces any errors in one environment that it doesn't in
the other. If you're displaying errors, they can affect the behavior of
your scripts when you're also using header(). Replace header() with echo
and compare the behavior.
Also, comparing php.ini can help you identify differences in
configuration. Configuration directives can be modified through other
means, but this is a good starting point (and a good candidate for
version control anyway - inconsistencies can cause you to waste time and
effort).
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
attached mail follows:
hello,
sorry in advance if my question is naive.. i'm trying to allow file
uploads. optimally i'd like to store these files (jpgs, mostly) directly to
a folder in my httpdocs.. i've heard something about file uploads not being
allowed if server is set to safemode.. not sure why but i've been getting
errors.. here're the two files if you have time to check them out. thanks
for your time!
xo, -z
----------
[file1.html]
<form enctype="multipart/form-data"
action="file2.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
FILENAME: <input name="filename1" type="file"><br><input type="submit"
value="submit"></form>
----------
[file2.php
<?php
$uploads_dir = '/release_pics/';
foreach ($_FILES as $myfile) {
$filename = $myfile['name'];
switch ($myfile['error']) {
case 4:
continue 2;
case 1:
case 2:
print "sorry, $filename is too big.<br>";
continue 2;
case 3:
print "the upload of file $filename was broken. please try again.<br>";
continue 2;
}
print "received: $filename.";
print "type: $myfile['type'].<br>";
move_uploaded_file(
$myfile['tmp_name'],
$uploads_dir.$myfile['name']);
}
?>
--
fourthcity 2005 ; slow yr roll. ---> http://www.fourthcity.net/
quick links:
> http://www.fourthcity.net/ [ fct]
> http://www.zapan.net/ [ zapan]
> http://www.laptopbattle.org/ [ battle]
> http://www.postermidget.com/ [ midget]
+
+
+
+ +
+
+
----> much love! from the fourthcity studios <----
attached mail follows:
I am having an issue with building dynamic checkboxes.. They appeared to be
working properly...but then all the checkboxes in the array are "checking"
ater the initial checkbox is selected.
I am building a sticky form to present the data. so anything checked in the
HTML would be dynamically checked in the PHP.
I am grateful to Jochem Maas for getting me to this point...
Any help is appreciated...
Here is the HTML...
<html>
<head>
<title>Dynamic Checkboxes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" action="checkboxcalc.php">
<p><input name="gmev[]" type="checkbox" id="gmev" value="September
9th">September 9th</p>
<p><input name="gmev[]" type="checkbox" id="gmev" value="October
14th">October 14th</p>
<p><input name="gmev[]" type="checkbox" id="gmev" value="November
11th">November 11th</p
<p><input name="gmev[]" type="checkbox" id="gmev" value="December
9th">December 9th</p>
<input type="submit" name="Submit" value="Submit Registration">
</form>
</body>
</html>
Here is the PHP
<?
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>September
9th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>October
14th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>November
11th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>December
9th';
?>
thanks
zedleon
attached mail follows:
Hai all,
This is naha, I am very new to PHP as well as this group, I am in need of
your guidence all my way.
Now I am doing a project using PHP, in that I created a form.
That form has a field called e-mailid, to validate that I need a script
(function), whether I have to write it in the server side or client side,
which one is better?. I need your suggestions, If any script is there plz
send it to me.
--
with regds,
Nahalingam.
attached mail follows:
Nahalingam Kanakavel wrote:
> Now I am doing a project using PHP, in that I created a form.
> That form has a field called e-mailid, to validate that I need a script
> (function), whether I have to write it in the server side or client side,
> which one is better?. I need your suggestions, If any script is there plz
> send it to me.
If I was creating such a script I would validate it both on the
client-side and the server-side. The reason for this is that client-side
validation can be fooled, but server-side validation requires a
round-trip to the server.
If you validate on the client-side you will save your users time as
errors will be detected without a trip to the server, but you still need
to validate on the server-side to ensure that they haven't bypassed the
client-side validation in any way.
As far as an actual script goes, either read the relevant RFC for email
addresses at [1], or just Google for PHP email validation [2].
Jasper
[1] http://www.ietf.org/rfc.html
[2] http://www.google.com/search?q=php+email+validation
attached mail follows:
Hi, Everybody!
I got this when I execute the script:
Fatal error: Call to undefined function: curl_init() in msnp9.class.php on
line 259
is there anyway to solve it?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]