Welcome
Welcome to <strong>txtSQL</strong>.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

order by Error?

Post bugs here

order by Error?

Postby jenose on Wed Apr 25, 2007 6:40 pm

when i use

$sql->select(array('db' => 'test',
'table' => 'testtable',
'order by' => array('id','DESC')));

they having an wrong order

i use txtsql 2.2 final

and i have one question :
about $sql->last_insert_id(); how does it work,
can you show sample tag for me

about my site it's powered by txtsql, my all database is use txtsql
thank for this project.
jenose
 
Posts: 3
Joined: Wed Apr 25, 2007 6:23 pm

Postby FarazAli on Wed Apr 25, 2007 8:32 pm

Remove the space between the words "order and by"

Code: Select all
'order by' => array('id','DESC')));


should be

Code: Select all
'orderby' => array('id', 'DESC')));




as for the last_insert_id() function -- if you have a table with a field that is auto_increment (an "ID" column for example) you can get the value of the latest entry. So say I added two entries to a table with a field "ID" (that was auto_increment) -- when i've added the two entries and try to use the function, it would return the value "2" because it was the LAST ID to be generated.

If you have a website, you should post a link :)
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Postby jenose on Wed Apr 25, 2007 11:52 pm

how to use ,

like this ?

$sql->last_insert_id('testTable','testDB');
jenose
 
Posts: 3
Joined: Wed Apr 25, 2007 6:23 pm

Postby FarazAli on Thu Apr 26, 2007 10:00 am

yup exactly... and if there are more than two auto_increment fields in a table, you can specify which one to look the index for like this

$sql->last_insert_id('table', 'db', 'column');
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Postby jenose on Sun Apr 29, 2007 7:31 pm

thanks alot.
jenose
 
Posts: 3
Joined: Wed Apr 25, 2007 6:23 pm

Re: order by Error?

Postby zzw08 on Tue Jul 14, 2009 5:34 am

http://www.fashion-products.com [url=http://www.fashion-products.com ]is a sell air force one,
air jordan,bape,kicks,nike,Jerseys,Shoes,Clothing,Bag,Glasses,Caps&Hats,sneakers,sunglasses,
watches,Jewelry,Electronics,NBA,NFL,NHL,MLB[/url]
shoes
clothing
Handbags Wallets
Hat
Sunglasses
Belts
Watches
Jewelry
zzw08
 
Posts: 53
Joined: Tue Jul 14, 2009 5:15 am


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron