Forum Moderators: open

Message Too Old, No Replies

searching for row value over two tables

         

AWSwS

2:28 pm on Jul 29, 2008 (gmt 0)

10+ Year Member



Database: Mysql 5.0.51b
I need to check for a url over two seperate tables held in the same database.

now i can do that, but my issue is that if the value is not found it flags an error.

is there a way to check the rows to see if it exists?

basically i have a menu normally the categories and pages and highlighted by checking the data base, basically, if page cid = id bold the category.

followed then by a check of page url = row url bold that page as its being viewed.

i've now added a new section, its the admin area where it'll load all the pages for admin in the main content area not in the submenu.

what i want to do is this, select the cid from the admin page if url =x

if no rows because url x doesn't exist in that table

check the other table the same
if no rows because of the same error, report no pages
otherwise do the menu loads.

unfortunatly i get 'admin.php' not found in x check your mysql syntax

[edited by: AWSwS at 2:48 pm (utc) on July 29, 2008]

AWSwS

3:01 pm on Jul 29, 2008 (gmt 0)

10+ Year Member



hmm found the issue that was preventing me.

i encased the query in '' and . $varible . to load in the url name i needed to load the query in "" with the $varible in '' ie "SELECT * FROM table WHERE url='$varible'"