SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/09/2015, 08:55 PM   #1
nezo2001
Gangsta
 
Join Date: Nov 2014
Location: Cairo, Egypt
Posts: 680
Reputation: 26
Default Field equals null

How to check if fields equal null, I've enabled it to be null in the database. But how to check if it is null or not because in some cases it may handle data.
__________________
Quote:
Originally Posted by Human
When im met u, u were nub at scripting xD.

But now, i'm impressed. Good job.
Don't look at my history. Everyone started somewhere
nezo2001 is offline   Reply With Quote
Old 14/09/2015, 08:57 PM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: Field equals null

Altering the query to handle such cases is probably the easiest, you can use IFNULL() for that. It can be handled in Pawn as well, but I don't think it's as neat because it requires string comparison which is very slow.
__________________
Vince is offline   Reply With Quote
Old 14/09/2015, 09:05 PM   #3
nezo2001
Gangsta
 
Join Date: Nov 2014
Location: Cairo, Egypt
Posts: 680
Reputation: 26
Default Re: Field equals null

So, will IFNULL works in samp. And if yes, Should I retrive the data and store it in the string then do
PHP Code:
if(IFNULL(string)) 
OR?
__________________
Quote:
Originally Posted by Human
When im met u, u were nub at scripting xD.

But now, i'm impressed. Good job.
Don't look at my history. Everyone started somewhere
nezo2001 is offline   Reply With Quote
Old 14/09/2015, 10:07 PM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: Field equals null

Searching the term on ****** is such an incredibly hard job, indeed. https://dev.mysql.com/doc/refman/5.0...unction_ifnull
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NULL or not NULL, that is the question dusk Scripting Help 4 18/11/2013 11:06 AM
equals to or less than or what? xXitsgodzillaXx Scripting Help 3 10/07/2013 03:10 PM
MySQL Major bug - Fetching NULL field steki. Help Archive 0 02/06/2011 06:35 PM
How do I check if a string Equals a certain word? ViperSniper Help Archive 5 19/01/2011 06:35 PM
if strlen equals AdminPW. shitbird Help Archive 4 30/05/2009 08:43 PM


All times are GMT. The time now is 05:46 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.