Help: Simple (yeh, right) application script... - 01/14/04 12:16 AM
Well, after scouring the internet for a whole of 30 minutes, I decided that nothing out there was exactly what i needed. So I snagged a few tut's and began working...
I fixed up the db i need through phpmyadmin (god bless the gui on that [censored])... See code below:
Upon creating the forum to list data (I made a result first) all i get is "Error on line 20"... Anyone care to take a look?:
The section that seems to be giving me the error is:
Do we finally have any knowlegable php/mysql guys here, or do I need to just go shoot myself in the foot?
I fixed up the db i need through phpmyadmin (god bless the gui on that [censored])... See code below:
Code
CREATE TABLE `ugn_applications` ( `id` int(11) NOT NULL auto_increment, `name` varchar(20) NOT NULL default '', `nick` varchar(20) NOT NULL default '', `email` varchar(50) NOT NULL default '', `yob` varchar(4) NOT NULL default '', `telephone` varchar(20) NOT NULL default '', `address` varchar(100) NOT NULL default '', `sections` varchar(100) NOT NULL default '', `aim` varchar(20) NOT NULL default '', `irc` varchar(20) NOT NULL default '', `bbs` varchar(20) NOT NULL default '', `moderate` varchar(10) NOT NULL default '', `admin` varchar(10) NOT NULL default '', `news` varchar(10) NOT NULL default '', `other` varchar(10) NOT NULL default '', `username` varchar(20) NOT NULL default '', `password` varchar(20) NOT NULL default '', `comments` varchar(255) NOT NULL default '', `country` varchar(20) NOT NULL default '', `ip` varchar(15) NOT NULL default '', `status` varchar(20) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ;
Code
<?php // Change below to your MySQL Host. $host = "127.0.0.1"; // change below is your assigned mySQL username $user = "[username]"; // change to the pw below is your assigned mySQL password $pw = "[password]"; // change to the database you have permission to connect to $db = "[databasename]"; $mysql_access = mysql_connect("$host", $user, $pw); ?> <?php $query = "SELECT * FROM ugn_applications"; $result = mysql_query($query, $mysql_access); if(mysql_num_rows($result)) { // it is true, so let's print the results to the browser while($row = mysql_fetch_row($result)) { print("$row[0] "); } } else { // false, no results } ?> <? mysql_close($mysql_access); ?>
Code
if(mysql_num_rows($result)) { // it is true, so let's print the results to the browser while($row = mysql_fetch_row($result)) { print("$row[0] "); } } else { // false, no results }