php-general Digest 24 Jun 2001 11:57:04 -0000 Issue 717
Topics (messages 54994 through 55016):
Running external programs
54994 by: Beginning PHP Programmer
PhpDEV
54995 by: Brett Shaw
Re: variables / reading files
54996 by: Christopher Ostmo
55006 by: Michael Hall
PHP 4.0.6 + GD 2.0.1
54997 by: Ben Gollmer
PEAR
54998 by: Jason Lustig
55016 by: Alexander Wagner
Output an image stream?
54999 by: Todd Cary
55013 by: Matt McClanahan
Re: mysql_free_result() question
55000 by: Jakob Kruse
Re: newbie algorithm help!!!!!
55001 by: Warren Vail
Events Listings
55002 by: Rick Proctor
Php Files on Browser
55003 by: Ted Shaw
Re: OOP
55004 by: Aral Balkan
55012 by: Matthew M. Boulter
Creating formatted documents
55005 by: Todd Cary
RSVP script anyone ???
55007 by: Carmen & Gene
->>coding help
55008 by: McShen
55009 by: Carmen & Gene
55011 by: Jason Lotito
PHP 4.07-dev + Apache 2.0.19-dev
55010 by: Gonyou, Austin
Running scripts from within PHP similar to SSI
55014 by: Bilal Deniz
freebsd and exec problem
55015 by: Gary Starks
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]
----------------------------------------------------------------------
Hi:
I´m using PHP4 on IIS 5 on Windows 2000 Server and
it works fine.
The Microsoft NNTP Service from IIS 5 can be
managed from command shell with commands like this bellow:
cscript d:\\temp\\rgroup.vbs -t a -g
new.group.01
And it works also fine in my system.
But, when I try to run a program from a simple PHP
script like the following:
<? $commandstring =
"cscript d:\\temp\\rgroup.vbs -t a -g new.group.01";
passthru($commandstring); ?>
I get this Warning..
Warning: Unable to fork [cscript
d:\temp\rgroup.vbs -t a -g new.group.01] in
d:\inetpub\wwwroot\nntpadm\creategroup.php on line 3
What am I doing
wrong?
Thanks in advance.
|
www.oosha.com/phpdev/index.php3
Ive had some great response to the site but not as much as id hoped if you
have any ideas please email them to me and ill implement them
--
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Michael Hall pressed the little lettered thingies in this order...
>
> I'm stuck on a piece of code for a shopping cart.
>
> I'm on the final page where the buyer clicks BUY and several things
> happen. I want to loop through the table that stores the session info and
> extract details such as item, price, quantity, subtotal and assign all this
> info to one variable:
>
> $var = the output of a while($row = mysql_fetch_array($query)) statement
>
> Why I'm trying to do this is I'd like to store all the purchase details in
> one variable for inclusion in an email:
>
> $message = $var; // (from above)
> mail($address,$subject,$message);
>
> I'd also like to put the info in that same variable into a table that
> records actual sales data:
>
> $details = $var;
> insert into table ('details') values ('$details');
>
> I know there must be a (probably very easy) way, but just can't crack it.
>
$result = mysql("DBName","QUERY");
while ($row = mysql_fetch_row($result)) {
$var = $row[0];
$message .= $var;
}
$details = $message
The period and equal sign cause $message to prepend itself to $var.
This is the same thing as writing:
$message = $message."$var";
In either case, $message is preserved and added to on each loop. That
being the case, if you are puting this into an e-mail message, you
probably want to add line breaks after each line:
$message .= $var."\n";
Check out string operators:
http://www.php.net/manual/en/language.operators.string.php
and assignement operators:
http://www.php.net/manual/en/language.operators.assignment.php
Good luck...
Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
Meeting cutting edge dynamic
web site needs
For a good time,
http://www.AppIdeas.com/
OK, thanks for that Chris.
I did get it in the end, with something very similar to what you
suggested:
$message = "";
while ( .... )
{
$var1 = $row["1"];
... etc
$item = "$var1 $var2 $var3 etc";
$message = $message . $item . "\n";
}
Your solution is cleaner so I'll change it over. I'd written the whole
cart in one sitting up to then, and was fairly cross-eyed by that stage.
On Sat, 23 Jun 2001, Christopher Ostmo wrote:
> Michael Hall pressed the little lettered thingies in this order...
>
> >
> > I'm stuck on a piece of code for a shopping cart.
> >
> > I'm on the final page where the buyer clicks BUY and several things
> > happen. I want to loop through the table that stores the session info and
> > extract details such as item, price, quantity, subtotal and assign all this
> > info to one variable:
> >
> > $var = the output of a while($row = mysql_fetch_array($query)) statement
> > A
> > Why I'm trying to do this is I'd like to store all the purchase details in
> > one variable for inclusion in an email:
> >
> > $message = $var; // (from above)
> > mail($address,$subject,$message);
> >
> > I'd also like to put the info in that same variable into a table that
> > records actual sales data:
> >
> > $details = $var;
> > insert into table ('details') values ('$details');
> >
> > I know there must be a (probably very easy) way, but just can't crack it.
> >
>
> $result = mysql("DBName","QUERY");
> while ($row = mysql_fetch_row($result)) {
> $var = $row[0];
>
> $message .= $var;
> }
> $details = $message
>
> The period and equal sign cause $message to prepend itself to $var.
> This is the same thing as writing:
> $message = $message."$var";
>
> In either case, $message is preserved and added to on each loop. That
> being the case, if you are puting this into an e-mail message, you
> probably want to add line breaks after each line:
> $message .= $var."\n";
>
> Check out string operators:
> http://www.php.net/manual/en/language.operators.string.php
> and assignement operators:
> http://www.php.net/manual/en/language.operators.assignment.php
>
> Good luck...
>
> Christopher Ostmo
> a.k.a. [EMAIL PROTECTED]
> AppIdeas.com
> Meeting cutting edge dynamic
> web site needs
>
> For a good time,
> http://www.AppIdeas.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
Hi all-
Is anyone using PHP 4.0.6 with GD 2.0.1? (yes I like to live on the
bleeding edge :-)
I'm developing an application that does a lot of image operations and
would like to be able to use the new ImageCopyResampled() and
ImageCreateFromString() functions.
I'm using PHP 4.0.6 with GD 1.8.4 right now, and all is well. However,
when I install GD 2.0.1, PHP's make dies, saying there is something
wrong with gdio.h. I've removed all GD 1.8.4 bits from my box, just in
case there is a library conflict; and the --with-gd-[DIR] is set
correctly during PHP's ./configure, but make still goes kablooey.
TIA,
Ben Gollmer
I just installed PHP 4.06 on my setup, and noticed that there's a bunch of
classes/scripts in the /pear directory. Does anyone know what the status of
these scripts are, as in if they are finished quality (ie, they can be used
successfully on websites)? I thought that PEAR was still being developed.
--Jason
Hiho,
Jason Lustig wrote:
> I just installed PHP 4.06 on my setup, and noticed that there's a bunch of
> classes/scripts in the /pear directory. Does anyone know what the status of
> these scripts are, as in if they are finished quality (ie, they can be used
> successfully on websites)? I thought that PEAR was still being developed.
Still being in development doesn't mean not being produciton quality.
Anything not being in pear/experimental/ should be safe to use. And even some
scripts there are, and just lack documentation.
regards
Wagner
--
"Isn't it strange? The same people who laugh at gypsy fortune tellers take
economists seriously."
- Cincinnati Enquirer
I have created a barcode as an image stream ($im). Now, I want to
output it in HTML to a particular row and column on a form. Do I have
to save it as a file so that I can use the routine <img src="xx"> or is
there a way to directly output the stream?
Many thanks.......
Todd
--
Todd Cary
Ariste Software
[EMAIL PROTECTED]
On Sat, Jun 23, 2001 at 04:50:48PM -0700, Todd Cary wrote:
> I have created a barcode as an image stream ($im). Now, I want to
> output it in HTML to a particular row and column on a form. Do I have
> to save it as a file so that I can use the routine <img src="xx"> or is
> there a way to directly output the stream?
<img src="script_that_outputs_barcode_image.php">
Make sure to send a Content-type header before sending the image data:
Header('Content-type: image/png');
ImagePNG($im);
Matt
You should call mysql_free_result($Query) !!
It all becomes a little clearer if you change the names of the variables as
such:
$result = mysql_query("select ...");
$row = mysql_fetch_assoc($result);
That is, mysql_query() returns a "result", and mysql_fetch_*() returns a
"row" from such a result. Using mysql_free_result on a row is not advisable.
Also, in my terminology, the "query" would be the string passed to
mysql_query(), so you could do like this:
$query = "select ...";
$result = mysql_query($query);
$row = ...
Regards,
Jakob Kruse
"Chris Cameron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm a bit unclear as to which result it is I use this function on.
> So lets say I;
> $Query = mysql_query("SELECT something FROM here");
> $Result = mysql_fetch_assoc($Query);
>
> Do I mysql_free_result the $Query or the $Result? If it's $Result, would
> this be the same as just going unset($Result)?
>
> Thanks,
> Chris
>
> --
> "If you don't find it in the index, look very carefully through the entire
catalogue."
> - Sears, Roebuck, and Co., Consumer's Guide, 1897
You'll probably get as many approaches as replies. How about the following;
after you have connected to mysql and selected the database;
$query = "SELECT * FROM table";
$result = mysql_query ($query)
or die ("Query <b>$query</b> failed. The error message was
".mysql_error ());
// The following wipes out any trace of a memory table in the working $table
element
$table = '';
while ($rows = mysql_fetch_row ($result)) {
$table[] = $rows[0]; // add the row to a working table
}
mysql_free_result($result) // always do this as soon as you can
$top = sizeof($table);
$halfway = ceil($top/2); // round up if odd
$col2 = $halfway;
echo "<TABLE>";
for($col1 = 0; $col1 < $halfway; $col1++) {
echo "<TR><TD>$table[$col1]</TD>";
if($col2 < $top) echo "<TD>$table[$col2++]</TD></TR>";
else echo "<TD> </TD></TR>"; // this avoids that hole in your grid
}
echo "</TABLE>";
-----Original Message-----
From: Zak Greant [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 23, 2001 1:22 PM
To: McShen
Cc: Php-General
Subject: Re: [PHP] newbie algorithm help!!!!!
McShen wrote:
> > hi
> > i have a mysql table with approx. 30 entries.
> >
> > I wanna get them(i know how to do that) and list them in a 2-column
table.
> I
> > have been trying to use a loop to do it. But it will only produce a
> 1-column
> > table. it's like
> >
> > entry 1
> > entey 2
> > entry 3
> > entry 4
> > etc
> >
> > Please help me so that i can get this :
> >
> > entry1 entry2
> > entry3 entry4
The code is easier to understand than the explanation! :)
$query = "SELECT * FROM table";
$result = mysql_query ($query)
or die ("Query <b>$query</b> failed. The error message was " .
mysql_error ());
// Initialize a value to stored the table rows
$table = '';
// Initialize a counter for the column number
$column = 0;
// Loop through the query results
while ($rows = mysql_fetch_row ($result)) {
// Put the contents of the field into a cell
$cell = "<td>$rows[0]</td>";
// If we are in column 0
if (0 == $column) {
// Start the row
$table .= "<tr>$cell";
} else {
// End the row
$table .= "$cell</tr>\n";
}
// Make the column number equal to
// The whole number remainder left over
// from dividing the value of $column
// plus one by two
$column = ($column + 1) % 2;
}
// Handle dangling rows
if (1 == $column) {
$table .= "<td></td></tr>\n";
}
echo "<table>$table</table>";
Good Luck!
--zak
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hello,
I have a script that does TV/Tour listings for artist, I need it to sort the
list automatically so that it goes in date order but I have absolutely no
idea. I have put together the script with little to no PHP skills so it look
pretty horrific.
If you could help me out with figuring out how to fix it, it would be muchly
appreciated.
The code is below
Rick
<?php
if ($max_days == ""){
$max_days = 365;
}
$current_day = date( "z");
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"
bgcolor=\"#000000\">\n";
echo "<tr bgcolor=\"#E5E5E5\"><td colspan=\"6\" align=\"right\"><b>alanis
guide</b></td></tr>\n";
echo "<tr bgcolor=\"#E5E5E5\">\n";
echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
bgcolor=\"#E5E5E5\">date</FONT></td>\n";
echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
bgcolor=\"#E5E5E5\">time</FONT></td>\n";
echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
bgcolor=\"#E5E5E5\">where</FONT></td>\n";
echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
bgcolor=\"#E5E5E5\">what</FONT></td>\n";
echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
bgcolor=\"#E5E5E5\">days till</FONT></td>\n";
echo "</tr>\n";
//Create Function
function create($listing, $max_days){
list ($month, $day, $year, $time,$channel,$show) = split('/', $listing);
$year = "20$year";
if ($channel == "VH1"){
$url = "http://www.vh1.com";
}
if ($channel == "MTV"){
$url = "http://www.mtv.com";
}
if ($channel == "COM"){
$url = "http://www.comedycentral.com";
}
if ($channel == "HBO"){
$url = "http://www.hbo.com";
}
if ($channel == "HBOZ"){
$url = "http://www.hbo.com";
}
if ($channel == "HBOS"){
$url = "http://www.hbo.com";
}
if ($channel == "TRIO"){
$url = "http://www.triotv.com";
}
$current_day = date( "z");
$show_day = date( "z", mktime( 0, 0, 0, $month, $day, $year ) );
$time_till_event = $show_day - $current_day;
if ($time_till_event < $max_days){
if ($time_till_event == '0'){
$time_till_event = "Today";
}
if ($time_till_event == '1'){
$time_till_event = "Tomorrow";
}
if ($time_till_event < 0){
return;
}
if ($url != ''){
$start = "<a href=\"$url\">";
$end = "</a>";
}
if ($confirmed == 'yes'){
$image = "images/yes.gif";
}
if ($confirmed == 'no'){
$image = "images/no.gif";
}
echo "<tr bgcolor=\"#E5E5E5\">\n";
echo "<td><font face=\"Arial\"
size=\"1\">$start$month.$day.$year$end</FONT></td>\n";
echo "<td><font face=\"Arial\" size=\"1\">$start$time$end</FONT></td>\n";
echo "<td><font face=\"Arial\" size=\"1\">$start$channel$end</FONT></td>\n";
echo "<td><font face=\"Arial\" size=\"1\">$start$show$end</FONT></td>\n";
echo "<td align=\"center\"><font face=\"Arial\"
size=\"1\">$start$time_till_event$end</FONT></td>\n";
echo "</tr>\n";
}
else{
return;
}
}
//Dates
$listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music";
create($listing, $max_days);
$listing = "06/24/01/05:00 pm/VH1/Before They Were Rock Stars";
create($listing, $max_days);
$listing = "06/24/01/11:00 pm/HBOZ/Reverb";
create($listing, $max_days);
$listing = "06/28/01/01:00 am/HBOZ/Reverb";
create($listing, $max_days);
$listing = "06/28/01/11:00 am/VH1/VH1: All Access";
create($listing, $max_days);
$listing = "06/28/01/10:00 pm/VH1/VH1: All Access";
create($listing, $max_days);
$listing = "06/28/01/11:30 pm/VH1/VH1: All Access";
create($listing, $max_days);
$listing = "06/29/01/09:30 pm/HBOS/Sex And The City";
create($listing, $max_days);
$listing = "06/30/01/07:00 pm/VH1/VH1: All Access";
create($listing, $max_days);
$listing = "07/01/01/01:00 am/TRIO/Paris Concert for Amnesty International";
create($listing, $max_days);
$listing = "07/09/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks";
create($listing, $max_days);
$listing = "07/09/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks";
create($listing, $max_days);
$listing = "07/13/01/12:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop
Songs ";
create($listing, $max_days);
$listing = "07/13/01/08:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop
Songs ";
create($listing, $max_days);
$listing = "07/27/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks";
create($listing, $max_days);
$listing = "07/27/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks";
create($listing, $max_days);
$listing = "07/01/01//Ottawa, ON/Canada Day";
create($listing, $max_days);
$listing = "07/03/01//Kristiansand, NOR/Quart Festival ";
create($listing, $max_days);
$listing = "07/05/01//Stockholm, SWE/Annex ";
create($listing, $max_days);
$listing = "07/06/01//Sundsvall, SWE/City Festival ";
create($listing, $max_days);
$listing = "07/07/01//Odense, DEN/Midtfyns Festival ";
create($listing, $max_days);
$listing = "07/09/01//Hamburg, GER/Stadtpark ";
create($listing, $max_days);
$listing = "07/11/01//Montreux, SWI/Montreux Jazz Festival ";
create($listing, $max_days);
$listing = "07/12/01//Brescia, ITA/Piazza Duomo ";
create($listing, $max_days);
$listing = "07/13/01//Palermo, ITA/To Be Announced ";
create($listing, $max_days);
$listing = "07/28/01//Nigata, JPN/Fuji Rock Festival ";
create($listing, $max_days);
$listing = "07/31/01//Anchorage, AK/Egan Civic & Conv. Ctr. ";
create($listing, $max_days);
echo "<tr align=\"center\" bgcolor=\"#E5E5E5\"><td colspan=\"6\"><font
size=\"-2\">All shows are Eastern Standard Time unless otherwise
noted</font></td></tr>\n";
echo "</table>\n";
?>
G'day -
Sorry for this stupid question but I'm a newby trying to install php on my
win98 computer and find that neither netscape nor IE 5.5 won't open php
files that are located on my c: drive but will access php files on the net.
There must be a simple explanation.
Any help greatly appreciated...
Ted Shaw
As I understand it in PHP the constructor of the parent class is not called
when a child class is initiated.
You can call it manually. Eg., using your example:
class one
{
function one()
{
echo "one ";
}
}
class two extends one
{
function two()
{
one::one();
echo "two ";
}
}
class three extends two
{
function three()
{
two::two();
echo "three";
}
}
$foo = new three();
$foo should now equal 'one two three'. (:: lets you access functions from
within a class without explicitly declaring a new object).
Hope this helps (PS. The PHP Developer's Cookbook by Sterling Hughes has a
short but good chapter on classes).
Aral :)
______________________________
([EMAIL PROTECTED])
New Media Producer, Kismia, Inc.
([EMAIL PROTECTED])
Adj. Prof., American University
??????????????????????????????
It sure is, but your code needs to look like this:
class one {
function one() {
echo "one ";
}
}
class two extends one {
function two() {
parent::one();
echo "two ";
}
}
class three extends two {
function three() {
parent::two();
echo "three";
}
}
$foo = new three();
-----------------------------------------------
Matty.
----- Original Message -----
From: "Andrew Kirilenko" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Sunday, June 24, 2001 6:04 AM
Subject: [PHP] OOP
> Hello!
>
> Is it possible to do normal inheritance on PHP?
> I've following code:
>
> --->
>
> class one
> {
> function one()
> {
> echo "one ";
> }
> }
>
> class two extends one
> {
> function two()
> {
> echo "two ";
> }
> }
>
> class three extends two
> {
> function three()
> {
> echo "three";
> }
> }
>
> $foo = new three();
>
> <---
>
> And the output of this programm is "three", but not "one two three" :(
>
> Best regards,
> Andrew Kirilenko,
> Seniour Programmer / System Administrator,
> Internet Service.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
I need to create a document that confirms to certain formatting criteria
and then be able to give the surfer the ability to download the
completed document preferrable, pdf. In other words, the document is a
"legal" document and has some dynamic fields. Can this be done in php
and if so, is there some code available that can give me an idea on how
to do it?
Todd
--
Todd Cary
Ariste Software
[EMAIL PROTECTED]
Hi all,
Does anyone out there have a PHP script that will serve as an input
form which are e-mailed to wedding invitees, in turn, linking them to a
form where they can RSVP their decision to attend the wedding or not and
how many they plan to bring?
Visit http://www.lunenburg.org/wedding/rsvp.php for an example of
exactly what I'm expecting to accomplish.
I've asked the web master of that site to share the code. No response
yet.
Thanks for any help anyone can provide. :-)
Gene Kelley
Hi
I have a script which queries mySQL and outputs 32 links at once. Here is my
scipt
----
<?php
$connection = mysql_connect("***","****","****");
if ($connection==false)
{
echo mysql_errno().":".mysql_error()."";
exit;
}
$end = $list + 16;
$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list, $end";
$result = mysql_db_query ("celebzone", $query);
$num = mysql_num_rows($result);
$j=0;
$i=0;
echo "<table border=0>\n";
echo "<tr>\n";
while ($j!=$num)
{
@$r = mysql_fetch_array($result);
@$id = $r[id];
@$title = $r[title];
echo "<td>\n";
echo "$title";
echo "</td>\n";
// new row in table every other link
$i++;
if (($i % 2) < 1)
{
echo "</tr>\n<tr>\n";
}
$j++;
}
echo "</table>";
echo "<br><br>\n";
?>
-----------------------
And here is the link to see it in action
http://www.celebritieszones.com/ln.php?list=0
If you check my HTML source, at the end, right before </table>, you will see
an extra <tr>. I know the cause of this. It's because of this
-------
"
$i++;
if (($i % 2) < 1)
{
echo "</tr>\n<tr>\n";
}
"
-----
I don't know how to fix the problem. Please help me re-write the script a
bit so that it doesn't add the extra <tr>.
Thanks in advance.
McShen wrote:
> Hi
>
> I have a script which queries mySQL and outputs 32 links at once. Here is my
> scipt
> ----
> <?php
>
> $connection = mysql_connect("***","****","****");
> if ($connection==false)
> {
> echo mysql_errno().":".mysql_error()."";
> exit;
> }
>
> $end = $list + 16;
>
> $query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list, $end";
> $result = mysql_db_query ("celebzone", $query);
>
> $num = mysql_num_rows($result);
>
> $j=0;
> $i=0;
> echo "<table border=0>\n";
> echo "<tr>\n";
> while ($j!=$num)
> {
> @$r = mysql_fetch_array($result);
> @$id = $r[id];
> @$title = $r[title];
>
> echo "<td>\n";
> echo "$title";
> echo "</td>\n";
> // new row in table every other link
> $i++;
> if (($i % 2) < 1)
> {
> echo "</tr>\n<tr>\n";
> }
>
> $j++;
> }
> echo "</table>";
>
> echo "<br><br>\n";
>
> ?>
> -----------------------
> And here is the link to see it in action
> http://www.celebritieszones.com/ln.php?list=0
>
> If you check my HTML source, at the end, right before </table>, you will see
> an extra <tr>. I know the cause of this. It's because of this
> -------
> "
> $i++;
> if (($i % 2) < 1)
> {
> echo "</tr>\n<tr>\n";
> }
> "
> -----
>
> I don't know how to fix the problem. Please help me re-write the script a
> bit so that it doesn't add the extra <tr>.
>
> Thanks in advance.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
Try adding a ; after the \n
This should work...
<?php
$connection = mysql_connect("***","****","****");
if ($connection==false)
{
echo mysql_errno().":".mysql_error()."";
exit;
}
$end = $list + 16;
$query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list, $end";
$result = mysql_db_query ("celebzone", $query);
$num = mysql_num_rows($result);
$j=0;
$i=0;
echo "<table border=0>\n";
for ($j = 0; $j < $num; $j++)
{
echo '<tr>\n';
for ($i = 0; $i <= 1; $i++)
{
@$result = mysql_fetch_array($result);
@$id = $result[id];
@$title = $result[title];
echo "<td>\n";
echo "$title";
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>";
echo "<br><br>\n";
?>
Jason Lotito
www.NewbieNetwork.net
PHP Newsletter: http://www.newbienetwork.net/ciao.php
PHP, MySQL, PostgreSQL Tutorials, Code Snippets, and so much more
> -----Original Message-----
> From: McShen [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 23, 2001 11:22 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] ->>coding help
>
>
> Hi
>
> I have a script which queries mySQL and outputs 32 links at
> once. Here is my scipt
> ----
> <?php
>
> $connection = mysql_connect("***","****","****");
> if ($connection==false)
> {
> echo mysql_errno().":".mysql_error()."";
> exit;
> }
>
> $end = $list + 16;
>
> $query = "SELECT * FROM refer ORDER BY hits desc LIMIT $list,
> $end"; $result = mysql_db_query ("celebzone", $query);
>
> $num = mysql_num_rows($result);
>
> $j=0;
> $i=0;
> echo "<table border=0>\n";
> echo "<tr>\n";
> while ($j!=$num)
> {
> @$r = mysql_fetch_array($result);
> @$id = $r[id];
> @$title = $r[title];
>
> echo "<td>\n";
> echo "$title";
> echo "</td>\n";
> // new row in table every other link
> $i++;
> if (($i % 2) < 1)
> {
> echo "</tr>\n<tr>\n";
> }
>
> $j++;
> }
> echo "</table>";
>
> echo "<br><br>\n";
>
>
> ?>
> -----------------------
> And here is the link to see it in action
> http://www.celebritieszones.com/ln.php?list=0
>
> If you check
> my HTML source, at the end, right before </table>, you will
> see an extra <tr>. I know the cause of this. It's because of this
> -------
> "
> $i++;
> if (($i % 2) < 1)
> {
> echo "</tr>\n<tr>\n";
> }
> "
> -----
>
> I don't know how to fix the problem. Please help me re-write
> the script a bit so that it doesn't add the extra <tr>.
>
> Thanks in advance.
Has anyone had any luck getting it to work? I can compile both Apache fine
and add php as a module no problem and Apache is happy. But it will not
parse any PHP content. Please help!
--
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-796-9023
email: [EMAIL PROTECTED]
Hi All,
Just wondering if it were possible to do like the following SSI line:
<!--#exec cgi="./cgi-bin/txtcounter.cgi"-->
from within php.
I know a php alternative should be made, but for the time being and for
future's sake....
So far i've tried back ticks, passthru(), exec(), but the problem is
that the URI and other variables aren't being passed to the perl script
in question.
Any idea would be appreciated.
Deniz
I am having a strange problem that I have yet to solve.
I am running apache 1.3.14 and php 4.0.5 on FreeBSD 4.3
My problem is that when I am trying to execute a program via php the program
dies after a short amount of time.
I have tried execing in the background, calling another program that execs
it into the background (both instances using:
exec("nohup /my/program &");
This same syntax worked on a Linux Mandrake 8.0 machine with the same
webserver and php setup. It just isnt working on a FreeBSD 4.3 machine.
The program starts to exec but when I close the calling webpage it
terminates, or if i leave that page open it terminates after a short period
of time.
But if I run the same command from the command line, it works perfectly.
Any ideas on what I can check or what I need to change to get this to work
correctly?
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com