Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

MYSQL Data Outputs on Custom Pages

Asked Modified Viewed 4,539 times
B
bbaker24
B
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
asked
Newbie

I am using php to connect to a mysql DB containing my own tables

It seems I am connecting to it through the connection script, as when I modify a username,db, password variable - I get an error message reflecting that.

However, it wont display my data, - just the headers of the html table I specified to display the sql data beneath. I am confused.

Here is a copy of the code:

<html>



<body>
<?php
// Create connection
$con=mysqli_connect("localhost","ZZZZZ_XZX222","######","XXXXX_XXXXXX"wink;



// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}



$result = mysql_query("SELECT 'equipmentid','equipmentname' FROM 'equipment'"wink;
echo "<table border='1'>
<tr>
<th>equipmentid</th>
<th>equipmentname</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['equipmentid'] . "</td>";
echo "<td>" . $row['equipmentname'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</body>
</html>



#################
0 replies

6 posts

N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

<?php
require_once "maincore.php";
require_once THEMES."templates/header.php";

$query = dbquery("SELECT 'equipmentid','equipmentname' FROM 'equipment'");
if (dbrows($query)!=NULL) {
     while ($row=dbarray($query)) {
          echo $row['equipmentid'];
          echo $row['equipmentname'];
     }
}

require_once THEMES."templates/footer.php";
?>
0 replies
B
bbaker24
B
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

Update:

With a little tweaking of the code provided in the above thread I had some progress. I had to copy the tables from my database to the sites core database- but it is displaying data.

I am getting a weird message behind the header that I cant read....



See the top left...weird
Edited by bbaker24 on 07-04-2013 16:28,
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

Hi,

Apologies. Your using a custom page, maincore, header, and footer are not required.

Remove:

require_once "maincore.php";
require_once THEMES."templates/header.php";
require_once THEMES."templates/footer.php";

Alter code to look like:

<?php
$query = dbquery("SELECT equipmentid,equipmentname FROM equipment");
if (dbrows($query) != null) {
    while ($row = dbarray($query)) {
        echo $row['equipmentid'];
        echo $row['equipmentname'];
    }
}
?>
0 replies
B
bbaker24
B
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

YES!

Thanks!

Now I need to teach myself to format the outputs better. Much obliged.
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
answered
Senior Member

I have a series being worked on detailing how to build infusions and such.

Most likely will re-record the current video, but for starters you can check it out.

http://php-fusion.us/infusions/video/video.php?id=5
0 replies
B
bbaker24
B
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

Thanks Ill check it out asap!


I noticed you requested a login, do you want to help us build it? ;)

It is for a class project at WPI, but if it comes out good the state of Mass will implement it. Unfortunately I only have about 10 days left, wasted half the semester on a CMS that couldnt cut it.

Merged on Apr 07 2013 at 22:56:02:
Great video!! I am new to PHP (clearly)

used to write html back in the day.

I may have a few questions over the next week trying to get this done, Ill try not to bug you too much.

if you have linkedin connect with me, I have some more sites to develop over the next year would love to use php fusion.


www.linkedin.com/in/secureideas
Edited by bbaker24 on 07-04-2013 22:56,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

N
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
B
B
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet