php-general Digest 30 Aug 2003 23:26:18 -0000 Issue 2268
Topics (messages 161239 through 161278):
Re: Sotre image created by GD in db
161239 by: Boaz Yahav
161264 by: Baroiller Pierre-Emmanuel
Hello
161240 by: Sylvain Rayé
161241 by: Catalin Trifu
Frameworks
161242 by: Catalin Trifu
Using PHP to cache a flash movie
161243 by: Sid
161245 by: Catalin Trifu
161249 by: Sid
allow_call_time_pass_reference?
161244 by: Armand Turpel
161252 by: Curt Zirzow
161263 by: rush
161266 by: Armand Turpel
trouble with array_search
161246 by: Merlin
161248 by: Catalin Trifu
161251 by: Merlin
161253 by: Catalin Trifu
161254 by: Jim Lucas
161258 by: Merlin
superglobals?
161247 by: Stevie D Peele
161250 by: Catalin Trifu
Re: some html basics please
161255 by: Chris Shiflett
161256 by: Dennis Gearon
execute command line script from browser
161257 by: Rodney Green
Table format needs php correction
161259 by: Gloria L. McMillan
161260 by: Al
161261 by: Curt Zirzow
161262 by: andu
161270 by: Curt Zirzow
161272 by: Gloria L. McMillan
161273 by: Gloria L. McMillan
Re: Lack of info
161265 by: Senshi Oukan
161269 by: Curt Zirzow
PHP equivalent to MOD
161267 by: James Johnson
161268 by: James Johnson
Problems with $DOCUMENT_ROOT being blank
161271 by: brad e
Multiple word strings getting truncated - help please.
161274 by: James Johnson
161275 by: David Otton
Re: Pipe an email to PHP
161276 by: Thomas Tremain
Re: Solved. [PHP] Multiple word strings getting truncated - help please.
161277 by: James Johnson
PHP SESSION timeouts
161278 by: James Johnson
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 ---
Can you save it to a file?
If you can save it to a file, have a look at :
Saving Images in MySQL
http://www.weberdev.com/ViewArticle.php3?ArticleID=3
Sincerely
berber
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com
Search for PHP Code from your browser http://toolbar.weberdev.com
-----Original Message-----
From: Mohammadreza Hassanrezaeian [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 30, 2003 12:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sotre image created by GD in db
Dear Guys,
I want to store an image created by GD functions to a field of my DB. I
can not save it to a string to save it to blob field. Can any one help
me with a simple sample code? Regards, Mohammad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
you can do something like this :
<!-- code -->
$imgdata = addslashes(imagejpeg($imnew)); // For JPG file.
$query="INSERT INTO your_table (data) value ('$imgdata')";
$result = @mysql_query($query);
<!-- /code -->
I haven't try but it may work...
Regards.
P.E. Baroiller
"Mohammadreza Hassanrezaeian" <[EMAIL PROTECTED]> a écrit dans le message
de news:[EMAIL PROTECTED]
> Dear Guys,
> I want to store an image created by GD functions to a field of my DB. I
can
> not save it to a string to save it to blob field. Can any one help me with
a
> simple sample code?
> Regards,
> Mohammad
--- End Message ---
--- Begin Message ---
Hello,
I hope you will manage to help me. I have some troubles with this script and
I receive a message in the navigator :
if(is_uploaded_file($_FILES['image']['tmp_name']) &&
$_FILES['image']['size'] < $MAX_FILE_SIZE){
if(move_uploaded_file($_FILES['image']['tmp_name'],$dirroot."/images/photos_
elt/".$_FILES['image']['name']) && send_sql("INSERT INTO $table_categories
SET nom_cat = '".$info_admin['input_nom_element']."',image_cat =
'".$_FILES['image']['name']."', id_parent = $id_parent"))
$message = "La catégorie a bien été
ajoutée ";
else $message = "La catégorie n'a pas été
ajoutée car une erreur de chargement de fichier s'est produite.";
/* is_uploaded_ file() s'occupe de v„rifier si le fichier est
bien mis dans le dossier temporaire */
/* move_uploaded_file() s'occupe de t„l„charger le fichier dans
le dossier '../images/photos_elt/' */
/* $image_name est une variable contenant le nom du fichier et
est g„n„r„ automatiquement */
/* $image est le chemin et le nom du fichier enregistr„
temporairement */
/* la requete $sql est efectu„ si un fichier est existant sinon
une autre requƒte est faite */
}
elseif(send_sql("INSERT INTO $table_categories SET nom_cat =
'".$info_admin['input_nom_element']."', id_parent = $id_parent"))
$message = "La catégorie a bien été
ajoutée ";
else $message = "Catégorie non ajoutée, veuillez
contacter l'adiministrateur pour signaler une éventuelle anomalie en
décrivant l'anomalie..";
The message is :
Warning: Unable to create
'/home/sites/site82/web/images/photos_elt/ail.jpg': Permission denied in
/home/sites/site82/web/gestion_site/bve_navigation.php on line 73
Warning: Unable to move '/tmp/phpeZc96V' to
'/home/sites/site82/web/images/photos_elt/ail.jpg' in
/home/sites/site82/web/gestion_site/bve_navigation.php on line 73
Thanks a lot.
Sylvain
-------------------------------------
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi,
>The message is :
>Warning: Unable to create
>'/home/sites/site82/web/images/photos_elt/ail.jpg': Permission denied in
>/home/sites/site82/web/gestion_site/bve_navigation.php on line 73
it's obvious the user under which the apache server runs does not have
write permissions on /home/sites/site82/web/images/photos_elt
so: chmod it to permit writting. If the use is nobody i guess you have
to chmod it to 777
>Warning: Unable to move '/tmp/phpeZc96V' to
>'/home/sites/site82/web/images/photos_elt/ail.jpg' in
>/home/sites/site82/web/gestion_site/bve_navigation.php on line 73
same as above.
Cheers,
Catalin
--- End Message ---
--- Begin Message ---
Hi,
Don't know if this is the place to start this,
but I'd like to hear some pros and contras for
some frameworks out there (MVC mostly).
I mean, you have Placebo, Phrame, pehppy, aso.
I'm getting a little bit dizzy by how many there
are and I'd like to know your oppinions on them.
Catalin
--- End Message ---
--- Begin Message ---
Hello,
Does anyone know a method in which I can load a large flash movie in the background
and only when it is done, play it. In the mean time, the user should be able to carry
on surfing normally.
Any ideas?
Thank you,
- Sid
--- End Message ---
--- Begin Message ---
Hello,
Does anyone know a method in which I can load a large flash movie in the background and only when it is done, play it. In the mean time, the user should be able to carry on surfing normally.
Any ideas?
Thank you,
- Sid
Hi,
Simply put you can not! if the user moves from one page to another,
the old request goes bye! bye!
Cheers,
Catalin
--- End Message ---
--- Begin Message ---
Yes, But I was thinking of something like an invisible frame on top which
loads the movie
----- Original Message -----
From: "Catalin Trifu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 30 August 2003 Saturday 7:29 AM
Subject: [PHP] Re: Using PHP to cache a flash movie
> > Hello,
> >
> > Does anyone know a method in which I can load a large flash movie in the
background and only when it is done, play it. In the mean time, the user
should be able to carry on surfing normally.
> >
> > Any ideas?
> >
> > Thank you,
> >
> > - Sid
> >
>
> Hi,
>
> Simply put you can not! if the user moves from one page to another,
> the old request goes bye! bye!
>
> Cheers,
> Catalin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi,
Why allow_call_time_pass_reference is deprecated? I mean it should be the
choice of the programmer to make use of pass by reference or not.
Example:
$this_string = $is_really_big // lets say 500 kb
function ($this_string){} // Here the function takes a copy of $this_string
(500 kb) -> in php4
function (& $this_string){} // Here the function takes only the address of
$this_string (I guess an int value)
Make use of the second function is less memory intense. So again. Why this
feature should be deprecated? And why (the nonsens!) to give hostmasters the
possibility to switch this off in the php.ini?
Thanks
atu
--- End Message ---
--- Begin Message ---
* Thus wrote Armand Turpel ([EMAIL PROTECTED]):
> Why allow_call_time_pass_reference is deprecated? I mean it should be the
> choice of the programmer to make use of pass by reference or not.
>
> Example:
>
> $this_string = $is_really_big // lets say 500 kb
>
> function ($this_string){} // Here the function takes a copy of $this_string
> (500 kb) -> in php4
>
> function (& $this_string){} // Here the function takes only the address of
> $this_string (I guess an int value)
>
> Make use of the second function is less memory intense. So again. Why this
> feature should be deprecated? And why (the nonsens!) to give hostmasters the
> possibility to switch this off in the php.ini?
You aren't understanding what that flag does:
<php.ini>
; - allow_call_time_pass_reference = Off [Code cleanliness]
; It's not possible to decide to force a variable to be passed by reference
; when calling a function. The PHP 4 style to do this is by making the
; function require the relevant argument by reference.
</php.ini>
This flag does not apply to what you have above. What this disables
is the ablity to decide at 'call time', of the function, to pass by
reference or not. This was an old method and changed in php 4:
function foo($bar) { }
foo(&$mybar); // this is what it doesn't allow.
It is up to the function to declare if you want to pass by
reference or not, this is not depricated:
function foo_reference(&$bar) { }
function foo_copy($bar) { }
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
"Armand Turpel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> Why allow_call_time_pass_reference is deprecated? I mean it should be the
> choice of the programmer to make use of pass by reference or not.
maybe it was a problematicd idea to have call time decision in the first
place, and now they want it to put it to rest somehow. In all other
languages the decision is in the signature of the function, and there is no
ability to to have call time decision. Probably it causes implentation
problems and inconsistences, and needs to be eliminated before new 5.0
semantics is in the place.
rush
--
http://www.templatetamer.com/
--- End Message ---
--- Begin Message ---
Thanks for this clarification!
atu
----- Original Message -----
From: "Curt Zirzow" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 30, 2003 6:10 PM
Subject: Re: [PHP] allow_call_time_pass_reference?
> * Thus wrote Armand Turpel ([EMAIL PROTECTED]):
> > Why allow_call_time_pass_reference is deprecated? I mean it should be
the
> > choice of the programmer to make use of pass by reference or not.
> >
> > Example:
> >
> > $this_string = $is_really_big // lets say 500 kb
> >
> > function ($this_string){} // Here the function takes a copy of
$this_string
> > (500 kb) -> in php4
> >
> > function (& $this_string){} // Here the function takes only the address
of
> > $this_string (I guess an int value)
> >
> > Make use of the second function is less memory intense. So again. Why
this
> > feature should be deprecated? And why (the nonsens!) to give hostmasters
the
> > possibility to switch this off in the php.ini?
>
> You aren't understanding what that flag does:
>
> <php.ini>
> ; - allow_call_time_pass_reference = Off [Code cleanliness]
> ; It's not possible to decide to force a variable to be passed by
reference
> ; when calling a function. The PHP 4 style to do this is by making
the
> ; function require the relevant argument by reference.
> </php.ini>
>
> This flag does not apply to what you have above. What this disables
> is the ablity to decide at 'call time', of the function, to pass by
> reference or not. This was an old method and changed in php 4:
>
>
> function foo($bar) { }
> foo(&$mybar); // this is what it doesn't allow.
>
>
> It is up to the function to declare if you want to pass by
> reference or not, this is not depricated:
>
> function foo_reference(&$bar) { }
> function foo_copy($bar) { }
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--- End Message ---
--- Begin Message ---
Hi there,
I am having somee trouble with array_search.
The function should search for a given date, but it does not work since
array_search seems only to compare strings. Thats why I tryed to cast
it, but does not help.
Here is the problem:
(pseudo code)
while(...
$log[date][] = (string)date('mdY',$row->timestamp)
$date_search = '03042003';
$search = array_search($date_search, $dates);
if ($search !== NULL)
echo 'works';
it always returns 0
Thanx for any help on that,
Merlin
--- End Message ---
--- Begin Message ---
Hi,
You don't have to convert to string; PHP does it
automatically.
Did you check for the $dates array, does it really contain
what you think it should.
So, try to make a print_r($dates) and see if you have what you expect.
FYI: array_search() returns the key of the last found element
(if any)
Cheers,
Catalin
Hi there,
I am having somee trouble with array_search.
The function should search for a given date, but it does not work since
array_search seems only to compare strings. Thats why I tryed to cast
it, but does not help.
Here is the problem:
(pseudo code)
while(...
$log[date][] = (string)date('mdY',$row->timestamp)
$date_search = '03042003';
$search = array_search($date_search, $dates);
if ($search !== NULL)
echo 'works';
it always returns 0
Thanx for any help on that,
Merlin
--- End Message ---
--- Begin Message ---
I printed the values out, and inserted it into a varibble to check if it
finds it. In this case it works! But it only wokes if I do it like this:
array('03042003');
This does not work:
array(03042003);
So I gues it has something to do with this? It really drives me crecy, I
already spent an hour on it :-(
Merlin
Catalin Trifu wrote:
Hi,
You don't have to convert to string; PHP does it
automatically.
Did you check for the $dates array, does it really contain
what you think it should.
So, try to make a print_r($dates) and see if you have what you expect.
FYI: array_search() returns the key of the last found element
(if any)
Cheers,
Catalin
Hi there,
I am having somee trouble with array_search.
The function should search for a given date, but it does not work
since array_search seems only to compare strings. Thats why I tryed to
cast it, but does not help.
Here is the problem:
(pseudo code)
while(...
$log[date][] = (string)date('mdY',$row->timestamp)
$date_search = '03042003';
$search = array_search($date_search, $dates);
if ($search !== NULL)
echo 'works';
it always returns 0
Thanx for any help on that,
Merlin
--- End Message ---
--- Begin Message ---
Hi,
I printed the values out, and inserted it into a varibble to check if it
finds it. In this case it works! But it only wokes if I do it like this:
array('03042003');
This does not work:
array(03042003);
When you make array(03042003) what you get is an array like this
Array ( 0 => 3042003 ); PHP convers the string you got from date to an
integer.
So when adding the results from date() to the $dates array, you should
keep them as strings.
you could say
$d = date('mdY', timestamp);
$dates[] = "$d";//this will keep the variable added as string
Cheers,
Catalin
--- End Message ---
--- Begin Message ---
the problem is, when you do it the second way, it drops the leading zero off
the number.
and the first way you are telling it that you are setting a string.
Try this.
print_r(array(001,'001',002,'002'));
you will notice that on two of them, you don't see the leading zeros, that
is because normal integers do not retain their leading zeros even if you
enter them.
Jim Lucas
----- Original Message -----
From: "Merlin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 30, 2003 9:02 AM
Subject: [PHP] Re: trouble with array_search
> I printed the values out, and inserted it into a varibble to check if it
> finds it. In this case it works! But it only wokes if I do it like this:
>
> array('03042003');
>
> This does not work:
> array(03042003);
>
> So I gues it has something to do with this? It really drives me crecy, I
> already spent an hour on it :-(
>
> Merlin
>
>
>
> Catalin Trifu wrote:
>
> > Hi,
> >
> > You don't have to convert to string; PHP does it
> > automatically.
> > Did you check for the $dates array, does it really contain
> > what you think it should.
> > So, try to make a print_r($dates) and see if you have what you expect.
> > FYI: array_search() returns the key of the last found element
> > (if any)
> >
> > Cheers,
> > Catalin
> >
> >
> >> Hi there,
> >>
> >> I am having somee trouble with array_search.
> >>
> >> The function should search for a given date, but it does not work
> >> since array_search seems only to compare strings. Thats why I tryed to
> >> cast it, but does not help.
> >>
> >> Here is the problem:
> >>
> >> (pseudo code)
> >>
> >>
> >> while(...
> >> $log[date][] = (string)date('mdY',$row->timestamp)
> >>
> >> $date_search = '03042003';
> >>
> >> $search = array_search($date_search, $dates);
> >> if ($search !== NULL)
> >> echo 'works';
> >>
> >> it always returns 0
> >>
> >> Thanx for any help on that,
> >>
> >> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
thank you for your help. I have found that the error was laying
somewhere else. The code like you wrote was ok.
Cheers,
merlin
Catalin Trifu wrote:
Hi,
I printed the values out, and inserted it into a varibble to check if
it finds it. In this case it works! But it only wokes if I do it like
this:
array('03042003');
This does not work:
array(03042003);
When you make array(03042003) what you get is an array like this
Array ( 0 => 3042003 ); PHP convers the string you got from date to an
integer.
So when adding the results from date() to the $dates array, you should
keep them as strings.
you could say
$d = date('mdY', timestamp);
$dates[] = "$d";//this will keep the variable added as string
Cheers,
Catalin
--- End Message ---
--- Begin Message ---
What do we call things like this -- $_POST['name'], $_SERVER['remote
add']
Are they superglobals and where can I find a list of these?
Thanks
________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!
--- End Message ---
--- Begin Message ---
Stevie D Peele wrote:
What do we call things like this -- $_POST['name'], $_SERVER['remote
add']
Are they superglobals and where can I find a list of these?
Thanks
________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!
Hi,
Superglobals are those variables defined by PHP, like
$_SERVER, $_REQUEST, etc.
(http://de3.php.net/manual/en/language.variables.predefined.php)
User defined superglobals do not exist (yet at least)
In the exmple above the variables are $_SERVER and $_POST
the others are just members of the respective arrays.
Cheers,
Catalin
--- End Message ---
--- Begin Message ---
--- Dennis Gearon <[EMAIL PROTECTED]> wrote:
> It seems that HTML is LAME, LAME,LAME when it comes to determining
> local directories.
I think you just need to understand how filesystems work and what a URL is.
../ is the parent directory
./ is the current directory
/ is the root directory
If you reference /image.png from a page found at
http://example.org/foo/bar.php, the browser will request the resource at
http://example.org/image.png. If you reference ./image.png or even just
image.png in that page, the browser will request
http://example.org/foo/image.png.
Just remember that the browser is the one interpreting the path and requesting
the URL, which is why / references document root and not the root directory of
the filesystem.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:
../ is the parent directory
./ is the current directory
/ is the root directory
I knew that ./ was the current directory on a *nix system, but a browser
will respect that also?
--- End Message ---
--- Begin Message ---
Is there a way to execute a command line php script from a browser by, say
clicking a button and then having the browser let go and let the script run
independet of the browser? Hope I explained that correctly.
Thanks,
Rod
********************************************
CinchHost.com - Web Hosting Made Easier
ASP, PHP, CGI, WEBMAIL, And More
Packages as Low as $9.99 - No Set Up fees
http://www.cinchhost.com/
********************************************
--- End Message ---
--- Begin Message ---
Hi!
This is a problem of the table formatting on a form in MySQL and PHP.
It may be in the HTML table code.
The problem is one that must be frequent. I have a mixture of one character
and long fill-in text items.
My table now looks awkward. Somebody gave me a complex table that puts colors as
backgrounds
behind the headers. Could that be the problem? -Gloria
Here is the URL to view PHP HTML table as it appears on screen:
http://DakotaCom.net/~glomc/forms/CAT.php
Here is the mysql create table structure file:
#
# Table structure for table 'CAT'
#
CREATE TABLE CAT (
id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
name varchar(50) NOT NULL,
course varchar(50) NOT NULL,
unit varchar(50) NOT NULL,
q1 text NOT NULL,
q2 text NOT NULL,
q3 text NOT NULL,
q4 text NOT NULL,
q5 varchar(10) NOT NULL,
q6 varchar(10) NOT NULL,
q7 varchar(10) NOT NULL,
PRIMARY KEY (id)
);
Here is the table HTML part of the PHP file:
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
*/
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
printf("
<div class=\"colorfield\">
<table>
<tr><th>Date</th><th>Name</th><th>Course</th><th>Unit</th>\n
<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n
<tr><th = colspan = 4> Q1 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q2 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q3 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q4 </th>\n
<tr><td>%s</td>\n
<tr><th>Q5</th><th>Q6</th><th>Q7</th>\n
<tr><td>%s</td><td>%s</td><td>%s</td>\n
</table>
</div>\n",
$row['added'],
$row['name'],
$row['course'],
$row['unit'],
$row['q1'],
$row['q2'],
$row['q3'],
$row['q4'],
$row['q5'],
$row['q6'],
$row['q7']);
}
/* Free resultset */
mysql_free_result($result);
/* Close the database connection */
mysql_close($link);
?>
</body>
</html>
--- End Message ---
--- Begin Message ---
There are too many problems with your code for anyone to spend the time
going thru them all.
I'd suggest, first constructing a regular html table that looks like you
want it to. Hint, IE6 requires something in TDs [e.g., ] for
borders to show.
When the table looks the way you want it to, validate the code at
http://validator.w3.org/
Then work on your php code to generate the exact same html.
Gloria L. McMillan wrote:
Hi!
This is a problem of the table formatting on a form in MySQL and PHP.
It may be in the HTML table code.
The problem is one that must be frequent. I have a mixture of one character
and long fill-in text items.
My table now looks awkward. Somebody gave me a complex table that puts colors as
backgrounds
behind the headers. Could that be the problem? -Gloria
Here is the URL to view PHP HTML table as it appears on screen:
http://DakotaCom.net/~glomc/forms/CAT.php
Here is the mysql create table structure file:
#
# Table structure for table 'CAT'
#
CREATE TABLE CAT (
id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
name varchar(50) NOT NULL,
course varchar(50) NOT NULL,
unit varchar(50) NOT NULL,
q1 text NOT NULL,
q2 text NOT NULL,
q3 text NOT NULL,
q4 text NOT NULL,
q5 varchar(10) NOT NULL,
q6 varchar(10) NOT NULL,
q7 varchar(10) NOT NULL,
PRIMARY KEY (id)
);
Here is the table HTML part of the PHP file:
print "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
*/
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
printf("
<div class=\"colorfield\">
<table>
<tr><th>Date</th><th>Name</th><th>Course</th><th>Unit</th>\n
<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n
<tr><th = colspan = 4> Q1 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q2 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q3 </th>\n
<tr><td>%s</td>\n
<tr><th = colspan = 4> Q4 </th>\n
<tr><td>%s</td>\n
<tr><th>Q5</th><th>Q6</th><th>Q7</th>\n
<tr><td>%s</td><td>%s</td><td>%s</td>\n
</table>
</div>\n",
$row['added'],
$row['name'],
$row['course'],
$row['unit'],
$row['q1'],
$row['q2'],
$row['q3'],
$row['q4'],
$row['q5'],
$row['q6'],
$row['q7']);
}
/* Free resultset */
mysql_free_result($result);
/* Close the database connection */
mysql_close($link);
?>
</body>
</html>
--- End Message ---
--- Begin Message ---
* Thus wrote Gloria L. McMillan ([EMAIL PROTECTED]):
> Hi!
Hello Gloria,
>
> This is a problem of the table formatting on a form in MySQL and PHP.
> It may be in the HTML table code.
> ...
> Here is the URL to view PHP HTML table as it appears on screen:
> http://DakotaCom.net/~glomc/forms/CAT.php
I think you need to take a step back for a moment. First consider
how you want the data to be presented in html, then the php code
will be very simple.
>From what I see and how I would prefer to set the layout would be
something like this:
Date Name Course Unit
Aug 30 2003 Gloria WRT 102 Fall 03 Essay 1
Q1 data for q1
Q2 data for q2
...
Then easily put that into a html table structure:
<tr>
<td>Date</td><td>Name</td><td>Course</td><td>Unit</td>
</tr>
<tr>
<td>Aug 30 2003</td><td>Gloria </td><td>WRT 102 Fall 03</td><td>Essay 1</td>
</tr>
<tr>
<td>Q1</td><td colspan="3">data for q1</td>
</tr>
<tr>
<td>Q2</td><td colspan="3">data for q2</td>
<tr>
...
Now inside your fetch_array loop just use that template above using
php variables instead of text and table column attributes in the
appropriate places will result in a decent looking site.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
On Sat, 30 Aug 2003 10:23:49 -0700
"Gloria L. McMillan" <[EMAIL PROTECTED]> wrote:
> Hi!
>
> This is a problem of the table formatting on a form in MySQL and PHP.
> It may be in the HTML table code.
>
> The problem is one that must be frequent. I have a mixture of one
> character and long fill-in text items.
>
> My table now looks awkward. Somebody gave me a complex table that puts
> colors as backgrounds behind the headers. Could that be the problem?
> -Gloria
The SQL has nothing to do with it (though make sure the query returns
what you expect), it's just how you format the table with the data you
have. My advice is to start it simple with no colors or stuff like that
and work on it until you get the proper table (html). Forget about using
other people's code in something like this and try to understand the
logic before you get to beautifying your output. I just spent the last
couple of days with tables formating, css, etc....
>
>
> Here is the URL to view PHP HTML table as it appears on screen:
> http://DakotaCom.net/~glomc/forms/CAT.php
>
> Here is the mysql create table structure file:
>
> #
> # Table structure for table 'CAT'
> #
>
> CREATE TABLE CAT (
> id int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
> added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
> name varchar(50) NOT NULL,
> course varchar(50) NOT NULL,
> unit varchar(50) NOT NULL,
> q1 text NOT NULL,
> q2 text NOT NULL,
> q3 text NOT NULL,
> q4 text NOT NULL,
> q5 varchar(10) NOT NULL,
> q6 varchar(10) NOT NULL,
> q7 varchar(10) NOT NULL,
> PRIMARY KEY (id)
> );
>
>
> Here is the table HTML part of the PHP file:
>
> print "<table>\n";
> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
> print "\t<tr>\n";
> foreach ($line as $col_value) {
> print "\t\t<td>$col_value</td>\n";
> }
> print "\t</tr>\n";
> }
> print "</table>\n";
> */
> while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
> printf("
> <div class=\"colorfield\">
> <table>
> <tr><th>Date</th><th>Name</th><th>Course</th><th>Unit</th>\n
>
> <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n
>
> <tr><th = colspan = 4> Q1 </th>\n
> <tr><td>%s</td>\n
>
> <tr><th = colspan = 4> Q2 </th>\n
> <tr><td>%s</td>\n
>
> <tr><th = colspan = 4> Q3 </th>\n
> <tr><td>%s</td>\n
>
> <tr><th = colspan = 4> Q4 </th>\n
> <tr><td>%s</td>\n
>
> <tr><th>Q5</th><th>Q6</th><th>Q7</th>\n
>
> <tr><td>%s</td><td>%s</td><td>%s</td>\n
> </table>
>
>
> </div>\n",
> $row['added'],
> $row['name'],
> $row['course'],
> $row['unit'],
> $row['q1'],
> $row['q2'],
> $row['q3'],
> $row['q4'],
> $row['q5'],
> $row['q6'],
> $row['q7']);
>
> }
>
> /* Free resultset */
> mysql_free_result($result);
>
> /* Close the database connection */
> mysql_close($link);
>
> ?>
> </body>
> </html>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
Regards, Andu Novac
--- End Message ---
--- Begin Message ---
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> * Thus wrote Gloria L. McMillan ([EMAIL PROTECTED]):
> > Hi!
>
> Hello Gloria,
>
> >
> > This is a problem of the table formatting on a form in MySQL and PHP.
> > It may be in the HTML table code.
> > ...
> > Here is the URL to view PHP HTML table as it appears on screen:
> > http://DakotaCom.net/~glomc/forms/CAT.php
>
> I think you need to take a step back for a moment. First consider
> how you want the data to be presented in html, then the php code
> will be very simple.
Ok, I had a little extra time this morning :)
http://zirzow.dyndns.org/html/php/html/table.php
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Thanks but the lines are all running together in that URL.
I don't know why.
They are not breaking at the end of each line.
Could you re-save a different way?
Maybe send to me as a text file?
Thanks,
Gloria
Curt Zirzow wrote:
> * Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> > * Thus wrote Gloria L. McMillan ([EMAIL PROTECTED]):
> > > Hi!
> >
> > Hello Gloria,
> >
> > >
> > > This is a problem of the table formatting on a form in MySQL and PHP.
> > > It may be in the HTML table code.
> > > ...
> > > Here is the URL to view PHP HTML table as it appears on screen:
> > > http://DakotaCom.net/~glomc/forms/CAT.php
> >
> > I think you need to take a step back for a moment. First consider
> > how you want the data to be presented in html, then the php code
> > will be very simple.
>
> Ok, I had a little extra time this morning :)
>
> http://zirzow.dyndns.org/html/php/html/table.php
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
This is all so advanced. Is it ready to be in place of the table HTML that I already
have?
I copied it to word and saved it as a .txt file. IN IE it looked better than in my
Netscape.
Gloria
Curt Zirzow wrote:
> * Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> > * Thus wrote Gloria L. McMillan ([EMAIL PROTECTED]):
> > > Hi!
> >
> > Hello Gloria,
> >
> > >
> > > This is a problem of the table formatting on a form in MySQL and PHP.
> > > It may be in the HTML table code.
> > > ...
> > > Here is the URL to view PHP HTML table as it appears on screen:
> > > http://DakotaCom.net/~glomc/forms/CAT.php
> >
> > I think you need to take a step back for a moment. First consider
> > how you want the data to be presented in html, then the php code
> > will be very simple.
>
> Ok, I had a little extra time this morning :)
>
> http://zirzow.dyndns.org/html/php/html/table.php
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
IM not ranting, IM pointing out that I have looked on the website and the
FAQ is a joke and help from other sources is either buy something or as the
case of IRC, no channel of that description was turned up in the search.
Out of fustration and spending several attempts to implement PHP and IM
doubting weather or not its worth all this bother, I cant get the help IM
looking for, FAQ has not got my particular issue listed and now I have
resorted to direct contact as I cant get any straight answer or link to
somewhere that does not sell me something or ask for membership or payment
of any kind. The IRC sounded a good deal better but even then the #php
channel is not listed, I try to join the #php channel and nothing....
I followed the set up a from the examples in the acompanying documentation
which is very sketchy at best and all you state is after install the php.ini
file needs putting in the %system root% and configuring... well I did all
that, What I want to know is information on what is acceptable info that
should be used in the config...nice to say it needs configuring, perhaps you
could enlighten me as to all the terms and what they are meant for and what
data needs putting into the fields? I also want to know how I know its
installed and functioning as I have no idea if its functioning.
So IM stuck, fustrated as this is about the 5th time I have tried to tackle
the problem over as many months but cant get the information on what I need
to do to get it up and running, the FAQ is a joke, more info on LINUX than
you can shake a stick at, if you care to look at the site you will see the
word LINUX poping up ever few lines or so.....all IM trying to do is set up
a messaging board, either Snitz forums or phpBB2, and they both use PHP.
It is no good either hi-lighting that 100's of other people have no problem
using it, mabey so, but how many 1,000s have had problems and not chased it
up? Chances are those users will have grown up and been taught that in
school or know people who understand the config of it, IM a lot longer in
tooth and have no prior knowledge of PC technology other than what I left
school with some 25 years ago, so simply stating a fact like that does not
remedy the situation and I dont think you appreciate my position when I say
that my knowledge although patchy, I have problems when setups and setup
information waffels on about terms and items that have no meaning and have
no explanation other than another jargon word or tech term... the basics of
setting up operating systems and servers is childs play as is building PCs
from scratch but compaired to setting up PHP, it has become a nightmare of
biblical proportions.
One final thing is if PHP is so easy to set up, why am I having problems?
and why is their so little help in the FAQ ?
Perhaps you should have an FAQ for newbies, no jargon or tech speak, just
information presented in a package that everyone can understand.
I really would appreciate some help, as the info IM looking for is not
listed in your FAQ.
----- Original Message -----
From: "Gabor Hojtsy" <[EMAIL PROTECTED]>
To: "Senshi Oukan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, August 30, 2003 4:47 PM
Subject: Re: Lack of info
> > Been down that road and it got me knowhere, I dont wish to buy
information
> > or books, I just need to know if its running as well as if its working
and
> > if the config or rather how the config works...
> >
> > For an organisation that wants people to use PHP, you sure make things
very
> > difficult to achieve, why I am so critical of sites like yours.
> >
> > I will re-iterate once more, I have trawled the site and resources and
> > cannot find the answer to my problem anywhere in the site or links you
> > provide, plenty of waffel and hot air but no nuts and bolts stuff, if
you
> > dont know what IM talking about??? IM talking about the info to make it
work
> > as at the moment it is just occupying hard drive space which I could put
to
> > better use if this is the level of support that you get from PHP.
> >
> > So...2nd time around and I hope you read the email before you reply.
> >
> > Can I have access to the information I need if you have it? You have
plenty
> > of advice for Linux users, what about us Windows users? Running Linux is
not
> > an option IM afraid.
>
> What do you think how much of our users set up PHP on windows and on
> linux? See http://php.net/usage, and see yourself that we have a lot of
> users around the world.
>
> Guys working on the PHP engine, extensions, documentation, etc. all do
> their work for free, including me. We are not interested in getting
> every single person to use PHP. If you find some other solution better
> suited for you, then choose that one. The numbers show that there is a
> huge number of users finding PHP easy to set up and run, and that we
> (and all the sites covering PHP on the net) provide proper support for
> what we develop for free and give out for free.
>
> If you would like to get an answer, ask a question first. But please
> forward that to [EMAIL PROTECTED], and take my advice on
> omitting rants from that letter, or otherwise you will not receive an
> answer. Consider the IRC channels, forums, local user groups,
> conferences, books, tutorial sites, windows quick installation kits
> linked from our site.
>
> Goba
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
--- End Message ---
--- Begin Message ---
* Thus wrote Senshi Oukan ([EMAIL PROTECTED]):
> IM not ranting, IM pointing out that I have looked on the website and the
> FAQ is a joke and help from other sources is either buy something or as the
> case of IRC, no channel of that description was turned up in the search.
Apparently you have a problem with reading. You did exactly the
*opposite* of what Goba suggested and took your rant, and then some,
to this list.
>
> ----- Original Message -----
> From: "Gabor Hojtsy" <[EMAIL PROTECTED]>
> To: "Senshi Oukan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, August 30, 2003 4:47 PM
> Subject: Re: Lack of info
>
>
> > > Been down that road and it got me knowhere, I dont wish to buy
> information
> > > or books, I just need to know if its running as well as if its working
> and
> > > {snip a bunch of ranting )
> >
> > what we develop for free and give out for free.
> >
> > If you would like to get an answer, ask a question first. But please
> > forward that to [EMAIL PROTECTED], and take my advice on
> > omitting rants from that letter, or otherwise you will not receive an
> > answer. Consider the IRC channels, forums, local user groups,
> > conferences, books, tutorial sites, windows quick installation kits
> > linked from our site.
> >
> > Goba
>
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Hi,
I need to see if a number is divisible by 2. I don't see the math function
"mod" in my PHP Functions reference manual. Is there another way to do this?
Thanks,
James
--- End Message ---
--- Begin Message ---
Nevermind, I found it in the archives.
Thanks
-----Original Message-----
From: James Johnson [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 30, 2003 12:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP equivalent to MOD
Hi,
I need to see if a number is divisible by 2. I don't see the math function
"mod" in my PHP Functions reference manual. Is there another way to do this?
Thanks,
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I set up a PHP4.3.3/mySQL4.0.14/Apache2.0.47 server and everythign is
configured and running properly. i tested php with some scripts and
functions and they all work. When i try and do any file editing/including in
scripts i get file not found errors all over the place when i open like
$DOCUMENT_ROOT/some/file/location. if i manually describe the location as in
/usr/local/some/file/location it works fine. When i echo $DOCUMENT_ROOT i
get nothing (literally ''). I have set my doc root folder in php.ini, but it
doesnt echo that. any ideas?
--- End Message ---
--- Begin Message ---
Hi,
I have a form for a member to signup for an account. The form has standard
fields for addresses, city state, etc. When I insert the data into the
table, if the string has more than one word, it gets truncated to the first
word.
Does this sound like a PHP or a MySQL problem.
Here's the code: (partial as the query is quite long)
$tr_addr1 = $_POST['addr1']
$query = "INSERT INTO subscribers (addr1) VALUES('$tr_addr1')";
The MySQl table is as such:
addr1 = varchar(50)
Thanks,
James
--- End Message ---
--- Begin Message ---
On Sat, 30 Aug 2003 14:52:30 -0700, you wrote:
>I have a form for a member to signup for an account. The form has standard
>fields for addresses, city state, etc. When I insert the data into the
>table, if the string has more than one word, it gets truncated to the first
>word.
>
>Does this sound like a PHP or a MySQL problem.
>
>Here's the code: (partial as the query is quite long)
Odd. Try this
$tr_addr1 = mysql_escape_string ($_POST['addr1']);
$query = "INSERT INTO subscribers (addr1) VALUES('$tr_addr1')";
echo ("$query<br>");
And tell us what you get. Then you at least know whether it's a MySQL
problem or an HTML/PHP problem.
Hmm. You are quoting your HTML attributes, right? That's the only thing I
can think of that even comes close to the behaviour you describe.
--- End Message ---
--- Begin Message ---
I resolved my problem several days later, and I thought I might post it for
those that come up behind me.
I had several blank lines in my .php file after the closing ?>
This caused an output of the script (even though I could not see it) which
generated the failure notice within Exim.
Thomas Tremain
www.LiveHost.net
www.GotoNames.com
www.TrafficExaminer.com
--- End Message ---
--- Begin Message ---
Hi David,
>From your suggestion, I found the problem. I'm validating the form and if
something isn't correct, I'm not doing the query, but maintaining what the
user previously entered with the following code:
<?php if(isset($_POST['addr1'])){$a1 = $_POST['addr1'];}else{$a1 = "";}?>
<input type="text" name="addr1" size="32" value="<?php echo $a1; ?>">
In some of the input tags, I hadn't put quotes around the value.
Thanks,
James
-----Original Message-----
From: David Otton [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 30, 2003 3:24 PM
To: James Johnson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Multiple word strings getting truncated - help please.
On Sat, 30 Aug 2003 14:52:30 -0700, you wrote:
>I have a form for a member to signup for an account. The form has
>standard fields for addresses, city state, etc. When I insert the data
>into the table, if the string has more than one word, it gets truncated
>to the first word.
>
>Does this sound like a PHP or a MySQL problem.
>
>Here's the code: (partial as the query is quite long)
Odd. Try this
$tr_addr1 = mysql_escape_string ($_POST['addr1']);
$query = "INSERT INTO subscribers (addr1) VALUES('$tr_addr1')"; echo
("$query<br>");
And tell us what you get. Then you at least know whether it's a MySQL
problem or an HTML/PHP problem.
Hmm. You are quoting your HTML attributes, right? That's the only thing I
can think of that even comes close to the behaviour you describe.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
Can't find this in any of my books. Is there a default for when the
$_SESSION array times out i.e., it's no longer available for the code?
Thanks,
James
--- End Message ---