Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
If MySQL ID Doesn't Exist...
Old 04-23-2005, 09:20 PM If MySQL ID Doesn't Exist...
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Sorry about the mysterious title, I wasn't sure how to word it.

To be brief, my problem is that I have a page for viewing a specific article (from the news) which also acts as a permalink and comments page. My question is: How do I make it so that when a null ID (one that doesn't exist) is entered in the URL, it also says it onscreen?

Currently, it just displays everything normally without any content (no MySQL information), and if there is no ID in the URL whatsoever, it just exits the page and displays the appropriate error (which is what I want).

Basically, I'm asking how I should word my If statement (if that's what I need to use...) to check if the ID in the news table provided actually exists, and if not... well, I can cover the "if nots", I just need the check statement.

(Heh, I guess that wasn't so brief.)
Bloodsyne is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-23-2005, 10:44 PM
Average Talker

Posts: 17
Trades: 0
So if http://yoururl.com is present instead of http://yoururl.com?id=33 you need it to display an error right?
__________________
Ed Charkow

Please login or register to view this content. Registration is FREE
||
Please login or register to view this content. Registration is FREE
||
Please login or register to view this content. Registration is FREE
||
Please login or register to view this content. Registration is FREE
rewq007 is offline
Reply With Quote
View Public Profile
 
Old 04-23-2005, 10:45 PM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
I've got that down.

More like, if http://www.someurl.com/view_article.php?id=23 is presented, and there is no article attributed to ID 23, it displays the appropriate error.

Sorry for not being entirely clear.
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 01:52 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Check the Number of rows returned, if it's 0 throw the error message.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-24-2005, 01:55 AM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Quote:
Originally Posted by chrishirst
Check the Number of rows returned, if it's 0 throw the error message.
Ah yeah, I should've thought of that.

But I didn't.

Thanks yet again.
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Old 04-24-2005, 01:58 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
all these things are easy when you've done them before
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-24-2005, 02:07 AM
Bloodsyne's Avatar
Skilled Talker

Posts: 52
Trades: 0
Quote:
Originally Posted by chrishirst
all these things are easy when you've done them before
Yeah, definitely. Sometimes the right thought processes just require an extra kick or adjustment to get on the right path.
Bloodsyne is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to If MySQL ID Doesn't Exist...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25726 seconds with 12 queries