Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Really newbie question

 
   Database Forums (Home) -> PHP SQL RSS
Next:  I-map Websolution...turning possibility into real..  
Author Message
Nosferatum

External


Since: Apr 18, 2007
Posts: 10



(Msg. 1) Posted: Thu Jul 10, 2008 5:50 am
Post subject: Really newbie question
Archived from groups: alt>php>sql (more info?)

I have a mysql table with all data exposed on a page. On the top of
the page I would like to have a link sorting table data, following a
query like ORDER BY first_name DESC and maybe ORDER BY last_name. But
how do I wrap this event in a link in the top of the output document?

The SQL syntax is easy and must be like this:
<php
SELECT * FROM my_big_table ORDER BY first_name DESC;
?>
But... how to manually trig this event with a link?

 >> Stay informed about: Really newbie question 
Back to top
Login to vote
TK

External


Since: Jul 10, 2008
Posts: 1



(Msg. 2) Posted: Thu Jul 10, 2008 7:39 pm
Post subject: Re: Really newbie question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Nosferatum wrote:
> I have a mysql table with all data exposed on a page. On the top of
> the page I would like to have a link sorting table data, following a
> query like ORDER BY first_name DESC and maybe ORDER BY last_name. But
> how do I wrap this event in a link in the top of the output document?
>
> The SQL syntax is easy and must be like this:
> <php
> SELECT * FROM my_big_table ORDER BY first_name DESC;
> ?>
> But... how to manually trig this event with a link?
I would use a form.
<form method="post" action="{$_SERVER['REQUEST_URI']}">
<fieldset>
<legend>For information/comments this website.</legend>
Please select the field you wish to sort on:<br>
<select name="field">
<option value="lastName">Last Name</option>
<option value="firstName">First Name</option>
<option value="whatever">whatever</option>
</select>
</fieldset>
</form>
$field=$POST['field'];
SELECT * FROM my_big_table ORDER BY $field DESC;

--
TK
http://wejuggle2.com/
Still Having a Ball

 >> Stay informed about: Really newbie question 
Back to top
Login to vote
Nosferatum

External


Since: Apr 18, 2007
Posts: 10



(Msg. 3) Posted: Thu Jul 10, 2008 11:55 pm
Post subject: Re: Really newbie question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 11 Jul, 02:39, TK wrote:
> Nosferatum wrote:
> > I have a mysql table with all data exposed on a page. On the top of
> > the page I would like to have a link sorting table data, following a
> > query like ORDER BY first_name DESC and maybe ORDER BY last_name. But
> > how do I wrap this event in a link in the top of the output document?
>
> > The SQL syntax is easy and must be like this:
> > <php
> > SELECT * FROM my_big_table ORDER BY first_name DESC;
> > ?>
> > But... how to manually trig this event with a link?
>
> I would use a form.
> <form method="post" action="{$_SERVER['REQUEST_URI']}">
>   <fieldset>
>     <legend>For information/comments this website.</legend>
> Please select the field you wish to sort on:<br>
>          <select name="field">
>          <option value="lastName">Last Name</option>
>          <option value="firstName">First Name</option>
>          <option value="whatever">whatever</option>
> </select>
> </fieldset>
> </form>
> $field=$POST['field'];
> SELECT * FROM my_big_table ORDER BY $field DESC;
>
> --
> TKhttp://wejuggle2.com/
> Still Having a Ball

Thank you very much!!!!
 >> Stay informed about: Really newbie question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Newbie question about multiple databases - if i have this query: SELECT * FROM books2006, books2007; (books 2006 and 2007 have exactly the same fields.) how can i tell if the data was retrieved from books2006 or books2007 (whitout changing anything in the databases) ? in other words is there....

Newbie question about UNIQUE MySQL v5.0.22 - Hi all, I need some help... My Example: Field: Bank Account Nš: 12353545456 Field: Bank Account Nš: The nš must be unique but could be empty also... What is the SQL? It's Possible? Best Regards PiRiCa

rename all tables in database newbie question - I'm not very familiar with SQL - Using mySQL I need to add or remove prefixes from table names - can anyone tell me an SQL (or PHP for that matter) way to do this please? I can't seem to find a way to do it. thanks cleo

Newbie question = how to send variable form one page to th.. - Newbie question = how to send variable form one page to the other i have a page with a very simple login. i want to be able to use the username variable to great the user by username when he reaches the page where he is redirected to. and at the same..

NEWBIE to php - I apologize for asking such an easy question but I'm trying to check if the recordcount is "1". If so, it should redirect the page. <?php // Connecting, selecting database $link=mysql_connect ("localhost", "user", &quot...
   Database Forums (Home) -> PHP SQL All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]