MySQL Forums
Forum List  »  PHP

Re: Small errors...
Posted by: Nick Roper
Date: April 30, 2005 12:45AM

Hi Simon:

$select = mysql_query("SELECT * FROM users WHERE username = '$_COOKIE[username]'");
$row = mysql_fetch_array($select);

You aren't actually sending the select statement to the server; you need a mysql_query() in beween the two rows above, i.e:

//assign the select string
$select = mysql_query("SELECT * FROM users WHERE username = '$_COOKIE[username]'");

// execute the query and assign result
$result = mysql_query($select ) or die ('Invalid query '.mysql_error());

// fetch the result into $row
$row = mysql_fetch_array($result);

Also, you don't appear to be connecting to the server and a database - are you including this file into another one that does the connection stuff ? If not, then you'll need to do so.

I'm guessing that line 101 is:

include("$sitepath/ ");

Two things here:

1) I can't see where $sitepath is assigned

2) The trailing '/' indicates that $sitepath is a directory. You need to specify a file, e.g:

include("$sitepath/$file ");

Let me know ...


Cheers,


Nick

--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
April 29, 2005 04:18PM
Re: Small errors...
April 30, 2005 12:45AM
April 30, 2005 01:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.