Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

leelee700
Joined: Oct 09, 2006
# Posts: 50

View the profile for leelee700 Send leelee700 a private message

Posted: 2007-Jun-10 18:31
Edit Message Delete Message Reply to this message


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: 10418

View the profile for g1smd Send g1smd a private message

Posted: 2007-Jun-10 19:02
Edit Message Delete Message Reply to this message

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

View the profile for leelee700 Send leelee700 a private message

Posted: 2007-Jun-10 19:08
Edit Message Delete Message Reply to this message

thanks g1smd but i think im still confused.
can you say what it means in this context:

$Sql = "select * from my_table";
if($searchtext!=""wink
{
$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: 10418

View the profile for g1smd Send g1smd a private message

Posted: 2007-Jun-10 19:13
Edit Message Delete Message Reply to this message

It checks that something, anything, has been typed in.



leelee700
Joined: Oct 09, 2006
# Posts: 50

View the profile for leelee700 Send leelee700 a private message

Posted: 2007-Jun-10 19:32
Edit Message Delete Message Reply to this message

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 ascwink 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: 10418

View the profile for g1smd Send g1smd a private message

Posted: 2007-Jun-11 00:08
Edit Message Delete Message Reply to this message

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

View the profile for Dinkar Send Dinkar a private message

Posted: 2007-Jun-11 01:24
Edit Message Delete Message Reply to this message

Check your database connection...



mj1256
Joined: Jun 05, 2006
# Posts: 910

View the profile for mj1256 Send mj1256 a private message

Posted: 2007-Jun-11 04:13
Edit Message Delete Message Reply to this message

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: 10418

View the profile for g1smd Send g1smd a private message

Posted: 2007-Jun-11 22:28
Edit Message Delete Message Reply to this message

Good tip!


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. 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

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions