Re: [PHP-DB] Paginatating PHP

2006-12-21 Thread OKi98
Chris Carter wrote: There is enough data to display this result and to paginate but its simply showing the else condition which does not have NEXT or PREVIOUS hyperlinked. ... $query_count = SELECT count(*) FROM students; $result_count = mysql_query($query_count); $totalrows =

Re: [PHP-DB] Paginatating PHP

2006-12-21 Thread Ondrej Kohout
It's better to use SQL_CALC_FOUND_ROWS and information function FOUND_ROWS(). For more information see http://dev.mysql.com/doc/refman/4.1/en/information-functions.html Find: FOUND_ROWS() Iky OKi98 wrote: Chris Carter wrote: There is enough data to display this result and to paginate

RE: [PHP-DB] Order By [blank]

2006-12-21 Thread Naintara
Depending on your MySQL version you could use a subquery by combining the two queries you mentioned, for a fairly straight-forward query. http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html http://mysqld.active-venture.com/Subqueries.html You could read about optimizing subqueries

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread Kevin Murphy
Unfortunately, I'm on 4.0.x so sub-queries are out. And yeah, I should get my host to upgrade but we both work for the government so that isn't happening. ;-) Any other thoughts. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread David Mitchell
What about a union? Does mySql 4.0.x support it? select * from blank where tchar_10 != '' union all select * from blank where tchar_10 = '' - Dave On 12/21/06, Naintara [EMAIL PROTECTED] wrote: Depending on your MySQL version you could use a subquery by combining the two queries you

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
This is a little weird looking, but should do the job. Remember that items in your 'order by' can be manipulated conditionally. In this case, I'm looking for NULL as well as '' (empty) and changing it to something that should come after all your normal alphabetical values, but it doesn't

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
This is a little weird looking, but should do the job. Remember that items in your 'order by' can be manipulated conditionally. In this case, I'm looking for NULL as well as '' (empty) and changing it to something that should come after all your normal alphabetical values, but it doesn't

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread David Mitchell
In case the blank is a null or is really a blank: select * from blank where tchar_10 is not null and tchar_10 != '' union all select * from blank where tchar_10 is null or tchar_10 = '' - Dave On 12/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is a little weird looking, but should

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread tg-php
You shouldn't have to do that. the IFNULL() handles all that. If the item is null, it returns an emptry string ''. If it's blank/empty, it returns an empty string. This is just used for the comparison = ''. This determines if it's empty or null and if so, returns

[PHP-DB] MSSQL Server

2006-12-21 Thread Dan Shirah
I cannot connect to my MSSQL server. I use the following connection string: php: -- $connection = mssql_connect http://php.net/mssql_connect('server','user', 'password') or die ('server connection failed'); $database = mssql_select_db

Re: [PHP-DB] Order By [blank]

2006-12-21 Thread Kevin Murphy
I haven't tried the union method the query i have is actually quite a bit more complicated than just a simple select * from a single table, so while it may work, it might take a while to write it if I am reading all this right. But yes, the ifnull() method works just fine. Thanks for

Re: [PHP-DB] MSSQL Server

2006-12-21 Thread tg-php
I had some issues a couple years ago connecting to the MS SQL Server where I was employed at the time. I was probably just doing something wrong, but what I ended up using that worked for me was using the ADODB database abstraction layer. Helped me connect to MS SQL , Oracle and some other

[PHP-DB] search result error message

2006-12-21 Thread Chris Carter
Hi, The below mentioned code works fine. Connects to the database, fetches the result, and displays neatly in a table. If there is no data then it jumps to the if condition and displays the error message. BUT if the 'if' condition is running and no data is present the Table headings and the

Re: [PHP-DB] search result error message

2006-12-21 Thread tg-php
Sorry, don't have time to test and noodle through why yours may or may not be working, but I see some differences in how you're doing it and how we tend to do it here. After doing the connection and database selection, this is how we handle stuff (simplified): $query = select * from

Re: [PHP-DB] search result error message

2006-12-21 Thread Niel Archer
Hi, there's no 'logic' error at all that I can see. It's more a design error as it doesn't do the job the way that you describe it at all. What actually happens is that the starting HTML (heading and table start) is output before the database is even contacted, so there's no way for you to

[PHP-DB] Login script help

2006-12-21 Thread Haig Dedeyan
Hi everyone, My 1st attempt at creating a login script isn't going so good, so hopefully someone can help me out. The login script itself works fine but when I include it into a web page, the login.php script shows up but the entire index.html page also shows up. I just want people to log in

RE: [PHP-DB] Login script help

2006-12-21 Thread Bastien Koert
why not just create a simple single logon page and not include itthen on sucessful login, redirect the user to the index page? bastien From: Haig Dedeyan [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Login script help Date: Thu, 21 Dec 2006 16:36:11 -0500 Hi everyone, My

RE: [PHP-DB] Login script help

2006-12-21 Thread Haig Dedeyan
Thanks. If I do it that way, can't someone get into the index page if they link directly to it without having to log in? -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 7:36 PM To: Haig Dedeyan; php-db@lists.php.net Subject: RE:

RE: [PHP-DB] Login script help

2006-12-21 Thread Miles Thompson
When user has authenticated successfully, start a session with an authentication key - almost anything you want. After that, any page you want to protect you just put one line at the top to check for the presence of this value; redirect to login page if it's not there. Regards - Miles

Re: [PHP-DB] Paginatating PHP

2006-12-21 Thread chris smith
On 12/21/06, Ondrej Kohout [EMAIL PROTECTED] wrote: It's better to use SQL_CALC_FOUND_ROWS and information function FOUND_ROWS(). Has nothing to do with the problem. its simply showing the else condition which does not have NEXT or PREVIOUS hyperlinked. Try OKi98's suggestion, it will most