Okay, for this page, I need to check if the user is logged into my site or not. If the person is, $_SESSION['username'] will return a true value. If the value is true, I want to print the content of the page. If it returns false, I want to print an error message like "You are not currently...
I get an error now.
9 $time = date("U");
10 $display = $time-900;
11 $res = mysql_query("SELECT COUNT (*) as cnt FROM messages WHERE date >= $display");
12 $info=mysql_fetch_assoc($res);
13 $entries = $info['cnt'];
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result...
Okay, the following code is for a type of chat room in which, either messages that are less than 15 minutes old, or the most recent 25 messages will be printed. However, all that is being printed is the HTML tag and the Backround tag, which are not in the PHP coding. And, yes, I do have a...
I have recurring issues with incorporating SQL syntax with PHP.
This is what I have, followed by the error I'm getting.
elseif ($_GET[action] == 'edit' & $_POST[username] != '') {
$query="UPDATE users SET username='$_POST[username]', PASSWORD='$_POST[PASSWORD]', handle='$_POST[handle]'...
I'm sort of confused. I'm a beginning programmer, and I first learned PERL. I'm wondering if PHP has branching for if, elsif, elsif, elsif, else type of thing where there are mulitple situations, and if so what is the syntax for it?
I can't get this function to work. A sample code:
<?
$link = mysql_connect("localhost", "users", "users");
mysql_select_db("users", $link);
$result = mysql_query("SELECT * FROM user", $link);
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";
?>
And I'm getting the following...
I guess I'm not describing it very well.
I want ($username,$rank,$handle,$password,$group,$word) to be in a separate file, so that if I need to add a new variable, ex: ($username,$rank,$handle,$password,$group,$word,$NEW), then I wouldn't want to go through every program and add ,$NEW to every...
I see why you would be confused, but that's not what I meant.
I want one file to be
($username,$rank,$handle,$password,$group,$word)
Then, I want to call it up in this program, something like
open(ACCOUNT, $data_file) || die("Could not open file!");
@raw_data=<ACCOUNT>;
close(ACCOUNT)...
open(ACCOUNT, $data_file) || die("Could not open file!");
@raw_data=<ACCOUNT>;
close(ACCOUNT);
foreach $account (@raw_data){
chop($account);
($username,$rank,$handle,$password,$group,$word)=split(/\|/,$account);
I want the ($username,$rank,$handle,$password,$group,$word) in a separate...
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.