Easy MySQL question

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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?
 

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
 

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'].
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top