1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Easy MySQL question

Discussion in 'Software Development' started by Regicide, Sep 8, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. Regicide

    Regicide Thread Starter

    Joined:
    Aug 8, 2003
    Messages:
    307
    All I am trying to do is put in a varible in a mysql query in PHP. This is what I have now:
    PHP:
    $page $_GET['view'];
    $db mysql_connect("localhost""root""pass");
    mysql_select_db("test"$db);
    $query "SELECT title FROM pages where page = '$page'";
    $title mysql_query("$query"$db);
    For some reason this returns the value "resource id #2". But, when I use the same command in command line, it works fine. $page contains the right text, I've checked. Can someone please help me?
     
  2. clr

    clr

    Joined:
    Aug 24, 2004
    Messages:
    39
    has the $page variable already been assigned a value? That might cause a problem if it hasn't yet
     
  3. Regicide

    Regicide Thread Starter

    Joined:
    Aug 8, 2003
    Messages:
    307
    It holds the correct text. To make sure, I did printf("$page"). But other than that, it wasn't initalized until the $page = $_GET['view'].
     
  4. clr

    clr

    Joined:
    Aug 24, 2004
    Messages:
    39
    hmm...i'm stumped....maybe try re-working some of your php...maybe capitalize the "WHERE" that could possibly cause probs with the SQL
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Easy MySQL question
  1. riiiiiya
    Replies:
    0
    Views:
    145
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/271862

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice