Dreamweaver recordset will not give me null

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

i know i know, wysiwyg's are not for loosers and all that but i've been
coding php for about 6 months now and the one thing ive always wanted
to do was see a live preview of my php so i can format tables without
having to save and upload everytime- i figured out how to make
dreamweaver do that! for the most part its pretty awesome (bulky/wierd
php tho) but theres one thing that i JUST CANT FIGURE OUT- i have a
recordset that will not return null from a querystring. when i feed the
search results script an 'empty' variable (i just hit enter on the
search form without typing in a query) it lists all of the entries
instead of none of them. if anyone has ran into this situation before
id really like to know what you did. its probably one stupid little
setting that im being an idiot about, like it usually is, but i spent
all night last night running through these groups and running through
documentation. thanks a lot!

Re: Dreamweaver recordset will not give me null

Quoted text here. Click to load it

Funny, just answered a post just like this is the dreamweaver group :o)

As i said, can you post some code?

Andy Jacobs
Intelligent Websites For Intelligent Business People

Re: Dreamweaver recordset will not give me null

really? cause i posted on the dreamweaver group too, but i didnt see a
reply. iunno, maybe its a coincidence? :) anyway here is all the code
that i THINK is relevant:

$colname_search_results = "1";
if (isset($_POST['key_words'])) {
  $colname_search_results = (get_magic_quotes_gpc()) ?
$_POST['key_words'] : addslashes($_POST['key_words']);
mysql_select_db($database_QCBD, $QCBD);
$query_search_results = sprintf("SELECT * FROM qcbd WHERE key_words
LIKE '%%%s%%' ORDER BY client_id ASC", $colname_search_results);
$query_limit_search_results = sprintf("%s LIMIT %d, %d",
$query_search_results, $startRow_search_results,
$search_results = mysql_query($query_limit_search_results, $QCBD) or
$row_search_results = mysql_fetch_assoc($search_results);

again, i havent been coding for a long time so its hard for me to
understand some of what dreamweaver is doing.  im not clear on what the
$colname_search_results does and i dont know what '%%%s%%' is. i know
the % are wildcards, but when i did something like this before it was
something like '%%' im not clear on what the 's' is, i dont
see it defined anywhere. anyway, if this makes it anymore clear im
dying to figure out what im doing wrong. thanks a lot!

Re: Dreamweaver recordset will not give me null

I noticed that Message-ID:
contained the following:

Quoted text here. Click to load it

The percentage char is a wild card.  For instance %$myvar% would match
$myvar with anything in front and anything after.

If your $colname_search_results is empty you are saying where key words
= anything so you get all records.

Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker /

Re: Dreamweaver recordset will not give me null


try this:

$colname_search_results = "-1";

Note the -ve sign.

I hope this will help. as the problem you are talking about does not
happen to me and I use -1.


Site Timeline