disturbed Posted September 3, 2005 CID Share Posted September 3, 2005 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 ? Quote Link to comment Share on other sites More sharing options...
jay173 Posted September 3, 2005 CID Share Posted September 3, 2005 export it to text and print it Quote Link to comment Share on other sites More sharing options...
Swimmer Posted September 4, 2005 CID Share Posted September 4, 2005 do you mean make a physical copy or place the data into a webpage? Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 4, 2005 Author CID Share Posted September 4, 2005 just place data into a webpage Quote Link to comment Share on other sites More sharing options...
Swimmer Posted September 4, 2005 CID Share Posted September 4, 2005 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 Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 4, 2005 Author CID Share Posted September 4, 2005 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; ?> Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 4, 2005 Author CID Share Posted September 4, 2005 In theory this should work .... shouldnt it ? - but no, all it does is just display a blank white page... Quote Link to comment Share on other sites More sharing options...
php Posted September 5, 2005 CID Share Posted September 5, 2005 just change this section $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']); $xml_output .= "tt<text>" . $row['text'] . "</text>n"; [/php] Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 5, 2005 Author CID Share Posted September 5, 2005 ill give it a try right now Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 5, 2005 Author CID Share Posted September 5, 2005 no....doesn't seem to be working Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 5, 2005 Author CID Share Posted September 5, 2005 any idea ? Quote Link to comment Share on other sites More sharing options...
Swimmer Posted September 5, 2005 CID Share Posted September 5, 2005 I dont know php i only jsp.. and that isnt very useful.. Quote Link to comment Share on other sites More sharing options...
php Posted September 5, 2005 CID Share Posted September 5, 2005 It worked on my server... could you paste the script you're using again? also, you do have entries in the database, right? Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 5, 2005 Author CID Share Posted September 5, 2005 well after playing with it....i have gotten it to work to some extent - although now im having troubles organizing everything in tables ...... well, at least i have gotten past the mysql problems Quote Link to comment Share on other sites More sharing options...
php Posted September 5, 2005 CID Share Posted September 5, 2005 you must be doing something different than I did... it's quite simple (or so I thought) Quote Link to comment Share on other sites More sharing options...
disturbed Posted September 6, 2005 Author CID Share Posted September 6, 2005 what kind of tags does php take ? im having troubles organizing the data ? Quote Link to comment Share on other sites More sharing options...
php Posted September 6, 2005 CID Share Posted September 6, 2005 maybe it's just that I'm tired, but I don't quite understand... are you having problems storing or retrieving the data? also... what this is being used for might help (if you don't mind mentioning) Quote Link to comment Share on other sites More sharing options...
TriRan Posted September 6, 2005 CID Share Posted September 6, 2005 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(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.