php-windows Digest 3 Aug 2007 18:51:37 -0000 Issue 3301
Topics (messages 28307 through 28320):
Solved - Re: [PHP-WIN] ORDER BY is not sorting
28307 by: Mark Abrams
28309 by: Tom Hearn
28320 by: Armando
Code sample - Small Help
28308 by: Mark Abrams
28314 by: Aleksandar Vojnovic
Cacti x Post
28310 by: Vitor Mendes
28311 by: Stut
28312 by: Vitor Mendes
28313 by: Jacob Bergman
Template
28315 by: Cédric Joubert
28316 by: Stut
28317 by: Bill Bolte
28318 by: Cédric Joubert
28319 by: Aleksandar Vojnovic
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 ---
Thank you all. Problem solved.
Gustav, I followed your recomendation and changed the table name var to the
actual table name and my problem is solved. Perpaps something is lost in the
interperter when PHP passes the code.
It has been this group that helps make working with PHP fun.
"Gustav Wiberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi!
I can't see anything with your code either. Mysql_fetch_array should work
fine yes. No indexes are needed to sort fields, but are recommended for
speeding up the process :-)
How does the table users look like? (Please send a link to a screenshot or
something like that)
Sometimes I have noticed that PHP isn't that good of getting right results
when using $variable inside ""-chars
You could try doing this:
$table_name ='users';
// Select records
$result = mysql_query("SELECT * FROM " . $table_name . " ORDER BY rowID
DESC");
// Loop through the record set
while($row = mysql_fetch_array($result))
print 'rowID =' .$row['rowID']. '<br />'
There might be some issues regarding permissons of MySQL. Have you tried
doing another sql-select statement on another table?
Best regards
/Gustav Wiberg
-----Original Message-----
From: Mark Abrams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 12:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] ORDER BY is not sorting
Is mysql_fetch_array the proper function to access sorted data? The
problem is consistent on my test server and my ISPs mySQL DB.
rowID is the primary key. Do I need to have an index attribute on a field I
want to sort?
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I can't really see anything wrong with what you have there. It shouldn't
>matter that your SQL is inside the query function, although I like to build
>the query in a variable outside the query function, but either way it
>should work.
>
> And you're obviously getting data and not an error, right?
>
> What happens if you leave the "DESC" off? Does it come back 4, 3, 2, 1?
> or still 1, 2, 3, 4?
>
> You might try displaying more data from the result set to see if there's
> some other issue.
>
> And have you tested the SQL statement just using MySQL via command line,
> phpMyAdmin, WinSQL, Navicat, or something like that?
>
> -TG
>
> = = = Original message = = =
>
> Sorry, this seams very trivial but I can not sort the result set for any
> field. What am I doing wrong?
>
>
> php & mySQL 5
>
>
> <?php
>
> ...
>
> $table_name ='users';
>
> // Select records
> $result = mysql_query("SELECT * FROM $table_name ORDER BY rowID DESC");
>
>
> // Loop through the record set
> while($row = mysql_fetch_array($result))
> print 'rowID =' .$row['rowID']. '<br />'
>
>
> ?>
>
> 1
> 2
> 3
> 4
>
>
> TIA
> Mark
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.0/927 - Release Date: 2007-07-30
17:02
--- End Message ---
--- Begin Message ---
Mark,
I have another suggestion for you to try, you can use this while
using post variables, and class-access variables.
$result = mysql_query("SELECT * FROM {$table_name} ORDER BY rowID
DESC");
This is doing the exact same thing as your previous statement, but
it allows you to remove the parenthesis and you can also do nifty things
like
{$_myclass->getuserid()} without having to escape it with parenthesis.
Another thing to check, do you have register_globals set to on?
Your PHP may be requiring you to access $table_name as $_GET["table_name"]
or $_POST["table_name"]?
Cheers,
Tom Hearn
Software Engineer
N Software
http://www.nsoftware.com
-----Original Message-----
From: Mark Abrams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 9:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Solved - Re: [PHP-WIN] ORDER BY is not sorting
Thank you all. Problem solved.
Gustav, I followed your recomendation and changed the table name var to the
actual table name and my problem is solved. Perpaps something is lost in the
interperter when PHP passes the code.
It has been this group that helps make working with PHP fun.
"Gustav Wiberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi!
I can't see anything with your code either. Mysql_fetch_array should work
fine yes. No indexes are needed to sort fields, but are recommended for
speeding up the process :-)
How does the table users look like? (Please send a link to a screenshot or
something like that)
Sometimes I have noticed that PHP isn't that good of getting right results
when using $variable inside ""-chars
You could try doing this:
$table_name ='users';
// Select records
$result = mysql_query("SELECT * FROM " . $table_name . " ORDER BY rowID
DESC");
// Loop through the record set
while($row = mysql_fetch_array($result))
print 'rowID =' .$row['rowID']. '<br />'
There might be some issues regarding permissons of MySQL. Have you tried
doing another sql-select statement on another table?
Best regards
/Gustav Wiberg
-----Original Message-----
From: Mark Abrams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 12:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] ORDER BY is not sorting
Is mysql_fetch_array the proper function to access sorted data? The
problem is consistent on my test server and my ISPs mySQL DB.
rowID is the primary key. Do I need to have an index attribute on a field I
want to sort?
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I can't really see anything wrong with what you have there. It shouldn't
>matter that your SQL is inside the query function, although I like to build
>the query in a variable outside the query function, but either way it
>should work.
>
> And you're obviously getting data and not an error, right?
>
> What happens if you leave the "DESC" off? Does it come back 4, 3, 2, 1?
> or still 1, 2, 3, 4?
>
> You might try displaying more data from the result set to see if there's
> some other issue.
>
> And have you tested the SQL statement just using MySQL via command line,
> phpMyAdmin, WinSQL, Navicat, or something like that?
>
> -TG
>
> = = = Original message = = =
>
> Sorry, this seams very trivial but I can not sort the result set for any
> field. What am I doing wrong?
>
>
> php & mySQL 5
>
>
> <?php
>
> ...
>
> $table_name ='users';
>
> // Select records
> $result = mysql_query("SELECT * FROM $table_name ORDER BY rowID DESC");
>
>
> // Loop through the record set
> while($row = mysql_fetch_array($result))
> print 'rowID =' .$row['rowID']. '<br />'
>
>
> ?>
>
> 1
> 2
> 3
> 4
>
>
> TIA
> Mark
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.0/927 - Release Date: 2007-07-30
17:02
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.0/929 - Release Date: 7/31/2007
5:26 PM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.0/929 - Release Date: 7/31/2007
5:26 PM
--- End Message ---
--- Begin Message ---
I've seen this issue before as well.. if you want to keep the
$table_name variable in there in order to maintain dynamics, try
escaping first and it should work fine. Your modified query would look
like this:
$result = mysql_query("SELECT * FROM ". $table_name ." ORDER BY rowID
DESC");
Cheers.
Armando
Mark Abrams wrote:
Thank you all. Problem solved.
Gustav, I followed your recomendation and changed the table name var to the
actual table name and my problem is solved. Perpaps something is lost in the
interperter when PHP passes the code.
It has been this group that helps make working with PHP fun.
"Gustav Wiberg" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi!
I can't see anything with your code either. Mysql_fetch_array should work
fine yes. No indexes are needed to sort fields, but are recommended for
speeding up the process :-)
How does the table users look like? (Please send a link to a screenshot or
something like that)
Sometimes I have noticed that PHP isn't that good of getting right results
when using $variable inside ""-chars
You could try doing this:
$table_name ='users';
// Select records
$result = mysql_query("SELECT * FROM " . $table_name . " ORDER BY rowID
DESC");
// Loop through the record set
while($row = mysql_fetch_array($result))
print 'rowID =' .$row['rowID']. '<br />'
There might be some issues regarding permissons of MySQL. Have you tried
doing another sql-select statement on another table?
Best regards
/Gustav Wiberg
-----Original Message-----
From: Mark Abrams [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 12:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] ORDER BY is not sorting
Is mysql_fetch_array the proper function to access sorted data? The
problem is consistent on my test server and my ISPs mySQL DB.
rowID is the primary key. Do I need to have an index attribute on a field I
want to sort?
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I can't really see anything wrong with what you have there. It shouldn't
matter that your SQL is inside the query function, although I like to build
the query in a variable outside the query function, but either way it
should work.
And you're obviously getting data and not an error, right?
What happens if you leave the "DESC" off? Does it come back 4, 3, 2, 1?
or still 1, 2, 3, 4?
You might try displaying more data from the result set to see if there's
some other issue.
And have you tested the SQL statement just using MySQL via command line,
phpMyAdmin, WinSQL, Navicat, or something like that?
-TG
= = = Original message = = =
Sorry, this seams very trivial but I can not sort the result set for any
field. What am I doing wrong?
php & mySQL 5
<?php
...
$table_name ='users';
// Select records
$result = mysql_query("SELECT * FROM $table_name ORDER BY rowID DESC");
// Loop through the record set
while($row = mysql_fetch_array($result))
print 'rowID =' .$row['rowID']. '<br />'
?>
1
2
3
4
TIA
Mark
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
if (var) {$path='/image/a.jpg';}else{$path='/image/b.jpg';}
?>
<div class="adThumb"><img src=" <? echo ' . $row['image'] '" ' ?> > </div>
""Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm kind of trying to do this quickly. Can anyone give me some PHP code
> that will let me link to a different image if $veriable = blah blah blah.
> I need it for 4 different options.
--- End Message ---
--- Begin Message ---
$path = '<img src="/image/'.(($var) ? 'a' : 'b').'.jpg">';
even shorter :)
- Aleksander
Mark Abrams wrote:
if (var) {$path='/image/a.jpg';}else{$path='/image/b.jpg';}
?>
<div class="adThumb"><img src=" <? echo ' . $row['image'] '" ' ?> > </div>
""Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm kind of trying to do this quickly. Can anyone give me some PHP code
that will let me link to a different image if $veriable = blah blah blah.
I need it for 4 different options.
--- End Message ---
--- Begin Message ---
Hi there!
Does anybody knows how can I install CACTI with PostgreSQL database? It
works?
Do you know if it recognizes switch, hub or acess points?
Hugs!
Vitor
--- End Message ---
--- Begin Message ---
Vitor Mendes wrote:
Does anybody knows how can I install CACTI with PostgreSQL database? It
works?
Do you know if it recognizes switch, hub or acess points?
You'll have better luck asking the people who develop Cacti - I'm sure
they have their own mailing list.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Yeap, they have their own mail lists... sorry... but Cacti is wrotten in
PHP, so...
Vitor
--- End Message ---
--- Begin Message ---
I have used Cacti for a about 6 months now, and as far as I know, is
only meant to work with MySQL. I have never heard of anyone using it
with PostgreSQL. Never ran across that in the forums. If you would
like to know, just join the cacti forums at http://forums.cacti.net/
Jacob Bergman
Network Technician
Pullman School District #267
(509) 432-4012
[EMAIL PROTECTED]
-----Original Message-----
From: Vitor Mendes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 7:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Cacti x Post
Hi there!
Does anybody knows how can I install CACTI with PostgreSQL database? It
works?
Do you know if it recognizes switch, hub or acess points?
Hugs!
Vitor
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
hi,
wich template do you use for a little php application ?
Cedric
--- End Message ---
--- Begin Message ---
Cédric Joubert wrote:
wich template do you use for a little php application ?
Template? What exactly do you mean by that?
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Can you explain what you mean by "template"? That can mean so many things.
Bill
-----Original Message-----
From: Cédric Joubert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 1:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Template
hi,
wich template do you use for a little php application ?
Cedric
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> Template? What exactly do you mean by that?
Thanks but i was much looking for this kind of things :
http://cyberzoide.developpez.com/php4/template/
----- Original Message -----
From: Dan Shirah
To: Cédric Joubert
Sent: Wednesday, August 01, 2007 9:00 PM
Subject: Re: [PHP-WIN] Template
I would start out with a simple:
<html>
<head>
<title>My 1st PHP Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
PUT YOUR PHP IN HERE
?>
</body>
</html>
On 8/1/07, Cédric Joubert <[EMAIL PROTECTED]> wrote:
hi,
wich template do you use for a little php application ?
Cedric
--
PHP Windows Mailing List ( http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Template? As in html templates that are used in combination with PHP
to generate a page?
- Aleksander
Quoting Stut <[EMAIL PROTECTED]>:
Cédric Joubert wrote:
wich template do you use for a little php application ?
Template? What exactly do you mean by that?
-Stut
--
http://stut.net/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---