php-general Digest 27 Dec 2002 11:32:06 -0000 Issue 1787
Topics (messages 129388 through 129423):
Re: Open HTTPS connection
129388 by: Sean Burlington
Re: Nested Arrays
129389 by: Weston Houghton
129390 by: Weston Houghton
129391 by: Wee Keat [Amorphosium]
129395 by: Beauford.2002
129402 by: Wee Keat [Amorphosium]
129414 by: Paul Reed
php+gd 2.0.7 problems take 2
129392 by: cj
str_replace
129393 by: Weston Houghton
129396 by: John W. Holmes
129397 by: Weston Houghton
Cheap Hosting
129394 by: Stephen
129398 by: Rick Emery
129405 by: Kyle Gibson
129407 by: Jason k Larson
129409 by: Daniel Kushner
Photos and logos in MySQL + PHP
129399 by: Denis L. Menezes
129400 by: Michael J. Pawlowsky
129401 by: Rick Widmer
include "problem"
129403 by: Pag
129404 by: Rasmus Lerdorf
odd results inquiry
129406 by: Tony Tzankoff
129408 by: Michael J. Pawlowsky
129410 by: Michael J. Pawlowsky
How To Use The next() and prev() functions on multi-dimensional arrays
129411 by: . Nilaab
129412 by: Jason k Larson
Re: Finding # of weekdays between 2 dates..
129413 by: Marek Kilimajer
Re: Installing PHP on XP
129415 by: Marek Kilimajer
Re: Unable to set permissions
129416 by: Marek Kilimajer
Re: Selecting what's for deletion
129417 by: Marek Kilimajer
129419 by: Cesar Aracena
129423 by: John W. Holmes
Re: language internationalisation
129418 by: Marek Kilimajer
CLI delay
129420 by: Maciek Ruckgaber Bielecki
129421 by: Marek Kilimajer
129422 by: Rick Widmer
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:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
John W. Holmes wrote:
What are the different ways to open an HTTPS connection from within a
script and receive back the response into a variable? I know CURL can do
it, and PHP 4.3 with OpenSSL can use fopen() to do it. Can sockets be
used at all with PHP 4.2 to get the page or maybe a system call to a
simple program to do it? This is going to be on a Win2K machine. Thanks
for any info.
you could try lynx
http://lynx.isc.org/
its a text browser commanly available on Linux stystems but also
available for dos/win32
it can retieve and dump to stdout either the raw file or the formatted
text - and supports https.
--
Sean
--- End Message ---
--- Begin Message ---
Sure... for the longwinded approach, just do this:
$row1 = array("col1", "col2", "col3", ...);
$row2 = array("col1", "col2", "col3", ...);
$row3 = array("col1", "col2", "col3", ...);
$row4 = array("col1", "col2", "col3", ...);
$row5 = array("col1", "col2", "col3", ...);
$main_array = array($row1, $row2, $row3, $row4, $row5);
Obviously these could include key-value pairs in the arrays as well.
Then to prove it to yourself:
print_r($main_array);
Cheers,
Wes
On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote:
Hi,
Is there anyway to do a nested array, I have looked at the various
array
functions and can't figure this out (if possible).
I want to be able to put each field of a row into an array, and then
put
that entire row and into another array.
so when I display it, I would have:
row1 - col1 col2 col3 col4 col5
row2 - col1 col2 col3 col4 col5
row3 - col1 col2 col3 col4 col5
row4 - col1 col2 col3 col4 col5
row5 - col1 col2 col3 col4 col5
etc. (depending on how many rows there are).
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Sure... for the longwinded approach, just do this:
$row1 = array("col1", "col2", "col3", ...);
$row2 = array("col1", "col2", "col3", ...);
$row3 = array("col1", "col2", "col3", ...);
$row4 = array("col1", "col2", "col3", ...);
$row5 = array("col1", "col2", "col3", ...);
$main_array = array($row1, $row2, $row3, $row4, $row5);
Obviously these could include key-value pairs in the arrays as well.
Then to prove it to yourself:
print_r($main_array);
Cheers,
Wes
On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote:
Hi,
Is there anyway to do a nested array, I have looked at the various
array
functions and can't figure this out (if possible).
I want to be able to put each field of a row into an array, and then
put
that entire row and into another array.
so when I display it, I would have:
row1 - col1 col2 col3 col4 col5
row2 - col1 col2 col3 col4 col5
row3 - col1 col2 col3 col4 col5
row4 - col1 col2 col3 col4 col5
row5 - col1 col2 col3 col4 col5
etc. (depending on how many rows there are).
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> Is there anyway to do a nested array, I have looked at the various array
> functions and can't figure this out (if possible).
>
Try reading up on multidimensional array...
http://www.onlamp.com/pub/a/php/2001/06/07/php_foundations.html
http://www.onlamp.com/pub/a/php/2001/06/21/php_foundations.html
http://www.php.net/manual/en/function.array.php
HTH.
--- End Message ---
--- Begin Message ---
Thanks for the info, but maybe I didn't give enough info.
I have a mysql database with up to 10 rows and 5 fields in each row.. I have
been reading up on some of the array functions, but haven't been able to get
anything to work.
TIA
----- Original Message -----
From: "Weston Houghton" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Thursday, December 26, 2002 6:19 PM
Subject: Re: [PHP] Nested Arrays
>
> Sure... for the longwinded approach, just do this:
>
> $row1 = array("col1", "col2", "col3", ...);
> $row2 = array("col1", "col2", "col3", ...);
> $row3 = array("col1", "col2", "col3", ...);
> $row4 = array("col1", "col2", "col3", ...);
> $row5 = array("col1", "col2", "col3", ...);
>
> $main_array = array($row1, $row2, $row3, $row4, $row5);
>
> Obviously these could include key-value pairs in the arrays as well.
> Then to prove it to yourself:
>
> print_r($main_array);
>
> Cheers,
> Wes
>
>
> On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote:
>
> > Hi,
> >
> > Is there anyway to do a nested array, I have looked at the various
> > array
> > functions and can't figure this out (if possible).
> >
> > I want to be able to put each field of a row into an array, and then
> > put
> > that entire row and into another array.
> >
> > so when I display it, I would have:
> >
> > row1 - col1 col2 col3 col4 col5
> > row2 - col1 col2 col3 col4 col5
> > row3 - col1 col2 col3 col4 col5
> > row4 - col1 col2 col3 col4 col5
> > row5 - col1 col2 col3 col4 col5
> >
> > etc. (depending on how many rows there are).
> >
> > TIA
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Beauford.2002" <[EMAIL PROTECTED]>
To: "Wee Keat [Amorphosium]" <[EMAIL PROTECTED]>
Sent: Friday, December 27, 2002 12:13 PM
Subject: Re: [PHP] Nested Arrays
> Quote: "I have looked at the various array functions and can't figure this
> out ....."
>
Wow... You're welcome!
>
> >
> >
> > > Is there anyway to do a nested array, I have looked at the various
array
> > > functions and can't figure this out (if possible).
> > >
> > Try reading up on multidimensional array...
> >
> > http://www.onlamp.com/pub/a/php/2001/06/07/php_foundations.html
> > http://www.onlamp.com/pub/a/php/2001/06/21/php_foundations.html
> >
> > http://www.php.net/manual/en/function.array.php
> >
> > HTH.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>
--- End Message ---
--- Begin Message ---
I didn't see this approach in any other reply.....
A multidimensional array is just an array of single dimensional
arrays... Basically $array[row#][col#]=$data;
$array[0][0]= "row0, col0";
$array[0][1]= "row0, col1";
This also works with associative arrays...
$cars[0]['make']="Ford";
$cars[0]['model']="Mustang";
$cars[1]['make']="Mazda";
$cars[1]['model']="RX7";
Although using an object/class would be better suited for the second
example....
Hope this help ..
Paul.
-----Original Message-----
From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 18:14
To: PHP General
Subject: [PHP] Nested Arrays
Hi,
Is there anyway to do a nested array, I have looked at the various array
functions and can't figure this out (if possible).
I want to be able to put each field of a row into an array, and then
put
that entire row and into another array.
so when I display it, I would have:
row1 - col1 col2 col3 col4 col5
row2 - col1 col2 col3 col4 col5
row3 - col1 col2 col3 col4 col5
row4 - col1 col2 col3 col4 col5
row5 - col1 col2 col3 col4 col5
etc. (depending on how many rows there are).
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi would any one know what the following error's are for/mean
I am using gd 2.0.7 with gif support built in and php4.2.3
I am using the exact same gd version and php version as I used on another
machine and it compiled with only minor problems, but these errors are
different to the errors I got on the other machine.
Thanks
gcc -I. -I/usr/local/src/php-4.2.3/ext/gd -I/usr/local/src/php-4.2.3/main -I
/usr/local/src/php-4.2.3 -I/usr/local/src/apache_1.3.26/src/include -I/usr/l
ocal/src/apache_1.3.26/src/os/unix -I/usr/local/src/php-4.2.3/Zend -I/usr/lo
cal/include -I/usr/local/src/gd-2.0.7gif/ -I/usr/local/src/php-4.2.3/ext/mys
ql/libmysql -I/usr/local/pgsql/include -I/usr/local/src/php-4.2.3/ext/xml/ex
pat -I/usr/local/src/php-4.2.3/TSRM -g -O2 -c gd.c && touch gd.lo
gd.c: In function `zm_startup_gd':
gd.c:303: `gdArc' undeclared (first use in this function)
gd.c:303: (Each undeclared identifier is reported only once
gd.c:303: for each function it appears in.)
gd.c:304: `gdPie' undeclared (first use in this function)
gd.c:305: `gdChord' undeclared (first use in this function)
gd.c:306: `gdNoFill' undeclared (first use in this function)
gd.c:307: `gdEdged' undeclared (first use in this function)
gd.c: In function `zif_imagecreatetruecolor':
gd.c:588: warning: assignment makes pointer from integer without a cast
gd.c: In function `zif_imagecreatefromstring':
gd.c:1093: `gdImageCreateFromGifCtx' undeclared (first use in this function)
gd.c: In function `zif_imagecreatefromgif':
gd.c:1235: `gdImageCreateFromGif' undeclared (first use in this function)
gd.c:1235: `gdImageCreateFromGifCtx' undeclared (first use in this function)
gd.c: In function `zif_imagegif':
gd.c:1462: `gdImageGifCtx' undeclared (first use in this function)
gd.c: In function `zif_imagecolorat':
gd.c:1626: structure has no member named `tpixels'
gd.c: In function `_php_image_convert':
gd.c:3521: `gdImageCreateFromGif' used prior to declaration
gd.c:3521: warning: assignment makes pointer from integer without a cast
make[3]: *** [gd.lo] Error 1
make[3]: Leaving directory `/usr/local/src/php-4.2.3/ext/gd'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/php-4.2.3/ext/gd'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/php-4.2.3/ext'
make: *** [all-recursive] Error 1
--- End Message ---
--- Begin Message ---
All,
In using str_replace, I glanced at the manual and found that it can
take arrays for it's arguments. Great! I thought that I could have a
single search string, an array of replacement vars, and no subject. It
would then replace each successive instance of the search string with
the next element in the replacement array.
Sadly this is not the case.
Anyone have any recommendations on how to go about this? Best idea
using p/ereg_replace? Or just a loop system in which I replace the
first instance of the string each time?
I'm not great at p/ereg yet, anyone have any pointers?
Cheers,
Wes
--- End Message ---
--- Begin Message ---
> In using str_replace, I glanced at the manual and found that it can
> take arrays for it's arguments. Great! I thought that I could have a
> single search string, an array of replacement vars, and no subject. It
> would then replace each successive instance of the search string with
> the next element in the replacement array.
>
> Sadly this is not the case.
>
> Anyone have any recommendations on how to go about this? Best idea
> using p/ereg_replace? Or just a loop system in which I replace the
> first instance of the string each time?
>
> I'm not great at p/ereg yet, anyone have any pointers?
Can you explain exactly what you want replaced and with what? Give an
example of the string and what will be replaced and what it will be
replaced with. Then someone can write/help with the regex.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--- End Message ---
--- Begin Message ---
okey dokey, here goes:
this gets really complicated to explain without showing the code, which
I really can't do (damned NDA's) and ultimately it's a bit big to post
anyhow. But I'm going to try.
I let the user specify a number of rows to input 2 pieces of data. I
then replace a template containing one row with that number of
replacement rows when displaying the form. In the process of creating
the final data to send to the user I of course have to fill in a couple
of details.
So I start with a base form field:
<input type="hidden" value="!value!" name="!field_id!"> !value! <input
type="text" name="!field_id![]">
So that line has to be repeated as many times as the user enters. With
the !**! values being replaced by the correct information. The !value!
needs to just be a simple incremented count. What I was hoping to do
was build an array of the correct data for each row, then insert it
into the template. The template doesn't distinguish each row at all, so
I am trying to shove different data in for each row, when at this
stage, I just have a template that looks roughly like:
<table>
<tr>
<td>!insert_row!</td>
</tr>
<tr>
<td>!insert_row!</td>
</tr>
<tr>
<td>!insert_row!</td>
</tr>
</table>
I was hoping the str_replace with an array would work here, but it
isn't, so I am looking for other options. I know I have a way to do it
now, by just looping through and replacing them one by one. I was just
trying to find a little bit more elegant solution I guess.
Thanks,
Wes
On Thursday, December 26, 2002, at 08:14 PM, John W. Holmes wrote:
In using str_replace, I glanced at the manual and found that it can
take arrays for it's arguments. Great! I thought that I could have a
single search string, an array of replacement vars, and no subject. It
would then replace each successive instance of the search string with
the next element in the replacement array.
Sadly this is not the case.
Anyone have any recommendations on how to go about this? Best idea
using p/ereg_replace? Or just a loop system in which I replace the
first instance of the string each time?
I'm not great at p/ereg yet, anyone have any pointers?
Can you explain exactly what you want replaced and with what? Give an
example of the string and what will be replaced and what it will be
replaced with. Then someone can write/help with the regex.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello,
I need a nice, reliable host for my new website. It needs to
be fast, reliable, needs a good uptime, and some features. PHP and MySQL are the
two I really need. Does anyone recomend one that's really cheap? So far I've
found on, $5 a month, but it's slower then what'd I like. If nothing else pops
up, I'll go with it. I'd also like domain parking and/or domain registration
(don't really need the registration though). Thanks in
advance!
|
--- End Message ---
--- Begin Message ---
www.nomonthlyfees.com
$200 first year, $70 per year thereafter.
I put all my clients with this service.
rick
"People will forget what you said. People will forget what you did.
But people will never forget how you made them feel."
----- Original Message -----
From: Stephen
To: PHP List
Sent: Thursday, December 26, 2002 6:55 PM
Subject: [PHP] Cheap Hosting
Hello,
I need a nice, reliable host for my new website. It needs to be fast, reliable, needs a
good uptime, and some features. PHP and MySQL are the two I really need. Does anyone
recomend one that's really cheap? So far I've found on, $5 a month, but it's slower
then
what'd I like. If nothing else pops up, I'll go with it. I'd also like domain parking
and/or domain registration (don't really need the registration though). Thanks in
advance!
Thanks,
Stephen Craton
http://www.melchior.us
"What is a dreamer that cannot persevere?" -- http://www.melchior.us
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello,
I need a nice, reliable host for my new website. It needs to be fast,
reliable, needs a good uptime, and some features. PHP and MySQL are the
two I really need. Does anyone recomend one that's really cheap? So far
I've found on, $5 a month, but it's slower then what'd I like. If
nothing else pops up, I'll go with it. I'd also like domain parking
and/or domain registration (don't really need the registration though).
Thanks in advance!
Thanks,
Stephen Craton
http://www.melchior.us
"What is a dreamer that cannot persevere?" -- http://www.melchior.us
Try www.frozeonline.com
;)
--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/
--- End Message ---
--- Begin Message ---
I can personally recommend www.icdsoft.com as they are CHEAP! But offer
everything you could hope for. Support has been awesome and service has
been very reliable.
Jason k Larson
Stephen wrote:
Hello,
I need a nice, reliable host for my new website. It needs to be fast,
reliable, needs a good uptime, and some features. PHP and MySQL are the
two I really need. Does anyone recomend one that's really cheap? So far
I've found on, $5 a month, but it's slower then what'd I like. If
nothing else pops up, I'll go with it. I'd also like domain parking
and/or domain registration (don't really need the registration though).
Thanks in advance!
Thanks,
Stephen Craton
http://www.melchior.us
"What is a dreamer that cannot persevere?" -- http://www.melchior.us
--- End Message ---
--- Begin Message ---
Hi Stephen,
nyphp.org has a hosting service that you might find interesting. Take a
look at:
http://thehostingcompany.us
Regards,
Daniel Kushner
_________________________________________
Need hosting? http://thehostingcompany.us
-----Original Message-----
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 7:56 PM
To: PHP List
Subject: [PHP] Cheap Hosting
Hello,
I need a nice, reliable host for my new website. It needs to be fast,
reliable, needs a good uptime, and some features. PHP and MySQL are the two
I really need. Does anyone recomend one that's really cheap? So far I've
found on, $5 a month, but it's slower then what'd I like. If nothing else
pops up, I'll go with it. I'd also like domain parking and/or domain
registration (don't really need the registration though). Thanks in advance!
Thanks,
Stephen Craton
http://www.melchior.us
"What is a dreamer that cannot persevere?" -- http://www.melchior.us
--- End Message ---
--- Begin Message ---
Hello friends,
I am making a website for our school. My requirement is that when any student searched
for a particular club, the logo of the club abd the chairperson's phot should
automatically be shown dynamically on the top of the page. For this to be done, I have
three questions, if any of you could please help me :
1. Can I place these photos and logos in the MySQL database, If so, what field type?
2. How can I make the admin page upload the photos and logos to the database?
3. How do I display these photos dynamically on the output webpage?
I know I am asking many questions, but none of the PHP books I own have the solutions
for this.
best regards
Denis
--- End Message ---
--- Begin Message ---
Well the datatype would be a blob. But personally I would just have pointer to the
photos on the server.
In other words... you have the id of the row for that club and you can name the photo
photo_$id.jpg and the logo logo_$id.jpg
Here's a snippet you can take a look at for uploading the files from an admin page.
Check out php.net for more info.
But at least it will give you a place to start looking. I also use GDLib to create
thumbnails, manipulate the size if it's too big etc.
if (isset($_POST['action'])) {
$sql->Insert("INSERT INTO photo_item (unum, cat, cutline, create_date, hsize, vsize)
VALUES ( $HTTP_COOKIE_VARS[unum], $_POST[cat], '$_POST[cutline]', now(), 0,0)");
$affected_rows = $sql->a_rows;
$lastid = mysql_insert_id();
/* If we have an photo let's move it */
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
move_uploaded_file($_FILES['userfile']['tmp_name'], "pics/$lastid.gif");
} else {
/* No photo then send error and delete db entry */
$sql->Delete("DELETE from photo_item where id = $lastid");
echo ("Error no photo uploaded");
Die();
}
} else {
Show some form here
echo "<h1>Add a photo</h1>\n<p>\n\n";
echo "<form action=\"\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" name=\"action\" value=\"1\">";
echo "<TABLE border=\"0\">";
echo "<tr><td>";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000\">";
echo "Photo: </td> <td><input name=\"userfile\" type=\"file\">";
echo "</td></tr>";
}
*********** REPLY SEPARATOR ***********
On 27/12/2002 at 9:40 AM Denis L. Menezes wrote:
>Hello friends,
>
>I am making a website for our school. My requirement is that when any
>student searched for a particular club, the logo of the club abd the
>chairperson's phot should automatically be shown dynamically on the top of
>the page. For this to be done, I have three questions, if any of you could
>please help me :
>
>1. Can I place these photos and logos in the MySQL database, If so, what
>field type?
>
>2. How can I make the admin page upload the photos and logos to the
>database?
>
>3. How do I display these photos dynamically on the output webpage?
>
>I know I am asking many questions, but none of the PHP books I own have
>the solutions for this.
>
>best regards
>Denis
--- End Message ---
--- Begin Message ---
At 09:40 AM 12/27/02 +0800, Denis L. Menezes wrote:
Hello friends,
I am making a website for our school. My requirement is that when any
student searched for a particular club, the logo of the club abd the
chairperson's phot should automatically be shown dynamically on the top of
the page. For this to be done, I have three questions, if any of you could
please help me :
1. Can I place these photos and logos in the MySQL database, If so, what
field type?
You can, but you don't want to. Just put the images in a directory and
maybe the names in the database. In this case, I'd probably name the
images based on the auto_increment field in the table they are related to.
2. How can I make the admin page upload the photos and logos to the database?
http://www.php.net/manual/en/features.file-upload.php
3. How do I display these photos dynamically on the output webpage?
First build the names in variables...
$LogoName = "/images/logos/$ClubID.png";
$PhotoName = "/images/photos/$ClubID.png";
then later when you are painting the page.
<IMG src="<?=$LogoName?>">
<IMG src="<?=$PhotoName?>">
Don't forget to include Width, Height and Alt tags in the <IMG> tags.
Rick
--- End Message ---
--- Begin Message ---
Hi,
i am trying to make my work a little easier when editing the appearance of
a news site i am building. As it is, everytime i want to change the looks
of how each news appears, i have to edit inside the print(' '); which is
annoying, because of the backslash with " problem thing(when i need to have
a " inside a print, i need to put a \, you know), for example:
i have:
print("<br>[$data] <br> $titulo <br>($user)<br> $intro <br> $texto
<br><br> (comentarios=$contador)<br><br><hr size=1 width=90%><br>");
Cant i do something like having the code inside the print on an external
file? so when i want to change something, i only edit that file, instead of
dealing with the print itself, like this:
[some command(s) that put the content of the external file "looks.inc" in
variable $a]
print ("$a");
I dont even know what to look for in the net. This problem is so i, later
on, can code some sort of backend in the ways of greymatter, that people
can change the looks of the news entries by themselves.
Thanks.
Pag
--- End Message ---
--- Begin Message ---
Use a here-doc:
echo <<<EOB
<br>[$data] <br> $titulo <br>($user)<br> $intro <br> $texto
<br><br> (comentarios=$contador)<br><br><hr size=1 width=90%><br>
EOB;
-Rasmus
On Fri, 27 Dec 2002, Pag wrote:
>
> Hi,
>
> i am trying to make my work a little easier when editing the appearance of
> a news site i am building. As it is, everytime i want to change the looks
> of how each news appears, i have to edit inside the print(' '); which is
> annoying, because of the backslash with " problem thing(when i need to have
> a " inside a print, i need to put a \, you know), for example:
>
> i have:
>
> print("<br>[$data] <br> $titulo <br>($user)<br> $intro <br> $texto
> <br><br> (comentarios=$contador)<br><br><hr size=1 width=90%><br>");
>
> Cant i do something like having the code inside the print on an external
> file? so when i want to change something, i only edit that file, instead of
> dealing with the print itself, like this:
>
> [some command(s) that put the content of the external file "looks.inc" in
> variable $a]
> print ("$a");
>
> I dont even know what to look for in the net. This problem is so i, later
> on, can code some sort of backend in the ways of greymatter, that people
> can change the looks of the news entries by themselves.
>
> Thanks.
>
> Pag
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Here is a strange one (for me, anyway)...
The command is as follows:
select * from xtable where client='name' order by r_date desc, r_time desc
limit 0,10;
The problem: It returns 20 records
and when i execute this command...it returns 30 records
select * from xtable where client='name' order by r_date desc, r_time desc
limit 11,20;
and so on.
What the heck is going on here? any ideas? im confoosed!
--
Tony Tzankoff
http://www.tzankoff.com
=========================
--- End Message ---
--- Begin Message ---
Well the second one I can help you with.. it should be LIMIT 11,10 if you only want 10
rows.... You are asking for 20.
For the fun of it try 1,10 on the first one.
*********** REPLY SEPARATOR ***********
On 26/12/2002 at 10:23 PM Tony Tzankoff wrote:
>Here is a strange one (for me, anyway)...
>
>The command is as follows:
>select * from xtable where client='name' order by r_date desc, r_time desc
>limit 0,10;
>
>The problem: It returns 20 records
>
>and when i execute this command...it returns 30 records
>select * from xtable where client='name' order by r_date desc, r_time desc
>limit 11,20;
>
>and so on.
>
>What the heck is going on here? any ideas? im confoosed!
>
>--
>
>Tony Tzankoff
>http://www.tzankoff.com
>=========================
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Actually I bet if you take a closer look at your code you will see that your are
incrementing
that value somewhere before the query is executed or something.
Perhaps you are mixing up the order of the row limit and starting point.
The 0 is right.
I just quickly tried it in a mysql term
SELECT id, pid from tree limit 0,3;
SELECT id, pid from tree limit 3,3;
SELECT id, pid from tree limit 6,3;
*********** REPLY SEPARATOR ***********
On 26/12/2002 at 10:32 PM Michael J. Pawlowsky wrote:
>Well the second one I can help you with.. it should be LIMIT 11,10 if you
>only want 10 rows.... You are asking for 20.
>For the fun of it try 1,10 on the first one.
>
>
--- End Message ---
--- Begin Message ---
Hello Everyone,
I have a multi-dimensional array called $cat_data, and I need to access
certain elements in the array using the next() and prev() functions. I did
consider using loops like for, foreach, and while...but for this particular
application, I don't want to loop through the entire array. Also, I need
everything in that array, so no I don't want to limit the data drawn from
the database. I know the two above mentioned functions work with normal
arrays, but how would I make it work with multi-dimensional arrays? The
following is a little idea of the structure of the array:
$cat_data[$a][$b] where $a is the row number from the database, and $b is
the column being accessed.
$cat_data[0][0] = the first row of the id column.
$cat_data[0][1] = the first row of the name column.
--- End Message ---
--- Begin Message ---
Multi-dimensional arrays work the same as non-nested arrays. You just
need to look at how to access them the same.
For example:
Next ($cat_data);
versus:
Next ($cat_data[0]);
or even:
$row =& $cat_data[1];
//notice the use of a reference & (to keep from using a copy)
Next ($row);
Well, have fun ...
Jason k Larson
@ Nilaab wrote:
Hello Everyone,
I have a multi-dimensional array called $cat_data, and I need to access
certain elements in the array using the next() and prev() functions. I did
consider using loops like for, foreach, and while...but for this
particular
application, I don't want to loop through the entire array. Also, I need
everything in that array, so no I don't want to limit the data drawn from
the database. I know the two above mentioned functions work with normal
arrays, but how would I make it work with multi-dimensional arrays? The
following is a little idea of the structure of the array:
$cat_data[$a][$b] where $a is the row number from the database, and $b is
the column being accessed.
$cat_data[0][0] = the first row of the id column.
$cat_data[0][1] = the first row of the name column.
--- End Message ---
--- Begin Message ---
WFM:
$nowdate = mktime(0, 0, 0, 4, 1, 2002);
$futuredate = mktime(0, 0, 0, 5, 2, 2002);
echo weekdaysBetween ($nowdate,$futuredate,2);
I get 5
Chad Day wrote:
I found this function in the list archives while searching on how to find
the number of a weekday (say, Tuesdays) between 2 dates..
function weekdaysBetween ($timestamp1, $timestamp2, $weekday)
{
return floor(intval(($timestamp2 - $timestamp1) / 86400) / 7)
+ ((date('w', $timestamp1) <= $weekday) ? 1 : 0);
}
Sometimes it works, but I've come across a date while testing this that
doesn't work, which makes me think there is some bug in the function that
I'm not seeing.
The 2 dates I am trying are:
01-04-2002
and
02-05-2002
There should be 5 Tuesdays:
01-08-2002
01-15-2002
01-22-2002
01-29-2002
02-05-2002
Yet the script only returns 4, leaving off 02-05-2002.
$nowdate = mktime(0, 0, 0, $STARTMONTH, $STARTDAY, $STARTYEAR);
$futuredate = mktime(0, 0, 0, $ENDMONTH, $ENDDAY, $ENDYEAR);
That's how I'm generating the time stamps to pass to the function, and I've
confirmed the dates I've entered are correct..
echo weekdaysBetween($nowdate, $futuredate, 2);
Returns 4 ..
can anyone assist?
Thanks,
Chad
--- End Message ---
--- Begin Message ---
I did 2 days ago - Apache 1.3.27 + PHP/4.2.3. Did you follow the other
instructions too? What is the error saing?
Todd Cary wrote:
I have Apache running on Windows XP, however I am having problems installing
PHP. My PHP directory is C:\Active_Php and the documents say that I should add
the following lines to httpd.conf:
LoadModule php4_module c:/Active_PhP/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
However, I get an error when Apache tries to load the dll. Has any successfully
installed PHP and Apache on Windows XP? If so, what changes are made to the
conf file?
Todd
--
Ariste Software, Petaluma, CA 94952
--- End Message ---
--- Begin Message ---
You should check the owner. However, this is not a php question, you
should really ask your ISP. You did not even tell what kind of file
manager it is.
Alberto Brea wrote:
When I upload php and other files and set the permissions on my ISP's (CPanel) file manager screen, sometimes the new permissions are set, other times they reset back to 644 without my knowing (so a visitor is unable to access the website, as the php scripts don't execute), and others the screen just refuses to save the new settings.
Could anybody tell me why is this?
Thanks in advance and merry Xmas and new year to everyone.
Alberto Brea
--- End Message ---
--- Begin Message ---
Make the "Delete" button a link with
href="delcategory.php?catid=$catid", maybe with additional
information so you can redirect the browser back to where it has been
(page #, parent category ...)
Cesar Aracena wrote:
Hi all,
I'm making the administration part of a site which handles categories,
sub categories and products. Inside the "Categories" part, there's a
"List categories" button which gives a list of the categories and sub
categories when pressed. Along with each category, there's a "Delete"
button that, when pressed, it's supposed to delete that category from
the DB. The problem here is that the lists is made dynamically using a
FOR loop and is being placed inside a FORM so the action is handled
through an ACTION="" tag.
Now, the ACTION tag points to a php file which deletes the desired row
in the DB. The question is how to tell that php file (through GET or
POST) which row to delete... My first shot was to name each "Delete" or
submit button inside form like "delcategory?catid=0001" but then the
POST wasn't reading that...
Any thoughts? Thanks in advance,
Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina
--- End Message ---
--- Begin Message ---
Thanks John and Marek for your fast responses. I made the decision to
opt for the "hidden" tag option. Now, I'll show you the part of my code
that hangs when trying to make what I intend it to do.
========================
$query1 = "DELETE * FROM maracat WHERE catid = $catid";
$result1 = mysql_query($query1) or die (mysql_errno());
$query2 = "DELETE * FROM marasubcat WHERE catid = $catid";
$result2 = mysql_query($query2) or die (mysql_errno());
$query3 = "DELETE * FROM maraprod WHERE catid = $catid";
$result3 = mysql_query($query3) or die (mysql_errno());
echo "Accion taken<br>";
echo "<a href=\"cat.php\" class=\"link2\">Back</a>";
========================
I know that it's very tedious to write 1 query for each action taking
place, but I think this is easier for me to change in the future. Now,
the page gets stuck when reaching this level and doesn't process what I
ordered... Any thoughts? Thanks in advance,
Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina
-----Mensaje original-----
De: John W. Holmes [mailto:[EMAIL PROTECTED]]
Enviado el: jueves, 26 de diciembre de 2002 18:32
Para: 'Cesar Aracena'; [EMAIL PROTECTED]
Asunto: RE: [PHP] Selecting what's for deletion
> I'm making the administration part of a site which handles categories,
> sub categories and products. Inside the "Categories" part, there's a
> "List categories" button which gives a list of the categories and sub
> categories when pressed. Along with each category, there's a "Delete"
> button that, when pressed, it's supposed to delete that category from
> the DB. The problem here is that the lists is made dynamically using a
> FOR loop and is being placed inside a FORM so the action is handled
> through an ACTION="" tag.
>
> Now, the ACTION tag points to a php file which deletes the desired row
> in the DB. The question is how to tell that php file (through GET or
> POST) which row to delete... My first shot was to name each "Delete"
or
> submit button inside form like "delcategory?catid=0001" but then the
> POST wasn't reading that...
>
> Any thoughts? Thanks in advance,
You could use a bunch of forms, if you want to use a button. Since
you're using a while() loop, it wouldn't be a big deal...
While(fetching_from_db)
{
<form>
<hidden cat_id>
Other data
<submit button>
</form>
}
Then the delete button on each row is for it's own form with a hidden
cat_id element that you can use to tell which row to delete.
Even better would be to use checkboxes, so you can delete multiple rows
at one. Name them <input type="checkbox" name="delete[]"
value="<?=$cat_id?>">
And when it's submitted all of the checked boxes will be in
$_POST['delete'], so you can do this:
$delete_ids = implode(",",$_POST['delete']);
$query = "DELETE FROM table WHERE ID IN ($delete_ids)";
Add in your own validation, of course...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> Thanks John and Marek for your fast responses. I made the decision to
> opt for the "hidden" tag option. Now, I'll show you the part of my
code
> that hangs when trying to make what I intend it to do.
>
> ========================
>
> $query1 = "DELETE * FROM maracat WHERE catid = $catid";
> $result1 = mysql_query($query1) or die (mysql_errno());
>
> $query2 = "DELETE * FROM marasubcat WHERE catid = $catid";
> $result2 = mysql_query($query2) or die (mysql_errno());
>
> $query3 = "DELETE * FROM maraprod WHERE catid = $catid";
> $result3 = mysql_query($query3) or die (mysql_errno());
>
> echo "Accion taken<br>";
> echo "<a href=\"cat.php\" class=\"link2\">Back</a>";
>
> ========================
>
> I know that it's very tedious to write 1 query for each action taking
> place, but I think this is easier for me to change in the future. Now,
> the page gets stuck when reaching this level and doesn't process what
I
> ordered... Any thoughts? Thanks in advance,
Do you get an errorno() or does it just not delete? It's better to echo
mysql_error() along with mysql_errno() in your die() statement.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--- End Message ---
--- Begin Message ---
Look at projects where it is done already (e.g. PhpNuke)
If the strings are static (simple translation of static strings), keep
it in a file as variables or constants, for
dynamic content you may use separate table for language independent
information and another table for
language dependent info, with corresponding id and language id.
Example:
table stocks: stock_id, price, quantity
table stock_description: stock_id, language_id, name, description
Html output: the user should have the necesery fonts installed, you just
need to output the correct header
about the charset being used, e.g. header('Content-type: text/html;
charset='. $charset); or <meta> tag
Denis L. Menezes wrote:
Hello friends,
As the subject suggests I am looking for language capabilitie on my php webpages.
Can someone please tell me which is a good way? I thought that I could have a database, but if so, can MySQL: handle multiple languages in the fields(like chinese language)? if this is possible, what about the html output : does the user need to install some fonts etc ?
Thanks very much
Denis
--- End Message ---
--- Begin Message ---
Hi guys !!
im starting on this list today so hello to everyone :-)
i have been programming in php for 2 years now, so i hope i may be
helpfull.
on the other hand im quite new to CLI PHP, an here my first question on
the list :
has anyone an idea of how can i do some kind of decent delay (instead of
some shell_exec doing pings) :-P
thanks,
regards ...
------------------------------------------------------------------
"Few are those who see with their own eyes and feel with their own
hearts."
Albert Einstein
-----------------------------------------------------------------
Maciek Ruckaber Bielecki
--- End Message ---
--- Begin Message ---
sleep();
usleep();
Maciek Ruckgaber Bielecki wrote:
Hi guys !!
im starting on this list today so hello to everyone :-)
i have been programming in php for 2 years now, so i hope i may be
helpfull.
on the other hand im quite new to CLI PHP, an here my first question on
the list :
has anyone an idea of how can i do some kind of decent delay (instead of
some shell_exec doing pings) :-P
thanks,
regards ...
------------------------------------------------------------------
"Few are those who see with their own eyes and feel with their own
hearts."
Albert Einstein
-----------------------------------------------------------------
Maciek Ruckaber Bielecki
--- End Message ---
--- Begin Message ---
At 03:55 AM 12/27/02 -0500, Maciek Ruckgaber Bielecki wrote:
has anyone an idea of how can i do some kind of decent delay (instead of
some shell_exec doing pings) :-P
Have you tried sleep()?
http://www.php.net/manual/en/function.sleep.php
Rick
--- End Message ---