odetron
-
Posts
19 -
Joined
-
Last visited
Never
Posts posted by odetron
-
-
I was useing the news system code on this site yet im haveing trouble when running part of it.
<?php $db_host = "xxxxxxx"; $db_username = "xxxxxxxx"; $db_password = "xxxxxxx"; $db_name = "xxxxxxx"; mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); $query = "SELECT name, subject, message, date FROM news order by date DESC"; $result = mysql_query($query); echo "<br><center>"; while($r=mysql_fetch_array($result)) { echo "<tr>"; echo "<td bgcolor='#FFFFFF'><h10>// $r[subject]<HR color='#660000'></td>"; echo "</tr>"; echo "<tr>"; echo "<td bgcolor='#FFFFFF'>$r[message]<HR color='#660000'></h10></td>"; echo "</tr>"; echo "<tr>"; echo "<td bgcolor='#FFFFFF'>Posted By: $r[name]</a> $r[date]<br><br><br></td>"; echo "</tr>"; } echo "</table>"; ?>
Im haveing trouble running line 17. It looks right yet I get this message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resourceHow can I fix this?
-
now it says oi can't modify the headers... how do i fix that?
-
ok so i ave this code
session_start(); $username = $_POST[‘username’]; $password = md5($_POST[‘password’]); $logingood = 1; $query = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "'"; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = 'Bad Login'; include (“login.html”); } else { $_SESSION[‘username’] = '$username'; $logingood = 2; } if ($logingood == 2) { echo "Welcome! I will now redirect you to your control Panel!"; if ($username == Odetron) { header("location: http://odetron.freehostia.com/Test/comics/comics/admin/"); } else { echo "You are not an admin so get out "; } } ?>
I am mainly looking at the section
if ($username == Odetron) { header("location: http://odetron.freehostia.com/Test/comics/comics/admin/"); } else { echo "You are not an admin so get out "; } }
What its supposed to do is make the user be redirected to the admin cp if there username is odetron, but even thought the username is odetron its saying you are not an admin. what was my error?
-
$query = “select * from users where username=’$username’ and password=’$password’”;
whats wrong with this?
-
$pg = 1; $_GET[$pg]; //Draws the page data if ($pg == 1) { include("news1.inc.html"); } if ($pg == 2) { include("news2.inc.html"); }
what i whant this code to do is change the site content depending on what the url is. like index.php?pg=2 would bring up hello world 2 and just index. php would bring up hello world. but on both i keep getting the one for $pg = 1 why won't this work?
-
Lets say i have the text [1] and i whant it to change a variable when clicked on. so variable $i would be changed from 1 to 2. How do i do this?
-
I have never seen this error before:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/www/phimil.freehostia.com/Test/index.php on line 168
$pg2 = "<fieldset><legend><b>mission, complete!</b> - <i>January 6, 2007</i></legend><div class='infld'><BR>This site is 100% completed! Finnaly the downloads section is back! It took awhile to develope because it needed extra CSS to finish. Check it out.! Also feal free to register in the un-completed forums. ( I still need to upload some images) </a></div></fieldset><fieldset><legend><b>Forum is Back!</b> - <i>December 28, 2006</i></legend><div class='infld'><BR>w00t! this site has more of a use now! Check out our forums <a href="/community">Here!</a></div></fieldset><fieldset><legend><b>Project Resumed!</b> - <i>December 28, 2006</i></legend><div class='infld'><BR>The current 3D Project has started again! The first screen shots should be expected late january.</div></fieldset>";
so, whats wrong with this? ???
-
Without lookig at your code, i would imagine the error is because you've forgotten the semi colon at the end of the previous line.
oh...duh. thanks that worked.
-
Parse error: parse error, unexpected T_VARIABLE in /home/www/phimil.freehostia.com/Test/index.php on line 168
thats what i get whe i execut my script. it says theres a T_Variable yet i find no error in the variable on line 168.
$pg2 == {"<fieldset><legend><b>mission, complete!</b> - <i>January 6, 2007</i></legend><div class='infld'><BR>This site is 100% completed! Finnaly the downloads section is back! It took awhile to develope because it needed extra CSS to finish. Check it out.! Also feal free to register in the un-completed forums. ( I still need to upload some images) </a></div></fieldset> <fieldset><legend><b>Forum is Back!</b> - <i>December 28, 2006</i></legend><div class='infld'><BR>w00t! this site has more of a use now! Check out our forums <a href="/community">Here!</a></div></fieldset> <fieldset><legend><b>Project Resumed!</b> - <i>December 28, 2006</i></legend><div class='infld'><BR>The current 3D Project has started again! The first screen shots should be expected late january.</div></fieldset>"}
I think its because of the html i put in it so if thats the problem, how do i put that in a variable?
-
yeah, i just realized word pad isn't the best editor. so when i chnged it to note pad i saw it was word pads fault.
-
now it looks like this
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 \par \par \par \par \par \par
\par Name:[ ]
\par Nick name: [ ]
\par Something That describes you:[ ]
\par Your banner url:[ ]
\par [submit]\par
\par \par © 2006 odetron\par \par \par \par }
Edit Never mind, its just the text editor im useing.
-
Im haveing trouble with this error i found in a code
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/www/phimil.freehostia.com/pwnage/index.php on line 9 Parse error: parse error, unexpected T_STRING in /home/www/phimil.freehostia.com/pwnage/index.php on line 9
Heres the code i have
<HTML> <HEAD> <TITLE> Pwned </TITLE> </HEAD> <BODY> <?php <form action="pwner.php" method="get"> Name: <input type="text" name="name" /><br> Nick name: <input type="text" name="nick" /><br> Something That describes you: <input type="text" name="des" /><br> Your banner url:<input type="text" name="ban" /><br> <input type="submit" /> </form> ?> © 2006 odetron </BODY> </HTML>
Whats wrong with it?
-
yeah, im lousy at php. anyways whats wrong this code? I can't seem to fix it.
[code]
if (mysql_num_rows($result)!= 1) {
$error = “Bad Login”;
include “login.html”;
} else {
$_SESSION[‘username’] = “$username”;
include “memberspage.php”;
}
?>[/code]
Theres an unexpected T-String in the top row. -
alright I got it.
it had to be changed to
[code]$query = mysql_query("SELECT * FROM `users` WHERE `username`='{$username}' `password`='{$password}'");[/code]
-
nope. That did nothing.
Ill put it up , but I think is was because I typed the wrong mysql sever info down. lol -
no, I got that.
Lines 16-19 (if that helps)
[code]session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);
$query =“SELECT * from users WHERE username='$username' and password='$password'”;
[/code] -
[quote]Parse error: parse error, unexpected T_STRING in /home/www/phimil.freehostia.com/odetronchat/login.php on line 19[/quote]
Heres line 19.
[code]$query = “select * from users were username=’$username’ and password=’$password'”;[/code]
Whats wrong whit this? -
[code]<?php
// Make a MySQL Connection
mysql_connect("server", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
//Create table
mysql_query("CREATE TABLE users(
userid int(25) NOT NULL auto_increment,
name varchar(25) NOT NULL default '',
email varchar(255) NOT NULL default '',
username varchar(25) NOT NULL default '',
password varchar(255) NOT NULL default '',
PRIMARY KEY (userid),
UNIQUE KEY username (username)
) TYPE=MyISAM COMMENT='Members';))
?>[/code]
When I run this code I get this messege
[quote]Parse error: parse error, unexpected $ in /home/www/phimil.freehostia.com/odetronchat/global.php on line 15[/quote]
I dont have a $ in line 15. What did I do wrong ???
Never mind i fixed it.
Table Problems
in PHP Coding Help
Posted
So im getting an error saying one of my tables doesn't exist. So I re-run my table makeing script and its not working
whats wrong?