473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Testing for emtpy result.

Hi there,

I'm working with a bit of a messy query but I'm not looking for tips
on improving it (it's been a headache enough, haha).

Basically, my site posts articles written by multiple authors. In the
past we'd associate these articles with a user_id referring to the
"Multiple" author, but now writers want their own writing within an
article to be linked with them.

This led to me splitting the article table in two: we have
review_index which has all the generic/global data for the article
(band name, record label, etc), and review_pages which has a (non-
unique) field review_id which links to the id row in the review_index
table. With me so far?

The form I wrote for admins to post multiple author reviews works like
this:

- asks them for global variables and inserts them
- asks them to add a review and select username for an author
- upon submitting this, offers them to post another (still associated
with the original globals) or lets them close the job.

It's done in this way because in order to associate the review_id with
the id field, I have to KNOW what the id field in the review_index is
going to be. I can't just +1 to the most recent one, since this'll
cause issues if we delete reviews etc.

So what this means is, when a user clicks onto an article while we're
in the process of posting it, they may load a page with all the
globals in place, but none of the actual content. I'm trying to echo a
simple "Please reload the page in a few minutes" message, but can't
get a working result. I've tried variations on:

if ($review_text = null) {
echo "come back soon!";
}

if (empty($review_text)) {
echo "come back soon!";
}

if (!$query_result) {
echo "come back soon!";
}

but none of these display. Is there a solution here? It's a trivial
issue really since it's essentially catering to people who click on an
article within a 1 minute or so period, but still.

Matt

Jun 6 '07 #1
5 1356
dammit, typo in the subject. Should be 'empty'!

Jun 6 '07 #2
Rik
On Wed, 06 Jun 2007 19:46:40 +0200, Matt <gu************@gmail.comwrote:
Hi there,

I'm working with a bit of a messy query but I'm not looking for tips
on improving it (it's been a headache enough, haha).

Basically, my site posts articles written by multiple authors. In the
past we'd associate these articles with a user_id referring to the
"Multiple" author, but now writers want their own writing within an
article to be linked with them.

This led to me splitting the article table in two: we have
review_index which has all the generic/global data for the article
(band name, record label, etc), and review_pages which has a (non-
unique) field review_id which links to the id row in the review_index
table. With me so far?
Not really, no.

Are reviews the same as articles?

The form I wrote for admins to post multiple author reviews works like
this:

- asks them for global variables and inserts them
- asks them to add a review and select username for an author
- upon submitting this, offers them to post another (still associated
with the original globals) or lets them close the job.
Or you could have a usual form:

Review for:
- (radio) existing data (automatically selects last entered 'article')
- (radio) new data -formfields for data required for this
Review:
- content
- author

So, you still will save an article with the content provided to you by a
particular author at the same time (well, fractions of a second apart).

Possibly you could add a radio list/selectbox at the bottom about what
they want to do after adding it:
a: add another review by another author for this article.
b: add another review for another article.
c: stop adding stuff at all
It's done in this way because in order to associate the review_id with
the id field, I have to KNOW what the id field in the review_index is
going to be. I can't just +1 to the most recent one, since this'll
cause issues if we delete reviews etc.

So what this means is, when a user clicks onto an article while we're
in the process of posting it, they may load a page with all the
globals in place, but none of the actual content. I'm trying to echo a
simple "Please reload the page in a few minutes" message, but can't
get a working result. I've tried variations on:

if ($review_text = null) {
echo "come back soon!";
}

if (empty($review_text)) {
echo "come back soon!";
}

if (!$query_result) {
echo "come back soon!";
}

but none of these display. Is there a solution here? It's a trivial
issue really since it's essentially catering to people who click on an
article within a 1 minute or so period, but still.
Normally, when adding something requires several steps, one could also add
a 'publish' boolean field, which is checked on displaying
lists/navigation/articles etc. Set to 0 for the duration, set to 1 if
finished, don't display anything that has 0 as a publish value.
--
Rik Wasmus
Jun 6 '07 #3
On Jun 6, 7:12 pm, Rik <luiheidsgoe...@hotmail.comwrote:
Normally, when adding something requires several steps, one could also add
a 'publish' boolean field, which is checked on displaying
lists/navigation/articles etc. Set to 0 for the duration, set to 1 if
finished, don't display anything that has 0 as a publish value.

--
Rik Wasmus
This sounds like the simplest solution (ashamed it didn't occur to
me), especially since I already have a 'type' field I could adapt for
this purpose. Thank you.

(for the record, yeah, a review = article. Should have been more
clear, apologies)
Jun 6 '07 #4
Couldn't you use something like this?

if (strlen(trim($review_text)) 0 ) // do something
else echo "some message"

Jun 7 '07 #5
At Wed, 06 Jun 2007 17:46:40 +0000, Matt let h(is|er) monkeys type:
Hi there,

I'm working with a bit of a messy query but I'm not looking for tips
on improving it (it's been a headache enough, haha).
>
if ($review_text = null) {
echo "come back soon!";
}
$review_text = null isn't a test, but an assignment. Don't you mean == or
===?

Is $review_text always really empty in your test? (what length has it
got?)
but none of these display. Is there a solution here? It's a trivial
issue really since it's essentially catering to people who click on an
article within a 1 minute or so period, but still.

Matt
--
Schraalhans Keukenmeester - sc*********@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"

Jun 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Durai | last post by:
Hi All, I tested "concurrent testing" in MySQL. It works fine. But I couldn't do in PostgreSQL 7.3.4 on HPUX IPF. I got deadlock problem. I used the PHP script to update table( one script...
1
by: ad | last post by:
I use RangeValidator to validate a textbox from 1 to 5 But if the user left the TextBox empty, the RangeValidator take no action. Can RangeValidator Chek emtpy value?
3
by: JJ | last post by:
Hi, In Nunit testing with asp.net are you guys creating a separate Test assembly for testing or integrating right in class themselves? Is anyone using a third party Unit Test addon for Nunit to...
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
2
by: js | last post by:
Hi list. I'm writing a tail -f like program in python and I found file.read() doesn't work as I think it should. Here's the code illustrating my problem. ### #!/usr/bin/env python import...
24
by: David | last post by:
Hi list. What strategies do you use to ensure correctness of new code? Specifically, if you've just written 100 new lines of Python code, then: 1) How do you test the new code? 2) How do...
4
by: David | last post by:
Hi list. Do test-driven development or behaviour-driven development advocate how to do higher-level testing than unit testing? types of testing: unit integration system
2
by: iamrakeshhere | last post by:
I want to add a New Emtpy Row on Button Click bt it should Call Some global function and adds a dynamic Emtpy row to Data Grid and If I specify some values to it then insertion should perform Can...
4
by: Emanuele D'Arrigo | last post by:
Hi everybody, I'm just having a go with Unit Testing for the first time and my feeling about it in short is: Neat! I'm a bit worried about the time it's taking me to develop the tests but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.