Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
$_GET Help!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NSA" data-source="post: 175481" data-attributes="member: 10034"><p>Hey guys,</p><p> </p><p>Doing a project for College and I need to be able to display information from a database.</p><p>I currently have a profile.php page which set's some variables, send's them to another PHP file which acts as a CSS file. </p><p>The problem I am having is, it doesn't update unless I "refresh the page". If I go directly to the url profile.php?id=Josh it will still display for instance Anna's username from "profile.php?id=anna". But when I refresh the new one, it updates to "Josh".</p><p> </p><p>I am aware of security issues in my code, but it is just for a College project, so don't bawl on at me about security.</p><p> </p><p>Code:</p><p>[CODE]<?php</p><p>$_SESSION['localhostrealname'] = "";</p><p>include("ban.php");</p><p>session_start();</p><p>$id = $_SESSION['localhostid'];</p><p>$con = mysql_connect("localhost","root","");</p><p>if (!$con)</p><p> {</p><p> die('Could not connect: ' . mysql_error());</p><p> }</p><p> </p><p>mysql_select_db("vote", $con);</p><p> </p><p>$result = mysql_query("SELECT * FROM layout WHERE username='$id'");</p><p> </p><p>while($row = mysql_fetch_array($result))</p><p> {</p><p> $background = $row['background'];</p><p> $profile_picture = $row['profile_picture'];</p><p> $real_name = $row['real_name'];</p><p> $_SESSION['localhostrealname'] = "$real_name";</p><p> }</p><p> </p><p>mysql_close($con);</p><p>?></p><p><link rel='stylesheet' type='text/css' href='back.php' /></p><p><div id="profile_picture"></p><p> </p><p></div></p><p><?php</p><p>$id = $_GET['id'];</p><p>$_SESSION['localhostid'] = "$id";</p><p>?></p><p><span id="real_name"><?php echo $_SESSION['localhostrealname']; ?></span>[/CODE]</p></blockquote><p></p>
[QUOTE="NSA, post: 175481, member: 10034"] Hey guys, Doing a project for College and I need to be able to display information from a database. I currently have a profile.php page which set's some variables, send's them to another PHP file which acts as a CSS file. The problem I am having is, it doesn't update unless I "refresh the page". If I go directly to the url profile.php?id=Josh it will still display for instance Anna's username from "profile.php?id=anna". But when I refresh the new one, it updates to "Josh". I am aware of security issues in my code, but it is just for a College project, so don't bawl on at me about security. Code: [CODE]<?php $_SESSION['localhostrealname'] = ""; include("ban.php"); session_start(); $id = $_SESSION['localhostid']; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("vote", $con); $result = mysql_query("SELECT * FROM layout WHERE username='$id'"); while($row = mysql_fetch_array($result)) { $background = $row['background']; $profile_picture = $row['profile_picture']; $real_name = $row['real_name']; $_SESSION['localhostrealname'] = "$real_name"; } mysql_close($con); ?> <link rel='stylesheet' type='text/css' href='back.php' /> <div id="profile_picture"> </div> <?php $id = $_GET['id']; $_SESSION['localhostid'] = "$id"; ?> <span id="real_name"><?php echo $_SESSION['localhostrealname']; ?></span>[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
$_GET Help!
Top