Jump to content

show database input


searls03

Recommended Posts

ok, so I have this code to start with:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['username'])) { 
   echo 'Please <a href="/login.php">log in</a> to access your account';
   exit(); 
}

//Connect to the database through our include 
include_once "connect_to_mysql_1.php";
// Place Session variable 'id' into local variable
$username1 = $_SESSION['username'];
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'");
while($row = mysql_fetch_array($sql)){
$userid = $row["userid"];
$hometown = $row["hometown"];
$about = $row["about"];
$month = $row["month"];
$day = $row["day"];
$year = $row["year"];
$userid1 = $row["id"];

}
$sql = mysql_query("SELECT * from sessions WHERE username='$username1'");
while($row = mysql_fetch_array($sql)){
$name1 = $row["name"];

}
?>
<?php if($month == "January"){ $month2 =="1";}else if($month =="February"){$month2 =="2";}else if($month =="March"){$month2 =="3";}else if($month =="April"){$month2 =="4";}else if($month =="May"){$month2 =="5";}else if($month =="June"){$month2 =="6";}else if($month =="July"){$month2 =="7";}else if($month =="August"){$month2 =="8";}else if($month =="September"){$month2 =="9";}else if($month =="October"){$month2 =="10";}else if($month =="November"){$month2 =="11";}else if($month =="December"){$month2 =="12";}

?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * from pics WHERE user='$username1'");
while($row = mysql_fetch_array($sql)){
$link123 = $row["link"];

}
?>
<?php
if(isset($_SESSION['username']))
{

   $query = "SELECT sport FROM sports where user ='$username1'";
   $result = mysql_query($query) or die('Error : ' . mysql_error());
  
   // create the article list

   while($row = mysql_fetch_array($result, MYSQL_NUM))
   {
      list($sport) = $row;

      $cs .=  "$sport<br>
";
   
   }}
	  

  

?>   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script language="javascript" type='text/javascript'>
function hideDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideShow').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideShow.visibility = 'hidden';
}
else { // IE 4
document.all.hideShow.style.visibility = 'hidden';
}
}
}

function showDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideShow').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.hideShow.visibility = 'visible';
}
else { // IE 4
document.all.hideShow.style.visibility = 'visible';
}
}
}
</script>
<script language="javascript" type='text/javascript'>
function hideDiv1() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('apDiv4').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.apDiv4.visibility = 'hidden';
}
else { // IE 4
document.all.apDiv4.style.visibility = 'hidden';
}
}
}

function showDiv1() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('apDiv4').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.apDiv4.visibility = 'visible';
}
else { // IE 4
document.all.apDiv4.style.visibility = 'visible';
}
}
}
</script> 
<style type="text/css">
#apDiv1 {
position:absolute;
left:0px;
top:0px;
width:100%;
height:50px;
z-index:1;
background-color: #000;
padding: 0px;
text-align: left;
}
#menu {
position:absolute;
top:15px;
width:411px;
height:34px;
z-index:41;
right: 0px;
}
</style>
<link rel="stylesheet" href="css/structure.css" type="text/css" />
<link rel="stylesheet" href="css/form.css" type="text/css" />

<!-- JavaScript -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(function() {

$(".submit").click(function() {


    var name = $("#name").val();

     

    var dataString = 'name='+ name;



if(name=='')
{
$('.success').fadeOut(200).hide();

    $('.error').fadeOut(200).show();

}


else
{
$.ajax({
type: "POST",
    url: "join.php",
    data: dataString,
    success: function(){
$('.success').fadeIn(200).show();
    $('.error').fadeOut(200).hide();

$(document).ready(function(){	

	$('#submit').click(function(){

		var a = $("#name").val();
		if(a != "")
		{
			$.post("join.php",{

			}, function(response){

				$('#posting').prepend($(response).fadeIn('slow'));
				$("#name").val("what's on your mind?");
			});
		}
	});	
});

   }
});




}


    return false;
});



});
</script>
<style type="text/css">

.error{

color:#d12f19;
font-size:12px;


}
.success{

color:#006600;
font-size:12px;


}
</style>
<link href="Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css" rel="stylesheet" type="text/css" />
<script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryMenu.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js" type="text/javascript"></script>
<style type="text/css">
/* BeginOAWidget_Instance_2141544: #MenuBar */
/* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in
these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css

 These assume the following widget classes for menu layout (set in a preset)
.MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right.
.MenuBarVertical - vertical main bar; all submenus are pull-right.

You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. 
They only apply to horizontal menu bars:
	MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned
	MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned
	MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned.  
	MenuBarFixedCentered -  - Fixed at a specified width set in the rule '.MenuBarFixedCentered', 
					and centered in its parent container.
	MenuBarFullwidth - Grows to fill its parent container width.

In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along
with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations,
there are a few rules where this was not possible. Those rules are so noted in comments.

*/

#MenuBar  {
background-color:#000000;	
font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer,
											MenuItem, and MenuItemLabel
											at a given level all use same definition for ems.
											Note that this means the size is also inherited to child submenus, 
											so use caution in using relative sizes other than
											100% on submenu fonts. */
font-weight: normal;
font-size: 16px;
font-style: normal;
padding:0;	
border-color: #000000 #000000 #000000 #000000; 
border-width:0px;
border-style: none none none none;
}
/* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this
widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar 
in this section. These have very low specificity, so be careful not to accidentally override them. */

.MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */
display:none;
}
.MenuBarLeftShrink {
float: left; /* shrink to content, as well as float the MenuBar */
width: auto;
}
.MenuBarRightShrink {
float: right; /* shrink to content, as well as float the MenuBar */
width: auto;
}
.MenuBarFixedLeft {
float: left;
width: 80em;
}
.MenuBarFixedCentered {
float: none;
width: 80em;
margin-left:auto;
margin-right:auto;
}
.MenuBarFixedCentered br {
clear:both;
display:block;
}
.MenuBarFixedCentered .SubMenu br {
display:none;
}
.MenuBarFullwidth {
float: left;
width: 100%;
}

/* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */
#MenuBar  .MenuItemContainer {
padding: 0px 0px 0px 0px; 
margin: 0; 	/* Zero out margin  on the item containers. The MenuItem is the active hover area.
			For most items, we have to do top or bottom padding or borders only on the MenuItem 
			or a child so we keep the entire submenu tiled with items.
			Setting this to 0 avoids "dead spots" for hovering. */
}
#MenuBar  .MenuItem {
padding: 0px 24px 0px 0px; 
background-color:#000000;	
border-width:0px;
border-color: #cccccc #ffffff #cccccc #ffffff; 
border-style: none solid none solid;
}
#MenuBar  .MenuItemFirst {
border-style: none none none none;
}
#MenuBar .MenuItemLast {
border-style: none solid none none;
}

#MenuBar  .MenuItem  .MenuItemLabel{
text-align:center;
line-height:1.4em;
color:#ffffff;
background-color:#000000;
padding: 6px 15px 6px 39px;
width: 10em;
width:auto; 
}
.SpryIsIE6 #MenuBar  .MenuItem  .MenuItemLabel{
width:1em; /* Equivalent to min-width in modern browsers */
}

/* First level submenu items */
#MenuBar .SubMenu  .MenuItem {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
font-size: 14px;
font-style: normal;
background-color:#ffffff;
padding:0px 2px 0px 0px;
border-width:0px;
border-color: #cccccc #cccccc #cccccc #cccccc; 
/* Border styles are overriden by first and last items */
border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst {
border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst .MenuItemLabel{
padding-top: 6px; 
}
#MenuBar .SubMenu .MenuItemLast {
border-style: solid solid solid solid;
}
#MenuBar .SubMenu .MenuItemLast .MenuItemLabel{
padding-bottom: 6px; 
}
#MenuBar .SubMenu .MenuItem .MenuItemLabel{
text-align:left;
line-height:1em;	
background-color:#ffffff;
color:#333333;
padding: 6px 12px 6px 5px; 
width: 7em;

}

/* Hover states for containers, items and labels */
#MenuBar .MenuItemHover {
background-color: #666666;
border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
#MenuBar .MenuItemHover .MenuItemLabel{
background-color: #666666;
color: #ffffff;
}
#MenuBar .SubMenu .MenuItemHover {
background-color: #666666; 
border-color: #666666 #cccccc #cccccc #cccccc; 
}

#MenuBar .SubMenu .MenuItemHover .MenuItemLabel{
background-color: #666666; 
color: #ffffff;
}
/* Submenu properties -- First level of submenus */
#MenuBar .SubMenuVisible {
background-color: #ffffff;
min-width:0%;  /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */
border-color: #ffffff #ffffff #ffffff #ffffff; 
border-width:0px;
border-style: none none none none;
}
#MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */
top: 100%;	/* 100% is at the bottom of parent menuItemContainer */
left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, 
				and your personal taste.
				0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 
				on MenuItemContainer and MenuItem on the parent
				menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align 
				the dropdown with the left of the menu item label.*/
z-index:10;
}
#MenuBar.MenuBarVertical .SubMenuVisible {
top: 0px;	
left:100%;
min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */
}
/* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */
#MenuBar .MenuLevel1 .SubMenuVisible {
background-color: #ffffff;
min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/
top: 0px;	/* If desired, you can move this down a smidge to separate top item''s submenu from menubar - 
			that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more
			vertically 'centered' on its invoking item */
left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a 
			negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value
			to use px or ems to get the offset you want. */
}
/* IE6 rules - you can delete these if you do not want to support IE6 */

/* A note about multiple classes in IE6.
* Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu),
* giving the selector '.MenuItemWithSubMenu.MenuItemHover'.
* Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores
* all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this 
* problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. 
* Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class
* syntax for that. Since IE6 both applies rules where 
* it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. 
* So, we put the multiple class rule first. IE6 will mistakenly apply this rule.  We follow this with the single-class rule that it would 
* mistakenly override, making sure the  misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. 
* We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for
* the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the 
* css style block to make it easy to delete if you want to drop IE6 support.
* If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script.
* The 'SpryIsIE6' class is placed on the HTML element by  the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules.
*/
.SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector  */{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
.SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector  */{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
.SpryIsIE6 #MenuBar .SubMenu .SubMenu  /* IE6 selector  */{
margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */
}


/* EndOAWidget_Instance_2141544 */
#apDiv2 {
position:absolute;
left:5px;
top:75px;
width:591px;
height:284px;
z-index:2;
}
#hideShow {
position:absolute;
left:84px;
top:211px;
width:506px;
height:47px;
z-index:2;
}
#apDiv3 {
position:absolute;
left:4px;
top:354px;
width:306px;
height:45px;
z-index:3;
}
#apDiv4 {
position:absolute;
left:82px;
top:275px;
width:290px;
height:34px;
z-index:4;
}
#apDiv5 {
position:absolute;
left:17px;
top:205px;
width:861px;
height:172px;
z-index:2;
}
.fullname {
position:relative;
left:0px;
width:100px;
height:30px;
z-index:4;
top:25px;
background-color:black;
color:white;
text-align: center;
}
#apDiv5 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible #form1 table tr td {
text-align: right;
}
</style>
<script type="text/xml">
<!--
<oa:widgets>
  <oa:widget wid="2141544" binding="#MenuBar" />
</oa:widgets>
-->
</script>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv6 {
position:absolute;
left:4px;
top:54px;
width:162px;
height:147px;
z-index:3;
}
</style>
</head>

<body onLoad="javascript:TabbedPanels1.showPanel(<?php echo $_COOKIE['index'];?>)">
<?php $birthday1 = "$year-$month2-$day"; ?>
<div id="apDiv1">
  <div id="menu">
    <ul id="MenuBar" class="MenuBarHorizontal">
  <li><a href="index.php">Home</a>  </li>
  <li><a href="profile.php">Profile</a></li>
  <li><a class="MenuBarItemSubmenu" href="#">Account</a>
    <ul>
      <li><a href="settings.php">Account Settings</a>      </li>
      <li><a href="privacy.php">Privacy Settings</a></li>
      <li><a href="logout.php">Logout</a></li>
    </ul>
  </li>
</ul>
    <script type="text/javascript">
// BeginOAWidget_Instance_2141544: #MenuBar
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
      widgetID: "MenuBar",
  widgetClass: "MenuBar  MenuBarRightShrink",
  insertMenuBarBreak: true,
      mainMenuShowDelay: 100,
      mainMenuHideDelay: 200,
      subMenuShowDelay: 200,
      subMenuHideDelay: 200
      });
// EndOAWidget_Instance_2141544
    </script>
  </div>
<a href="/main.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/hover.png',1)"><img src="/main.png" name="Image1" width="600" height="50" border="0" id="Image1" /></a> </div>

<?php

// Process the form if it is submitted
if ($_POST['general']) {
$city1 = $_POST['city'];
$hometown1 = $_POST['hometown'];
$about1 = $_POST['about'];


$sql = mysql_query("UPDATE general SET city='$city1', hometown='$hometown1', about='$about1' WHERE id='$userid1'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
} // close if post
?>
<div id="apDiv5">
  <div id="TabbedPanels1" class="VTabbedPanels">
    <ul class="TabbedPanelsTabGroup">
      <li class="TabbedPanelsTab" tabindex="0">Basic Info</li>
      <li class="TabbedPanelsTab" tabindex="0">Profile Picture</li>
      <li class="TabbedPanelsTab" tabindex="0">Sports</li>
      <li class="TabbedPanelsTab" tabindex="0">Activities</li>
      <li class="TabbedPanelsTab" tabindex="0">Contact Info</li>
</ul>
    <div class="TabbedPanelsContentGroup">
      <div class="TabbedPanelsContent"><form id="form1" name="form1" method="post" action="">
          <label for="city"></label>
          <table width="496" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td width="157" scope="col">Current City:</td>
              <td width="333" scope="col"><div align="left">
                <input type="text" name="city" id="city" value="<?php echo $city; ?>" />
              </div></td>
            </tr>
            <tr>
              <td>Hometown:</td>
              <td><div align="left">
                <label for="hometown"></label>
                <input type="text" name="hometown" id="hometown" value="<?php echo $hometown; ?>" />
              </div></td>
            </tr>
            <tr>
              <td>Birthday:</td>
              <td><div align="left"><?php echo $month;?> <?php echo $day; ?>, <?php echo $year; ?></div></td><tr><td></td><td> <div align="left"><?php

  //calculate years of age (input string: YYYY-MM-DD)
  function birthday ($birthday){
    list($year,$month,$day) = explode("-",$birthday);
    $year_diff  = date("Y") - $year;
    $month_diff = date("m") - $month;
    $day_diff   = date("d") - $day;
    if ($day_diff < 0 || $month_diff < 0)
      $year_diff--;
    return $year_diff;
  }
echo  birthday($birthday1). " years old";

?></div></td></tr></td>
            </tr>
            <tr>
              <td>About Me: </td>
              <td><label for="about"></label>
              <textarea name="about" id="about" cols="45" rows="5"></textarea></td>
            </tr>
            <tr>
              <td> </td>
              <td><div align="left"><input name="general" id="general" type="submit" value="Save information" class="fullname" /></div></td>
            </tr>
            <tr>
              <td> </td>
              <td> </td>
            </tr>
          </table>
        </form></div>
      <div class="TabbedPanelsContent"><form enctype="multipart/form-data" action="profile.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="900000000000000000000000000000000000000000000000000000000000000000000000000" />
Choose a file to upload:

     <div id="dynamicInput">
          <p>Entry 1</p>
          <p>
           
            <br>
            <input type="file" name="uploadedfile[]">
          </p>
     </div>
    
<input type="submit" value="Upload File" id="submit" name="submit" />
</form>
<?php
if($_POST['submit']){
// Where the file is going to be placed
$target_path = 'images/'.$username1.'/';

foreach ($_FILES["uploadedfile"]["name"] as $key => $value) {
$uploadfile = $target_path . basename($_FILES["uploadedfile"]["name"][$key]);
$uploadfile1 =   basename($_FILES["uploadedfile"]["name"][$key]);
//echo $uploadfile;
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { 
$sql = mysql_query("UPDATE pics SET link='$uploadfile', name='$uploadfile1' WHERE user='$username1'")or die(mysql_error());
$sql = mysql_query("UPDATE facebook_posts SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error());
$sql = mysql_query("UPDATE facebook_posts_comments SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error());
echo $value . ' uploaded<br>'; }
}

}

?>
</div>
      <div class="TabbedPanelsContent"><form autocomplete="off"
enctype="multipart/form-data" method="post"  name="form">

<div class="info" style="padding-left:20px">
<h2> </h2>
<div></div>
<div>
  <p>Sport:
    <input id="name" 			name="name" 			type="text" 			class="field text medium" 			value="" 			maxlength="255" 			tabindex="1" 			/>
    </p>
  <p></p>
</div>
<div></div>
</div>
<div class="buttons">
			<input  type="submit" value="Submit" style=" background:#0060a1; color:#FFFFFF; font-size:14px; border:1px solid #0060a1; margin-left:12px" class="submit" name="submit" id="submit"/><span class="error" style="display:none"> Please Enter Valid Data</span><?php 
if($_POST['submit']){
?><span  class="success" style="display:none"> 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?php
$sql123 = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'");
while($row = mysql_fetch_array($sql123)){
$id = $row["id"];
$sport1 .= $row["sport"];
$user = $row["user"];}
echo $sport1;
;}
?></span>
  </div>
</form></div>
      <div class="TabbedPanelsContent">Content 4</div>
      <div class="TabbedPanelsContent">Content 5
        
      </div>
</div>
  </div>
</div>
<div id="posting" align="center">

	<?php 

	include_once "posting.php"; ?>
	  
	</div>
        
<div id="apDiv6"><?php echo '<img src="'.$link123.'" width="162""/>'; ?></div>
<script type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
</script>
</body>
</html>

 

My goal is to make it so that where the really long comment(well with no words), is at that it runs after the ajax at the begining of the script so that the database input it does shows up in that result.  here is the code of join.php

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['username'])) { 
   echo 'Please <a href="/login.php">log in</a> to access your account';
   exit(); 
}

//Connect to the database through our include 
include_once "connect_to_mysql_1.php";
// Place Session variable 'id' into local variable
$username1 = $_SESSION['username'];
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'");
while($row = mysql_fetch_array($sql)){
$userid = $row["userid"];
$hometown = $row["hometown"];
$about = $row["about"];
$month = $row["month"];
$day = $row["day"];
$year = $row["year"];
$userid1 = $row["id"];

}
$sql = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'");
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$sport1 = $row["sport"];
$user = $row["user"];

}
if($_POST)
{
$sport=$_POST['name'];

mysql_query("INSERT INTO sports (id, sport, user)
VALUES ('$userid1', '$sport', '$username1')");
}else { }

?>
<html>
<head>
</head>
<body>
<?php echo $sport1; ?>
</body>
</html>

 

I hope this makes sense.  so once again, I need the results that the code by the long comment(sorta)  will basically run after the ajax uses join.php to input info into the dbase.  or is there a better way to do this?  currently the results are loading even before the page loads. so that it returns the results when it is supposed to, it just didn't query the database at the right time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.