Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

My data does not show up in web pages PHP

Posted on 2009-07-15
18
408 Views
Last Modified: 2013-12-13
Hi I'm using Dreaweaver (gasp!) to set up a web page displaying data from a mySQL database.
The connection works fine and when tested it retrieves data correctly. When I upload the file no data appears.
Any ideas?
<?php echo $row_rsSubPages['subPage_Content']; ?>

Open in new window

0
Comment
Question by:cokefour
  • 8
  • 6
  • 4
18 Comments
 
LVL 14

Expert Comment

by:profya
ID: 24858126
Add this code to your page:
error_reporting(E_ALL);
to see what's going on.
0
 
LVL 14

Expert Comment

by:profya
ID: 24858150
1) Make sure using PHPMyAdmin for example that the database has successfully created and it contains the data.
2) If you are using non-standard plugins make sure that they have been enabled.
0
 
LVL 5

Author Comment

by:cokefour
ID: 24858229
It says "Parse error: syntax error, unexpected T_IF in /home/fhlinux133/b/bluefonteinventures.com/user/htdocs/aboutus.php on line 4"
that's the line below

if (!function_exists("GetSQLValueString")) {

Open in new window

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 14

Expert Comment

by:profya
ID: 24858287
May be there is a missing semi-colon or bracket in the line above. Line 4 is good for me.
0
 
LVL 5

Author Comment

by:cokefour
ID: 24858372
This came up after I put a semi colon after the error reporting line

Notice: Array to string conversion in /home/fhlinux133/b/bluefonteinventures.com/user/htdocs/aboutus.php on line 8

LINE 8 BELOW
 $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

Open in new window

0
 
LVL 14

Expert Comment

by:profya
ID: 24858437
It is a notice, not an error, however, If $theValue is array then you should not use stripslashes.
0
 
LVL 5

Author Comment

by:cokefour
ID: 24858480
no plug ins the database is populated, checked it in Dreamweaver still no data showing
0
 
LVL 14

Expert Comment

by:profya
ID: 24858511
All errors disappeared?
0
 
LVL 5

Author Comment

by:cokefour
ID: 24858547
no errors
0
 
LVL 14

Expert Comment

by:profya
ID: 24858727
Please submit:
Page source generated (HTML code generated from the browser)
The source code of the php page, with access information and other sensitive information removed
0
 
LVL 5

Author Comment

by:cokefour
ID: 24858871
that's the source code, design time then runtime under it

<?php include('Connections/connBlue.php'); ?>
<?php
error_reporting(E_ALL);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$colname_rsSubPages = "1";
if (isset($_GET['subPages_id'])) {
  $colname_rsSubPages = $_GET['subPages_id'];
}
mysql_select_db($database_connBlue, $connBlue);
$query_rsSubPages = sprintf("SELECT * FROM subPages WHERE subPages_id = %s", GetSQLValueString($colname_rsSubPages, "int"));
$rsSubPages = mysql_query($query_rsSubPages, $connBlue) or die(mysql_error());
$row_rsSubPages = mysql_fetch_assoc($rsSubPages);
$totalRows_rsSubPages = mysql_num_rows($rsSubPages);
 
$MMColParam_rsSubPages = "$_REQUEST";
if (isset($_REQUEST)) {
  $MMColParam_rsSubPages = $_REQUEST;
}
mysql_select_db($database_connBlue, $connBlue);
$query_rsSubPages = sprintf("SELECT * FROM subPages WHERE subPages.subPages_Parent = '/aboutus.php' AND subPages.subPages_id =' %s'", GetSQLValueString($MMColParam_rsSubPages, "int"));
$rsSubPages = mysql_query($query_rsSubPages, $connBlue) or die(mysql_error());
$row_rsSubPages = mysql_fetch_assoc($rsSubPages);
?>
<!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>About Bluefontein Ventures - <?php echo $row_rsSubPages['subPage_Title']; ?></title>
<link href="/bluefontein2009.css" rel="stylesheet" type="text/css" />
<link href="p7pmm/p7PMMh10.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="p7pmm/p7PMMscripts.js"></script>
</head>
 
<body>
<div id="wrapper">
  <div class="masthead" id="homemast"><img src="/images/aboutmasthead.jpg" width="804" height="74" alt="bluefontein masthead" /></div>
<div id="p7PMM_1" class="p7PMMh10">
    <ul class="p7PMM">
      <li><a href="/index.php" class="p7PMM_img"><img src="/images/nav/home.jpg" width="160" height="25" alt="home" /></a></li>
      <li><a href="/aboutus.php" class="p7PMM_img"><img src="/images/nav/about.jpg" width="160" height="25" alt="about the company" /></a></li>
      <li><a href="/ourservices.php" class="p7PMM_img"><img src="/images/nav/services.jpg" width="160" height="25" alt="our services" /></a></li>
      <li><a href="/projects.php" class="p7PMM_img"><img src="/images/nav/projects.jpg" width="160" height="25" alt="project portfolio" /></a></li>
      <li><a href="/contactus.php" class="p7PMM_img"><img src="/images/nav/contact.jpg" width="160" height="25" alt="contact us" /></a></li>
    </ul>
<div class="p7pmmclearfloat">&nbsp;</div>
    <!--[if lte IE 6]>
<style>.p7PMMh10 ul ul li {float:left; clear: both; width: 100%;}.p7PMMh10 {text-align: left;}.p7PMMh10, .p7PMMh10 ul ul a {height: 1%;}</style>
<![endif]-->
    <!--[if IE 5.500]>
<style>.p7PMMh10 {position: relative; z-index: 9999999;}</style>
<![endif]-->
    <!--[if IE 7]>
<style>.p7PMMh10, .p7PMMh10 a{zoom:1;}.p7PMMh10 ul ul li{float:left;clear:both;width:100%;}</style>
<![endif]-->
    <script type="text/javascript">
<!--
P7_PMMop('p7PMM_1',1,2,-5,-5,0,1,0,1,2,3,1,1,0);
//-->
    </script>
  </div>
<div id="p7PMM_2" class="p7PMMh10">
    <ul class="p7PMM">
      <li><a href="#" class="p7PMM_img"><img src="/images/nav/blank.jpg" width="160" height="25" alt="" /></a></li>
      <li><a href="/aboutus.php?subPage_ID=1" class="p7PMM_img"><img src="/images/nav/company.jpg" width="160" height="25" alt="company background" /></a></li>
      <li><a href="aboutus.php?subPages_id=3" class="p7PMM_img"><img src="/images/nav/mission.jpg" width="160" height="25" alt="" /></a></li>
      <li><a href="/healthandsafety.php" class="p7PMM_img"><img src="/images/nav/healthandsafety.jpg" width="160" height="25" alt="health and safety policy" /></a></li>
      <li><a href="/qualitypolicy.php" class="p7PMM_img"><img src="/images/nav/quality.jpg" width="160" height="25" alt="quality policy" /></a></li>
    </ul>
<div class="p7pmmclearfloat">&nbsp;</div>
    <!--[if lte IE 6]>
<style>.p7PMMh10 ul ul li {float:left; clear: both; width: 100%;}.p7PMMh10 {text-align: left;}.p7PMMh10, .p7PMMh10 ul ul a {height: 1%;}</style>
<![endif]-->
    <!--[if IE 5.500]>
<style>.p7PMMh10 {position: relative; z-index: 9999999;}</style>
<![endif]-->
    <!--[if IE 7]>
<style>.p7PMMh10, .p7PMMh10 a{zoom:1;}.p7PMMh10 ul ul li{float:left;clear:both;width:100%;}</style>
<![endif]-->
    <script type="text/javascript">
<!--
P7_PMMop('p7PMM_2',1,2,-5,-5,0,1,0,1,2,3,1,1,0);
//-->
    </script>
  </div>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
      <td width="161"><img src="/images/aboutmainimage.jpg" width="161" height="250" alt="global reach" /></td>
      <td width="639" valign="top"><p><?php echo $row_rsSubPages['subPage_Content']; ?><?php echo $row_rsSubPages['subPage_Title']; ?></p></td>
    </tr>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="1">
  <tr>
    <th width="275">The Team</th>
    <th width="275">Our Technical Partners</th>
    <th>Work With Us</th>
  </tr>
  <tr>
    <td width="275" valign="top" bgcolor="#CDAE84"><p>Mr Sokpiri Graham-Douglas - Managing Director</p>
    <p>Mr Olayinka Coker - General Manager</p></td>
    <td width="275" valign="top" bgcolor="#A4A3CB"><p>Bluefontein Ventures Ltd when necessary  enters in to partnership with some other companies<br />
      For most of its technical jobs. A few  examples are Fadicom International (Electrification/Electrical Engineering)  Hado Construction and Darycet International (Civil Engineering works) </p></td>
    <td valign="top"><p>If you are interested in a career at Bluefontein or would like to partner with us please fill in the form below and we will be in touch to discuss mutual benefits with you.</p>
      <form id="form1" name="form1" method="post" action="">
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tr>
            <td align="left" valign="top"><label>Name</label></td>
            <td align="left" valign="top"><input type="text" name="txtName" id="txtName" tabindex="1" /></td>
          </tr>
          <tr>
            <td align="left" valign="top"><label>Email</label></td>
            <td align="left" valign="top"><input type="text" name="txtEmail" id="txtEmail" tabindex="2" /></td>
          </tr>
          <tr>
            <td align="left" valign="top"><label>Enquiry</label></td>
            <td align="left" valign="top"><textarea name="txtMessage" id="txtMessage" cols="25" rows="5" tabindex="3"></textarea></td>
          </tr>
          <tr>
            <td align="left" valign="top">&nbsp;</td>
            <td align="left" valign="top"><input type="submit" name="Submit" id="Submit" value="Submit" tabindex="4" /></td>
          </tr>
        </table>
      </form>
      <p>&nbsp;</p></td>
  </tr>
</table>
 
  <table width="100%" border="0" cellpadding="0" cellspacing="0" id="footer">
  <tr>
    <td bgcolor="#005245">Terms of Use | Privacy Statement | Contact Us | Site Credits</td>
  </tr>
</table>
</div>
</body>
</html>
<?php
mysql_free_result($rsSubPages);
?>
 
*/ /////////////////////////////////////////////////*
 
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>About Bluefontein Ventures - </title><link href="/bluefontein2009.css" rel="stylesheet" type="text/css"><link href="p7pmm/p7PMMh10.css" rel="stylesheet" type="text/css" media="all"><style type="text/css">
.p7PMM div {position:absolute;display:none}
 
</style></head><body><br>
<b>Notice</b>:  Array to string conversion in <b>/home/fhlinux133/b/bluefonteinventures.com/user/htdocs/aboutus.php</b> on line <b>8</b><br>
 
 
 
 
 
 
 
<script type="text/javascript" src="p7pmm/p7PMMscripts.js"></script>
 
 
 
 
<div id="wrapper">
  <div class="masthead" id="homemast"><img src="/images/aboutmasthead.jpg" width="804" height="74" alt="bluefontein masthead"></div>
<div id="p7PMM_1" class="p7PMMh10" style="height: auto; ">
    <ul class="p7PMM level_1" id="p7PMM_1u1" style="position: static; margin-left: 0.5px; ">
      <li class="pmmfirst root_1"><a href="/index.php" class="p7PMM_img pmmfirst" id="p7PMM_1a1"><img src="/images/nav/home.jpg" width="160" height="25" alt="home"></a></li>
      <li class="root_2 li_current_mark"><a href="/aboutus.php" class="p7PMM_img current_mark" id="p7PMM_1a2"><img src="/images/nav/about_overdown.jpg" width="160" height="25" alt="about the company"></a></li>
      <li class="root_3"><a href="/ourservices.php" class="p7PMM_img" id="p7PMM_1a3"><img src="/images/nav/services.jpg" width="160" height="25" alt="our services"></a></li>
      <li class="root_4"><a href="/projects.php" class="p7PMM_img" id="p7PMM_1a4"><img src="/images/nav/projects.jpg" width="160" height="25" alt="project portfolio"></a></li>
      <li class="root_5 pmmlast"><a href="/contactus.php" class="p7PMM_img pmmlast" id="p7PMM_1a5"><img src="/images/nav/contact.jpg" width="160" height="25" alt="contact us"></a></li>
    </ul>
<div class="p7pmmclearfloat" id="p7PMM_1d2"> </div>
    <!--[if lte IE 6]>
<style>.p7PMMh10 ul ul li {float:left; clear: both; width: 100%;}.p7PMMh10 {text-align: left;}.p7PMMh10, .p7PMMh10 ul ul a {height: 1%;}</style>
<![endif]-->
    <!--[if IE 5.500]>
<style>.p7PMMh10 {position: relative; z-index: 9999999;}</style>
<![endif]-->
    <!--[if IE 7]>
<style>.p7PMMh10, .p7PMMh10 a{zoom:1;}.p7PMMh10 ul ul li{float:left;clear:both;width:100%;}</style>
<![endif]-->
    <script type="text/javascript">
<!--
P7_PMMop('p7PMM_1',1,2,-5,-5,0,1,0,1,2,3,1,1,0);
//-->
    </script>
  </div>
<div id="p7PMM_2" class="p7PMMh10" style="height: auto; ">
    <ul class="p7PMM level_1" id="p7PMM_2u1" style="position: static; margin-left: 0.5px; ">
      <li class="pmmfirst root_1"><a href="#" class="p7PMM_img pmmfirst" id="p7PMM_2a6"><img src="/images/nav/blank.jpg" width="160" height="25" alt=""></a></li>
      <li class="root_2"><a href="/aboutus.php?subPage_ID=1" class="p7PMM_img" id="p7PMM_2a7"><img src="/images/nav/company.jpg" width="160" height="25" alt="company background"></a></li>
      <li class="root_3"><a href="aboutus.php?subPages_id=3" class="p7PMM_img" id="p7PMM_2a8"><img src="/images/nav/mission.jpg" width="160" height="25" alt=""></a></li>
      <li class="root_4"><a href="/healthandsafety.php" class="p7PMM_img" id="p7PMM_2a9"><img src="/images/nav/healthandsafety.jpg" width="160" height="25" alt="health and safety policy"></a></li>
      <li class="root_5 pmmlast"><a href="/qualitypolicy.php" class="p7PMM_img pmmlast" id="p7PMM_2a10"><img src="/images/nav/quality.jpg" width="160" height="25" alt="quality policy"></a></li>
    </ul>
<div class="p7pmmclearfloat" id="p7PMM_2d2"> </div>
    <!--[if lte IE 6]>
<style>.p7PMMh10 ul ul li {float:left; clear: both; width: 100%;}.p7PMMh10 {text-align: left;}.p7PMMh10, .p7PMMh10 ul ul a {height: 1%;}</style>
<![endif]-->
    <!--[if IE 5.500]>
<style>.p7PMMh10 {position: relative; z-index: 9999999;}</style>
<![endif]-->
    <!--[if IE 7]>
<style>.p7PMMh10, .p7PMMh10 a{zoom:1;}.p7PMMh10 ul ul li{float:left;clear:both;width:100%;}</style>
<![endif]-->
    <script type="text/javascript">
<!--
P7_PMMop('p7PMM_2',1,2,-5,-5,0,1,0,1,2,3,1,1,0);
//-->
    </script>
  </div>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tbody><tr>
      <td width="161"><img src="/images/aboutmainimage.jpg" width="161" height="250" alt="global reach"></td>
      <td width="639" valign="top"><p></p></td>
    </tr>
  </tbody></table>
  <table width="100%" border="0" cellpadding="0" cellspacing="1">
  <tbody><tr>
    <th width="275">The Team</th>
    <th width="275">Our Technical Partners</th>
    <th>Work With Us</th>
  </tr>
  <tr>
    <td width="275" valign="top" bgcolor="#CDAE84"><p>Mr Sokpiri Graham-Douglas - Managing Director</p>
    <p>Mr Olayinka Coker - General Manager</p></td>
    <td width="275" valign="top" bgcolor="#A4A3CB"><p>Bluefontein Ventures Ltd when necessary  enters in to partnership with some other companies<br>
      For most of its technical jobs. A few  examples are Fadicom International (Electrification/Electrical Engineering)  Hado Construction and Darycet International (Civil Engineering works) </p></td>
    <td valign="top"><p>If you are interested in a career at Bluefontein or would like to partner with us please fill in the form below and we will be in touch to discuss mutual benefits with you.</p>
      <form id="form1" name="form1" method="post" action="">
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tbody><tr>
            <td align="left" valign="top"><label>Name</label></td>
            <td align="left" valign="top"><input type="text" name="txtName" id="txtName" tabindex="1"></td>
          </tr>
          <tr>
            <td align="left" valign="top"><label>Email</label></td>
            <td align="left" valign="top"><input type="text" name="txtEmail" id="txtEmail" tabindex="2"></td>
          </tr>
          <tr>
            <td align="left" valign="top"><label>Enquiry</label></td>
            <td align="left" valign="top"><textarea name="txtMessage" id="txtMessage" cols="25" rows="5" tabindex="3"></textarea></td>
          </tr>
          <tr>
            <td align="left" valign="top"> </td>
            <td align="left" valign="top"><input type="submit" name="Submit" id="Submit" value="Submit" tabindex="4"></td>
          </tr>
        </tbody></table>
      </form>
      <p> </p></td>
  </tr>
</tbody></table>
 
  <table width="100%" border="0" cellpadding="0" cellspacing="0" id="footer">
  <tbody><tr>
    <td bgcolor="#005245">Terms of Use | Privacy Statement | Contact Us | Site Credits</td>
  </tr>
</tbody></table>
</div>
 
 
</body></html>

Open in new window

0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24861746
cokefour,

This recordset depends on data being present in the query string:

$colname_rsSubPages = "1";
if (isset($_GET['subPages_id'])) {
  $colname_rsSubPages = $_GET['subPages_id'];
}
mysql_select_db($database_connBlue, $connBlue);
$query_rsSubPages = sprintf("SELECT * FROM subPages WHERE subPages_id = %s", GetSQLValueString($colname_rsSubPages, "int"));

So when you preview, you need "somepage.php?subPages_id=X" in the url or the database must have a matching value for subPages_id = 1

What you can also try is adding some Show Region behaviors into the page.  Create the following HTML code:

<p>Dreamweaver found data</p>
<p>Dreamweaver did not find data</p>

Highlight the first paragraph and apply "Show Region if Recordset is not empty"  
Highlight the second paragraph and apply "Show Region if Recordset is empty"

Browse to the page again.  If the second paragraph shows up, we know the query is not pulling the data.
0
 
LVL 5

Author Comment

by:cokefour
ID: 24872240
found data shows up but doesn't display anything
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24872309
Can you give me a link to test live?  Also, are you sure your column names are accurate?
0
 
LVL 5

Author Comment

by:cokefour
ID: 24872652
the column names are accurate, is it OK to use underscore etc?
http://www.bluefonteinventures.com/aboutus.php?subPages_id=1
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 250 total points
ID: 24872912
It should be fine to use an underscore in both the column and PHP variable names but that may the issue.   Try renaming the MySQL columns to remove the underscore...
0
 
LVL 5

Author Closing Comment

by:cokefour
ID: 31603671
Don't you just love it when the answer is staring you in the face and it doesn't throw an error. Thanks. It wouldn't work until I'd removed the underscores from all the column headings in the table
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 24873908
Hell, you should have accepted your own post as the answer...you suggested it :)

The weird thing is that we use underscores in MySQL and don't have this problem...what version are you using?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question