Once I realized that I could not do anything with an Access database here on TCH, I decided to create a new table in MySQL. Well, it seems the table is created, and all of the fields are entered, but I cannot view my table anywhere on my site other than in phpMyadmin. <br /><br />Can anyone tell me how to do this, or if it's even possible? I'm trying to create a database that can be accessed, shared, and edited by certain users for our church's visitor information. I've already set up the users and everything in MySQL.<br /><br />Please help me! This is an emergency after I spent the last two weeks working on the MS Access database, only to find out that it's now useless!<br /><br /><br />Jerad<br />www.parkwaychurch.com<br /><br /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wallbash.gif" style="vertical-align:middle" emoid=":wallbash:" border="0" alt="wallbash.gif" /><!--content-->
Hi,<br /><br />I'm not sure what it is you want to do, but let me try an example and see if that helps ... <br /><br />If you had a database with all your visitor information in it, and wanted to display it, the script could be;<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />$username="cpuser_dbname";<br />$password="password";<br />$database="cpuser_database";<br /><br />mysql_connect(localhost,$username,$password);<br />@mysql_select_db($database) or die( "Unable to select database");<br />$query="SELECT * FROM contacts";<br />$result=mysql_query($query);<br /><br />$num=mysql_numrows($result);<br /><br />mysql_close();<br /><br />echo "<b><center>Database Output</center></b><br><br>";<br /><br />$i=0;<br />while ($i < $num) {<br /><br />$first=mysql_result($result,$i,"first");<br />$last=mysql_result($result,$i,"last");<br />$phone=mysql_result($result,$i,"phone");<br />$mobile=mysql_result($result,$i,"mobile");<br />$fax=mysql_result($result,$i,"fax");<br />$email=mysql_result($result,$i,"email");<br />$web=mysql_result($result,$i,"web");<br /><br />echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";<br /><br />$i++;<br />}<br /><br />?><!--c2--></div><!--ec2--><!--content-->
I recommend picking up the book PHP & MySQL for Dummies. That and search for PHP Tutorials with Google. That's how I got my start.<!--content-->
<a href="http://www.tizag.com/mysqlTutorial/" target="_blank">Tizag has a good tutorial on Mysql</a><!--content-->
Well, I think the database and table are setup correctly, but I want to know how I can get my table to show up as a web page (much like a Data Access Page would). Do I need to write a script for that (and if so, what programs can I use for that, and what type of file should it be, i.e., xml, php, etc.), or are there files that I can just link to once the table has been completed in phpMyadmin?<br /><br />Like I said, this is all very new to me, and I have not done any sort of programming since DOS was popular! You may have already answered my question, but I just wanted to make sure I was clear on where I'm at in the process so that I can make sure I'm being pointed in the right direction.<br /><br />Thanks!<!--content-->
By the way, I do HTML, but I'm not sure if that will help me here or not...<!--content-->
Andy's response will read a database and display all the records to the browser. You can replace this with a table if you would like the output formatted in columns.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";<!--c2--></div><!--ec2--><!--content-->
Hi,<br /><br />I'm not sure what it is you want to do, but let me try an example and see if that helps ... <br /><br />If you had a database with all your visitor information in it, and wanted to display it, the script could be;<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />$username="cpuser_dbname";<br />$password="password";<br />$database="cpuser_database";<br /><br />mysql_connect(localhost,$username,$password);<br />@mysql_select_db($database) or die( "Unable to select database");<br />$query="SELECT * FROM contacts";<br />$result=mysql_query($query);<br /><br />$num=mysql_numrows($result);<br /><br />mysql_close();<br /><br />echo "<b><center>Database Output</center></b><br><br>";<br /><br />$i=0;<br />while ($i < $num) {<br /><br />$first=mysql_result($result,$i,"first");<br />$last=mysql_result($result,$i,"last");<br />$phone=mysql_result($result,$i,"phone");<br />$mobile=mysql_result($result,$i,"mobile");<br />$fax=mysql_result($result,$i,"fax");<br />$email=mysql_result($result,$i,"email");<br />$web=mysql_result($result,$i,"web");<br /><br />echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";<br /><br />$i++;<br />}<br /><br />?><!--c2--></div><!--ec2--><!--content-->
I recommend picking up the book PHP & MySQL for Dummies. That and search for PHP Tutorials with Google. That's how I got my start.<!--content-->
<a href="http://www.tizag.com/mysqlTutorial/" target="_blank">Tizag has a good tutorial on Mysql</a><!--content-->
Well, I think the database and table are setup correctly, but I want to know how I can get my table to show up as a web page (much like a Data Access Page would). Do I need to write a script for that (and if so, what programs can I use for that, and what type of file should it be, i.e., xml, php, etc.), or are there files that I can just link to once the table has been completed in phpMyadmin?<br /><br />Like I said, this is all very new to me, and I have not done any sort of programming since DOS was popular! You may have already answered my question, but I just wanted to make sure I was clear on where I'm at in the process so that I can make sure I'm being pointed in the right direction.<br /><br />Thanks!<!--content-->
By the way, I do HTML, but I'm not sure if that will help me here or not...<!--content-->
Andy's response will read a database and display all the records to the browser. You can replace this with a table if you would like the output formatted in columns.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";<!--c2--></div><!--ec2--><!--content-->