immanuelx2
-
Posts
96 -
Joined
-
Last visited
Never
Posts posted by immanuelx2
-
-
Awesome, thank you both for the input. I will definitely consider a lot of the points.
-
I feel that the nav right is a bit off. Maybe it's the border on the left side that seems very incomplete. Or maybe because it's too close to the white div at the left.
The copyright at the bottom seems a little empty if you know what i mean.
Now for some more technical stuff.
1. Put script tags at the bottom of the document.
2. Don't use inline CSS. Put them in the CSS file.
3. Change URLs like http://www.theguiltygeek.com/?article=1033 to http://www.theguiltygeek.com/article/1033 or something like that.
thanks for the tips. What do you mean by the nav right is a bit off? Could you post a screenshot?
Also, as far as changing the URLs, how could i make them the way you suggested by using $_GET variables in php?
Again thanks for the critique.
-
What do you guys think of the code, concept, layout, color scheme, and even the future of this project? It's all powered by PHP/MySQL written from scratch!
Comments and critiques are welcome!
-
you are a gentleman and a scholar.
-
I understand the easy way to fetch an array is to use a while loop ex:
while ($row = mysql_fetch_array($query))
However, if I want to use that same array more than once, I should dump it into a separate array like so (correct?):
$tables = array(); $query = mysql_query("...") or die(mysql_error()); while ($row = mysql_fetch_array($query)) $tables[] = $row[0];
That works, however, later down the line when I use the foreach ($tables as $key => $value) loop to populate a select form element, it only uses it's numerical index instead of the index assigned by the query. My question is, how do I maintain the index from the query? (for example $row['id'] or $row['name'] instead of $row[0])
Thanks in advance
-
I am dealing with 3 tables: users, clubs, and users_clubs
Basically, users_clubs is the linking table (because the multiplicity is many to many both ways)
users:
id username =========== 1 Jack
clubs:
id clubname =========== 1 Cool Club 2 Sweet Club
users_clubs:
user_id club_id =============== 1 1 1 2
So my question is, how can i set up the MySQL query to retrieve all of the names of the Clubs that user id 1 is associated with? I came up with this so far but it's no worky
SELECT clubs.name FROM clubs WHERE users_clubs.user_id = $userid AND clubs.id = users_clubs.club_id
I have a feeling I need to use a LEFT or RIGHT join somewhere but I am not sure how to do that.
Thanks in advance and +Reps to all who help!
-
Hi, im trying to get my pagination links to show up organized like so:
PREV 1 2 3 NEXT
with the PREV floated left and the NEXT floated right, while the 1 2 3 are text-align: center'd... How should I go about it?
This is what I have come up with and it did not work:
.left {float:left;} .right {float:right;} .center {text-align:center;} <p class="left">PREV</p> <p class="center">1 2 3</p> <p class="right">NEXT</p>
any help is appreciated!
-
i thought that sessions are destroyed soon as the browser is closed
-
I have a mysql database with a user id, email, password all that junk stored...
If a user logs in, currently I have their userid stored as a cookie... I realize this is not safe because anyone can manually add a cookie of someone's user id..
So my question is, should i add a field to the database called "id_hash" or w/e and store the cookie as an md5('userid')? And then just compare that value with the database value stored?
Or is there a better way of storing cookies for user logins..? I currently am not using sessions either and wondering if thats a problem or not...
-
i figured out what it was
i had to inclue the '/' field in the second time around...
-
why does this not work....
setcookie('id', '', time()-60*60*24*2); unset($_COOKIE['id']); echo '<meta http-equiv="refresh" content="5; url='.$_POST['redirect'].'">'; require 'header.php'; echo 'You are now logged out! Redirecting...';
everything displays correctly but.. that damn cookie is still there
-
Sometimes the header tag does not run well with sessions and cookies try this instead:
logout.php <?php setcookie('id', '', time()-60*60*24*2); unset($_COOKIE['id']); echo '<script type=text/javascript>location.href="' . $_POST['redirect'] . '";</script>'; //header("Location: ".$_POST['redirect']); exit; ?>
boo why don't they fix that? that Jscript creates a back button circle
-
weird, it worked the first time, but now it still doesn't log me out...
login.php: <?php setcookie('id', $userinfo['id'], time()+60*60*24*31*3 , '/'); header("Location: " . $_POST['redirect']); ?> logout.php <?php setcookie('id', '', time()-60*60*24*2); unset($_COOKIE['id']); header("Location: ".$_POST['redirect']); exit; ?>
-
-
login.php:
setcookie('id', $userinfo['id'], time()+60*60*24*31*3 , '/');
logout.php:
setcookie('id', '', time()-60*60*24*2);
Any idea why it is not deleting my cookie?
-
Hey guys, I have a login.php page that checks the database vs the post data of the login form, and logs the user in. If successful, I want the page to redirect to the previous page ($redirect I have set to $_SERVER['REQUEST_URI'] from the previous page..) anyway... How can i have my page redirect after 5 seconds? The following code does not work:
//header... setcookie("id", $userinfo['id'] , time()+60*60*24*31*3 , "/"); $delay = 5; sleep($delay); echo "Redirecting in <b>".$delay."</b> seconds"; header("Location: " . $_POST['redirect']);
Warning: Cannot modify header information - headers already sent by (output started at header.php:7) in login.php on line 17
Redirecting in 5 seconds
Warning: Cannot modify header information - headers already sent by (output started at header.php:7) in login.php on line 21
Is there a way I can achieve this redirect after the </head> tag is closed?
-
echo '<a href="?'; if ($_GET['sort']) echo 'sort='.$sort.'&'; if ($_GET['flow']) echo 'flow='.$flow.'&'; if ($_GET['game_id']) echo 'game_id='.$_GET['game_id'].'&'; if ($_GET['server_id']) echo 'server_id='.$_GET['server_id'].'&'; echo 'page='.$pagenext.'">NEXT»</a>';
Is there an easier way to construct a link while keeping all the set $_GET values?
-
I've seen some code with:
require "dbconnect.inc.php";
when/why name a file .inc.php, and not just .php?
-
$count_query = mysql_query('SELECT COUNT(*) FROM table'); $getcount = mysql_fetch_row($count_query); $count = $getcount['0']; vs. $count_query = mysql_query('SELECT * FROM table'); $count = mysql_num_rows($count_query);
and...
$query = mysql_query('SELECT * FROM table'); if (!$query) die(mysql_error()); vs. $query = mysql_query('SELECT * FROM table') or die(mysql_error());
any differences between those scenarios?
-
interesting, what does cleanit() actually do? and how come u used $db->query()?
thanks for the help
-
Whats the safest/most useful way to incorporate a $_GET statment into a mysql_query?
so far i've been using:
mysql_query = ("SELECT * FROM table WHERE id = '$_GET[id]'");
is there a better way of it?
-
thanks bubblegum, that worked like a charm
-
toasty, you should consider making time_posted a unix timestamp.... that way you can manipulate it and put it in any form you like
-
hmmmm, im a little confused with the query you gave me...
how do i know which name, id, count you are taking? (G or M)?
also where would I put that query? for the while loop, or inside the while loop?
thanks in advance
Form works in FireFox, Chrome, but not in IE
in PHP Coding Help
Posted
Once submitted, this form only 'checks' each required field via PHP in FireFox and Chrome, but when run in IE, it seems like the page just refreshes without giving warnings like "Email Address required!".
Shouldn't be anything wrong with the header.inc.php and footer.inc.php because those work in all other pages.
Here is the code:
Thanks in advance