PDA

View Full Version : MySQL Database


Danny
October 26th, 2007, 16:03
Hi All,

I am trying to transfer an already coded database from one site:

http://www.mmia.org.uk/companydb/index.php?id=16

onto its redesigned site here:

http://mmia.org.uk/prototype/members/members.php

The code to select which of the db entries to view is:

<a href="members.php?id=46"> Where the id="x" is the entry no.

Then the members.php page should display the entry using this code:

<?php
include 'dbconnect.php';
$id = is_numeric($_GET['id'])?$_GET['id']:1;
$get = mysql_query("SELECT * FROM coname where ID = $id") or die("Mmm pie:" . mysql_error());
while ($row = mysql_fetch_row($get)) {

echo "<img style=\"float: left; padding: 2px;\" src=".$row[1]."><br><br><br><br>";
echo "<br><h2>".$row[2]."</h2><br>";
echo "<strong>Address: </strong><br>".$row[3]."";
echo "<br>".$row[4]."";
echo "<br>".$row[5]."";
echo "<br><br><strong>Postcode:<br></strong> ".$row[6]."";
echo "<br><br><strong>Phone Number:<br></strong>".$row[7]."";
echo "<br><br><strong>Email Address:</strong><br><a href='mailto:".$row[8]."'>".$row[8]."</a>";
echo "<br><br><a href=".$row[9].">".$row[9]."</a>";
echo "<br><br><strong>Contact</strong><br>".$row[11]."";
}
?>

But it doesnt?

The database works on the current site - and its all on the same server etc.

Any Ideas?

Danny

kirxklox
October 27th, 2007, 03:59
Have you set the permissions properly?

inimino
October 27th, 2007, 04:59
"But it doesn't" isn't much to go on... what exactly happens?
Is there an error message?
Have you checked the HTTP server error log?
What are the contents of the dbconnect.php file?

Danny
October 27th, 2007, 13:38
"But it doesn't" isn't much to go on... what exactly happens?

The PHP page just outputs code:

"; echo "
".$row[2]."

"; echo "Address:
".$row[3].""; echo "
".$row[4].""; echo "
".$row[5].""; echo "

Postcode:
".$row[6].""; echo "

Phone Number:
".$row[7].""; echo "

Email Address:
".$row[8].""; echo "

".$row[9].""; echo "

Contact
".$row[11].""; }

--

Have you set the permissions properly?

Which files need to be CHMOD'd?

Danny

inimino
October 27th, 2007, 20:37
You also have <? session_start() ?> at the top of your output. The problem isn't with your PHP, it's that your PHP is being sent to the client rather than interpreted by the server. You'll need to take a close look at your HTTP server configuration and see what might be different between the two directories on your server.

You shouldn't start changing the permissions on any files, as that's not likely to be the problem.

Danny
October 28th, 2007, 13:50
Inimino, I will check the directories now thanks!

Danny
October 28th, 2007, 20:47
Hi Again,

Finally got it working - it appears to have been a coding error on my part...as per usual :(

Thanks for your help!

kirxklox
October 29th, 2007, 06:31
inimino: Am I right that the permissions on this would be a standard 644?

inimino
October 29th, 2007, 07:00
Yes, quite right, Sam.

There are exceptions, of course, in exotic setups like suexec, but those are quite rare.

kirxklox
October 29th, 2007, 07:49
Maybe, but I am seeing quite a bit of Changed Permissions in PHP programs.