Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
There are 0 guests and 1 members in the forums right now.
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
leelee700
Joined: Oct 09, 2006
# Posts: 50
|
Posted: 2007-Jun-10 18:31
This is no doubt a very simple thing but can anyone tell the meaning of
!="" in PHP? Basically, understand that != means not equal to but what does it mean to say not equal to 2 quotation marks?
Thanks.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2007-Jun-10 19:02
Not equal to nothing.
So, equal to anything that is something more than nothing, whatever it actually is.
Clear?
|
 |
leelee700
Joined: Oct 09, 2006
# Posts: 50
|
Posted: 2007-Jun-10 19:08
thanks g1smd but i think im still confused.
can you say what it means in this context:
$Sql = "select * from my_table";
if($searchtext!=""
{
$Sql=$Sql." where " . $searchtext;
}
$Res = mysql_query($Sql);
$Num = mysql_num_rows($Res);
where $searchtext is the text someone has searched for after doing some stuff to it the original input.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2007-Jun-10 19:13
It checks that something, anything, has been typed in.
|
 |
leelee700
Joined: Oct 09, 2006
# Posts: 50
|
Posted: 2007-Jun-10 19:32
thanks g1smd. now i understand that. what im trying to do is insert an order statement in the $SQL query so that the output is sorted. However, when i do this:
$Sql = "select * from my_table order by $field1 asc";
I get this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in....
I've tried inserting the order statement in the the second part also ($Sql=$Sql." where " . $searchtext order by $field1 asc but doesn't work.
Any suggestions on sorting off of that type of query?
Thanks for this help. It's greatly appreciated.
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2007-Jun-11 00:08
SQL isn't one of the things I know a lot about.
I would suggest finding a tutorial somewhere, perhaps one with example code, and copying and modifying the few lines that you'll actually need from there.
|
 |
Dinkar
Staff
Joined: Aug 12, 2001
# Posts: 4391
|
Posted: 2007-Jun-11 01:24
Check your database connection...
|
 |
mj1256
Joined: Jun 05, 2006
# Posts: 918
|
Posted: 2007-Jun-11 04:13
PHP is case sensitive, make sure you were consistant in your code SQL vs. sql
i've had this error and its usually a case issue
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438
|
Posted: 2007-Jun-11 22:28
Good tip!
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|