|
If you wanna sort Mysql Data, you should use two difference Mysql Query.
For example :
SELECT * FROM table1 ORDER BY filed ASC
SELECT * FROM table1 ORDER BY filed DESC
Else if you wanna sort a table in client you should use JavaScript.
|
|
|
|
|
ya i know these are two commands to show asc and desc but i would like to know that i have a grid table in php and on every field i want to do this and show a image full process to do this this grid is filled by while loop as used in php all dataare there but i want to show sorting on header of the fields click.
thanks for reply
|
|
|
|
|
I think you want to load a table and then be able to sort the data by a column after the data is loaded by clicking on the col header, correct? Uh oh, i think i may like jQuery too much as i just posted a different response pointing the user to the jQuery library.
Take a look at ajaxrain.com for table plugins to jQuery. I know there's a couple of them out there, if this is what you're looking for
|
|
|
|
|
There would be 3 components to this process-
1. User-facing page with <div id=data></div>
2. AJAX Javascript
3. Dynamic PHP page
The user-facing page will contain an empty div marked by an ID. The AJAX script will be something like-
http://whatsaranjit.com/includes/grabData.js[^]
Lastly, the PHP page will contain a script like-
$sql = "SELECT * FROM table";
if (isset($_GET['q'])) {
$q = $_GET['q'];
$sql .= " ORDER BY $q ASC";
}
On your user-facing page, you can make your table header a hyperlink-
<a href='javascript: grabData('headerName', 'data', page.php)'>Sort</a>
When you click the link, it will refresh the SQL query data into the div named 'data' appending the SQL query to order by whatever variable you pass to the AJAX script. You can expand on this to to get it to ascend/descend. Good luck!
Ranjit Viswakumar
Professional Services Specialist
rviswakumar@hostmysite.com
http://hostmysite.com/?utm_source=bb[^]
|
|
|
|
|
Need Linux library to get the pixel information from any image.
Example: By providing location(widht, height) x, y values, we should get the information of the pixel which is located at x and y position.
If any one knows about this, please help me.
Thanks in Advance
|
|
|
|
|
Have you tried following function?
unsigned long XGetPixel(XImage *ximage, int x, int y);
For more information you can see man XGetPixel .
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
hi i have a problem with my sql i have a field date and its not mandatory field show user can leave this field blank but when i store this i found and error not data in correct format and if i use 0000-00-00 then its store value 1/1/1970. while i want not use this date.
thanks in advance.
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
|
|
|
|
|
You could always make this field a VARCHAR (10) instead, which means that the field can take a null value; then, just insert any actual dates in the format YYYY-MM-DD, leaving fields blank where you want to, and then when you read the data from the database again, check if it's not null and if so parse it using a function like date_parse() .
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
thanks for reply.
|
|
|
|
|
hello
i would like to know that i have a report that not support chinese charachers while i am using iconv function. while on normal pages its shows correct but not in pdf file?
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
|
|
|
|
|
hi
i am using php with apachi and mysql with dreamcoder
1. if i am not enter date in my date filed than message incorrect value in my application user can leave this field blank how to do this.
2. i want that user can only input numeric value in my phone filed.
3. email validation
and tell me how to use this in php.
|
|
|
|
|
If you want the validation to be done client-side, before the form is submitted, then use JavaScript.
If you want the validation to be done server-side, after the form is submitted but before the data is processed, then use PHP.
Once you have decided which of these options to use, look on the Internet where you'll find a plethora of examples for both methods.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
Form validation using Javascript is a browser-side function. You aren't really using PHP to do this. At max, PHP is used to generate Javascript calls. This is the code that I use on my sites and it works very well-
http://webcheatsheet.com/javascript/form_validation.php[^]
Good luck!
Ranjit Viswakumar
Professional Services Specialist
rviswakumar@hostmysite.com
HostMySite.com
[^]
|
|
|
|
|
hi i would like to know how to solve the problem that i have some data on page and each records having checkbox box when i checkall all checkbox are checked and when i click on uncheckall all checkbox unchecked suppose user select all or select multicheckbox and there is also a button named delete all than all checked check will delete from database and show only remaining records on the page.
thanks in advance?
plz some one help me.
|
|
|
|
|
|
When you check all or check many and POST the information, you'll want to processing script to take the POST values and process them one at a time. You can use the foreach() function to do this-
foreach($_POST AS $field => $value) {
mysql_query("DELETE FROM table WHERE $field='$value' LIMIT 1");
}
Make sure the name parameter of the checkbox is identical to the name of field (case-sensitive). This will cycle through and delete all rows where the fields are equal to the specified values. For more information, see-
http://us2.php.net/foreach[^]
Ranjit Viswakumar
Professional Services Specialist
rviswakumar@hostmysite.com
HostMySite.com[^]
|
|
|
|
|
Hi
i just downloaded apache tomcat 6.0 but i cant use it in NetBeans6.0.1 what i do?
|
|
|
|
|
i am learner of php any body tell me
how to use calendar control in php using javascript.
anybody provide javascript code for calendar control and how i apply this control on my php application?
|
|
|
|
|
|
|
hi
i would like to know that i have a button save when i click on this button i want that all textboxs value store in database. how i can perform this task.
i am new user of php
please
|
|
|
|
|
I guess it's an AJAX question, Not PHP.
However you should use AJAX.
For that you should learn JAVASCRIPT.
But I suggest ,use Prototype[^] Framework.
It's easy.
|
|
|
|
|
You will have to have an AJAX function that updates the database. There are 3 components here-
1. AJAX script:
http://whatsaranjit.com/includes/grabData.js[^]
2. A button that calls AJAX:
<input type=button value=Update onClick="grabData('value','IDofDiv', page.php)'>
3. A user-facing page with a text field.
When the button is pushed, object.value (or whatever value) is passed to page.php as a $GET['q']. The PHP page should receive the $_GET['q'] as process a mysql_query() to update the database. The 'IDofDiv' is optional if you'd like the output of page.php to report content in between <div id=IDofDIv></div>. Good luck!
Ranjit Viswakumar
Professional Services Specialist
rviswakumar@hostmysite.com
HostMySite.com[^]
|
|
|
|
|
is it possible to call a php function with in onclick event?
if its possible how i can do this?
|
|
|
|
|
Yes, Definitive.
Well, when you're sending your form to server side, in the server side check whether the button define or not.
<?php
if (isset($_REQUEST['buttonName']))
func();
function func()
{
...
}
?>
|
|
|
|