Forum Moderators: coopster

Message Too Old, No Replies

Can anyone help me?

         

coolguythampy

2:59 pm on Nov 20, 2008 (gmt 0)

10+ Year Member



I need a scroll box on my website which scrolls the latest news i put to the database. How is it possible. I am not at all familiar with any scripting language. Please help

andrewsmd

4:49 pm on Nov 20, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Need more information. Do you have a PHP server set up. Do you have a MySql server and database set up. Let's start there.

coolguythampy

11:27 am on Nov 21, 2008 (gmt 0)

10+ Year Member



I have hosting with a web host which provides me with php and my sql databses. I no how to set up a database. using cpanel. I have an html page(Xhtml using dreamweaver).

andrewsmd

2:50 pm on Nov 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I will do what I can but a fair warning, when you develope stuff in a code generator like dreamweaver you tend to end up with a lot of extra code and it makes your page hard to edit. The first thing you need to do is set up a test page (I usually name them test.php) make sure it has the PHP extension so the server knows how to parse it. Next, take a look at the PHP mysql functions to connect and get data with mysql via php. Run a test just to see if you can echo the data from your table. I would ask your server admin if they have pear installed and if they have the DB.php class. If they do I can give you exact code on how tor retrieve your data. PHP has built in mysql functions but I have found they are rather difficult to work with for new users. Here is the mysql syntax that is does not rely on the DB.php
<?php
//you need to change these
//to your username and login stuff
$username = "your username";
$password = "your password";

//usually localhost
$hostname = "your database host";

//this will print Unable to connect to mysql
//if you do something wrong or it cannot
//connect
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";

mysql_close($dbh);

?>
If that works let me know and we can go from there.