Welcome! Log In Create A New Profile

Advanced

PHP meets SQL

Posted by 77911997 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
PHP meets SQL
April 04, 2013 11:40AM
I have spent over a hour trying to figure out how to sort by position but have null values displayed last.

I finally came up with 2 solutions. this will make sure column "position" sorts from 1 to max-number, after that displays all nulls (positions).

Language: SQL
SELECT * FROM some_table ORDER BY ISNULL(POSITION), POSITION ASC;   SELECT * FROM some_table ORDER BY COALESCE(POSITION, 99999) ASC;


if you have:
Language: SQL
SELECT * FROM some_table ORDER BY POSITION ASC;

NULLs or zeros will be displayed first.


The COALESCE function - returns the first nonnull expression among its arguments.


there are other functions that can be used, depending on which Database you are using.
avatar
Mac
Re: PHP meets SQL
April 04, 2013 01:18PM
Only an hour? smiling smiley smiling smiley

Just wondering why you need this?
Re: PHP meets SQL
April 04, 2013 01:41PM
well it is for the project I a m working on... not related to this course.

I just thought I should share... who knows someone out there might need this some day smiling smiley
avatar Re: PHP meets SQL
April 04, 2013 09:55PM
Read this!

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
Re: PHP meets SQL
May 03, 2013 04:03PM
Hi

My easyPHP display shows Apache and MySQL has started.

I have tried

http://127.0.0.1/mysql/

and

http://127.0.0.1/home/mysql/

in IE but both give Object not found Error 404. Has anyone any suggestions. Or is this one of those go to Chrome or Firefox.

I am a bit confused because if I use http://127.0.0.1/login.php to run my php program that is in C:\PHP\EasyPHP-12.1\www why will
http://127.0.0.1/mysql get me to C:\PHP\EasyPHP-12.1\mysql\bin.
avatar
Mac
Re: PHP meets SQL
May 06, 2013 08:12AM
Right click the icon and select Local web. That is the address, e.g. http:// 127.0.0.1:8887/
Re: PHP meets SQL
May 09, 2013 03:58PM
Re: PHP meets SQL
May 09, 2013 03:59PM
Sorry lets try this again:-

http://127.0.0.1:8080/
Re: PHP meets SQL
May 09, 2013 04:00PM
aaahhhhh

Put 8080 at end of 127.0.0.1:

hot smiley
Sorry, only registered users may post in this forum.

Click here to login