Jump to content

Recommended Posts

I'm not very skilled in working with mysql, but i try :) I would really appreciate anyone willing to help me with this, its not really hard, but i still dont know how to do this....

I have a mysql database I want to print stuff out off - its simply a collection of data - so how would i go about printing this out in a webpage ?

Link to comment
https://testmy.net/ipb/topic/7436-mysql-database-assistance-needed/
Share on other sites

you are going to have to use a dymanic programming language.. like php, jsp, asp...  that will allow you to pull real time from the database and display it on the net.. you might want to check out the help section for website/programming

yeah....im aware of that .... i was trying to use a php serverside script - the script goes something like the following

<?php

header("Content-type: text/xml");

$host = "localhost";

$user = "edited";

$pass = "edited";

$database = "edited";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");

mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT * FROM `formNo1` WHERE 1";

$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version="1.0"?>n";

$xml_output .= "<entries>n";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){

    $row = mysql_fetch_assoc($resultID);

    $xml_output .= "t<entry>n";

    $xml_output .= "tt<date>" . $row['date'] . "</date>n";

        // Escaping illegal characters

        $row['text'] = str_replace("&", "&", $row['text']);

        $row['text'] = str_replace("<", "<", $row['text']);

        $row['text'] = str_replace(">", ">", $row['text']);

        $row['text'] = str_replace(""", """, $row['text']);

    $xml_output .= "tt<text>" . $row['text'] . "</text>n";

    $xml_output .= "t</entry>n";

}

$xml_output .= "</entries>";

echo $xml_output;

?>

just change this section


    $xml_output .= "tt<date>" . $row['date'] . "</date>n";
        // Escaping illegal characters
        $row['text'] = str_replace("&", "&amp;", $row['text']);
        $row['text'] = str_replace("<", "&lt;", $row['text']);
        $row['text'] = str_replace(">", "&gt;", $row['text']);
    $xml_output .= "tt<text>" . $row['text'] . "</text>n";
[/php]

hrm i use this to store / retrieve a Team event list

BTW if you see some code in here thats not standard php its because im using this as a postnuke module

DBINFO


<?PHP
$db_host = 'localhost';
$db_name = 'edit';
$db_user = 'edit';
$db_pass = 'edit';
?>
[/code]

Index

[code]

mysql_connect($db_host,$db_user,$db_pass);

@mysql_select_db($db_name) or die( "Unable to select database");

$query="SELECT * FROM events";

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...