simple php help

maxyes

New Member
Messages
24
Reaction score
0
Points
0
i have this code

Code:
<?php
$con = mysql_connect("localhost","****","****");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("topclans_users", $con);

$result = mysql_query("SELECT * FROM people");

echo "<table border='1'>
<tr>
<th>people</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['count'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>


?>
i come up with this in the end

count "; while($row = mysql_fetch_array($result)) { echo ""; echo "" . $row['count'] . ""; echo ""; } echo ""; mysql_close($con); ?> ?>
im not sure why it does this, is this because it is in a html file?
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
If your file is saved as an html file, then that could be the reason. Resave it with the php extension ".php". I don't see any quotes opened that should be closed in that script, and other than it possibly being saved as an htm(l) file, there's nothing wrong with it as far as i can see.

-xP

[EDIT]
Found one thing right after i posted. you've got an extra ?> at the end, but that wouldn't produce that. And also, Zend Studio does not report any errors for that little snippet.
 
Last edited:

maxyes

New Member
Messages
24
Reaction score
0
Points
0
ok also im realy stuck with how to change it so my starter page is my php page. anyone help?
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
log into cpanel, go to file manager, go to public_html and look for index.html or index.php (whatever the page is called). if it's not a php file, then click once on the name and a box will show up. change the extension to php and click save.
 
Top