Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 23rd, 2005, 2:18 PM   #1
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Trying to acces SQL and put content in dv tag

Hi there,

I've been asked to help out with a website by getting some php content to work in a new layout. I'm having trouble with this one file which is supposed to display a members list in a CSS shell. Here's the code:

<?php
require_once("global/php/functions/wec_fns.php");
$conn = db_connect();
if ($conn == false) {
echo "coudn't connect";
}
$thepagename = "wec_members";
$thesection = 1;
if ($HTTP_GET_VARS['sort'] == "company") {
$sorter = "CompanyName";
} else {
$sorter = "LastName";
}
?>
<?php
$sql = "select * from wec_pages where pagename = '$thepagename' and section_number = $thesection";
#echo '$sql: '.$sql.'<br />';
$result = mysql_query($sql,$conn);
#echo '$result: '.$result.'<br />';
if (mysql_num_rows($result))
{
$s = get_page_by_pagename_and_sec($thepagename,$thesection);
$item_found = 'Y';

$pagefilename = $s[pagename];
$pagename = $s[page_name];
$pagetitle = $s[pagetitle];
$content = $s[content];
$lastedit = $s[lastedit];
$pageID = $s[page_number];
$sectionID = $s[section_number];
$sectionname = $s[section_name];
}
else
{
$item_found = 'N';
}
/*
#$sql = "select * from wec_members where ShowOnWebsite = 'Y' and status = 1";
#echo '$sql: '.$sql.'<br />';
#$mem_result = mysql_query($sql,$conn);
#echo '$result: '.$result.'<br>';
*/
if (mysql_num_rows($result))
{
# this function is in global/php/functions in a program called wec_getdata_fns.php
# the function was modified by arnold on 20041028 to handle the new member type
# like mf, mv, mc, etc.
$rs = get_members_by_showonweb_all($sorter);
$members_found = 'Y';
}
else
{
$members_found = 'N';
}
?>

This goes in the html:
<div id="example">
<?php echo $content ?></div>

The content doesn't display. Any ideas about what the problem is or where to do research?

Thanks.
Epoch_Apex is offline   Reply With Quote
Old Oct 23rd, 2005, 2:21 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Please read the forum FAQ/rules, then edit your post to incorporate the required code tags. That unindented crap is uglier than my ex-mother-in-law. Too hard to read, so discouraging to potential respondents.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 23rd, 2005, 2:24 PM   #3
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 6 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Well it seems like you've got a very good start, could you show us require_once("global/php/functions/wec_fns.php"); ?

Also, it's easier to read PHP code if it's in [ P H P ] [ / P H P ] tags (without the spaces).
__________________

tempest is offline   Reply With Quote
Old Oct 24th, 2005, 2:58 PM   #4
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Sorry for not reading ht FAQ. This is what the main functions fiule contains:

  require_once("wec_data_valid_fns.php"); 
  require_once("wec_db_fns.php");
  require_once("wec_getdata_fns.php");
  require_once("wec_output_fns.php");

I'm guessing the problem is in the output funciton. Here's output_fns:

<?php
session_start();
//ini_set("register_globals",1);
//======================================================================================
function do_html_URL_var_nobr($url, $name, $var)
//======================================================================================
{
  // output URL as link and br
  /*
    echo "\$url is $url <br>";
    echo "\$name is $name <br>";
    echo "\$var is $var <br>";
  */
// <div align="center">
// </div>
?>
 <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>
  <a href="<?=$url?>?<?=SID?>&<?=$var?>"><?=$name?></a></b></font>
<?php
}
//======================================================================================
function do_html_URL_nobr($url, $name, $gobackwhere)
//======================================================================================
{
  // output URL as link and br
  /*
    echo "url is $url <br>";
    echo "name is $name <br>";
    echo "gobackwhere is: $gobackwhere <br>";
  */
?>
  <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>
  <a href="<?=$url?>?<?=SID?>"><?=$name?></a><br></font></div>
<?php
}

//======================================================================================
function encrypt_data($data,$passwd)
//======================================================================================
{
  for($i=0, $j=0; $i < strlen($data); $i++,$j++)
  {
	  $middle = ord(substr($data,$i,1)) + ord(substr($passwd,$j,1));
			if ($j > strlen($passwd))
			  {
					 $j=0;
					}
				$estr .= chr($middle);
	 	}
 	return ($estr);
}
	//======================================================================================
function decrypt_data($data,$passwd)
//======================================================================================
 {
  for($i=0, $j=0; $i < strlen($data); $i++,$j++)
  {
	  $middle = ord(substr($data,$i,1)) - ord(substr($passwd,$j,1));
			if ($j > strlen($passwd))
			  {
					 $j=0;
					}
				$estr .= chr($middle);
		}
		return ($estr);
	}
	?>

Any help would be appreciated. I just need a hint about why its not displaying.
Epoch_Apex is offline   Reply With Quote
Old Oct 24th, 2005, 3:00 PM   #5
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Sorry for not reading ht FAQ. This is what the main functions fiule contains:

  require_once("wec_data_valid_fns.php"); 
  require_once("wec_db_fns.php");
  require_once("wec_getdata_fns.php");
  require_once("wec_output_fns.php");

I'm guessing the problem is in the output funciton. Here's output_fns:

[PHP]<?php
session_start();
//ini_set("register_globals",1);
//======================================================================================
function do_html_URL_var_nobr($url, $name, $var)
//======================================================================================
{
// output URL as link and br
/*
echo "\$url is $url <br>";
echo "\$name is $name <br>";
echo "\$var is $var <br>";
*/
// <div align="center">
// </div>
?>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>
<a href="<?=$url?>?<?=SID?>&<?=$var?>"><?=$name?></a></b></font>
<?php
}
//======================================================================================
function do_html_URL_nobr($url, $name, $gobackwhere)
//======================================================================================
{
// output URL as link and br
/*
echo "url is $url <br>";
echo "name is $name <br>";
echo "gobackwhere is: $gobackwhere <br>";
*/
?>
<div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>
<a href="<?=$url?>?<?=SID?>"><?=$name?></a><br></font></div>
<?php
}

//======================================================================================
function encrypt_data($data,$passwd)
//======================================================================================
{
for($i=0, $j=0; $i < strlen($data); $i++,$j++)
{
$middle = ord(substr($data,$i,1)) + ord(substr($passwd,$j,1));
if ($j > strlen($passwd))
{
$j=0;
}
$estr .= chr($middle);
}
return ($estr);
}
//======================================================================================
function decrypt_data($data,$passwd)
//======================================================================================
{
for($i=0, $j=0; $i < strlen($data); $i++,$j++)
{
$middle = ord(substr($data,$i,1)) - ord(substr($passwd,$j,1));
if ($j > strlen($passwd))
{
$j=0;
}
$estr .= chr($middle);
}
return ($estr);
}
?>[/PHP]

Any help would be appreciated. I just need a hint about why its not displaying.
Epoch_Apex is offline   Reply With Quote
Old Oct 24th, 2005, 3:41 PM   #6
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Oh, here's the original page:

http://www.wec.ca/wec_members.php

Here's the page its supposed to go into:

http://www.wec.ca/staging/new_members.php

Maybe that helps. It can't be that complicated, just need to move the info to a new div tag.
Epoch_Apex is offline   Reply With Quote
Old Oct 24th, 2005, 9:38 PM   #7
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Hopefully, I haven't breached any security measure by revealing this info.

How do I edit my posts on this board? And is this an allright request to be making by asking for help?
Epoch_Apex is offline   Reply With Quote
Old Oct 25th, 2005, 12:16 PM   #8
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Seriously, how do I edit my posts? Can't find it anywhere.
Epoch_Apex is offline   Reply With Quote
Old Oct 25th, 2005, 12:23 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You have about 30 minutes to edit a post, then the capability goes away. There is something to be said for that. A thread should reflect what has gone on. I've seen threads (on other forums) that were edited in the sense that content was entirely removed. They don't make any sense in that context. Edits, where available, should be ADDITIONS TO, and clearly marked as edits. That doesn't apply to the correction of typos or the removal of inappropriate links, of course, but it does apply to major content.

A major point here is that when you decide to participate in a new forum, it is only reasonable and polite to check the FAQs, the rules, and the posting suggestions. Not doing so conveys a (reasonable) impression that one would probably rather not convey.

In a technical forum such as this, the inability to understand what HTML pages do with whitespace, and the inability to understand how to apply code tags, says a lot about the level of competence. It ain't illegal, but it's kinda strange if you're claiming some amount of quasi-expertise.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 25th, 2005, 12:45 PM   #10
Epoch_Apex
Newbie
 
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0 Epoch_Apex is on a distinguished road
Ok, so I didn't read the rules/FAQ before I posted. Can you blame me for being a little sick of all the text drivel I have to read?

Dawei, I'm not sure if your comments were aimed at me specifically. Not putting the code in tags doesn't reflect my personal lack of understanding, but rather lack of care. Sorry. I just wanted to edit this post b/c I'm wondering how professional it is to give away all this info. Whatever, who would want to hack a site like that anyway?

Can someone please help me out with this?
Epoch_Apex is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC