Jump to content

Recommended Posts

Posted

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.

 

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.

 

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!

 

 

Jerad

www.parkwaychurch.com

 

:surrender:

Posted

Hi,

 

I'm not sure what it is you want to do, but let me try an example and see if that helps ...

 

If you had a database with all your visitor information in it, and wanted to display it, the script could be;

 

><?
$username="cpuser_dbname";
$password="password";
$database="cpuser_database";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");

echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";

$i++;
}

?>

Posted

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?

 

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.

 

Thanks!

Posted

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.

 

>echo "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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