Jump to content

Can't See My PHP Scripts :-(


poleman

Recommended Posts

hi there,

I'm teaching myself how to write PHP scripts for inserting and retrieving data from a MySQL database that I'm using with 1&1.

The test script I am using is below but when I host this onto my FTP server all I get is the code itself rather than the result. This is realyl frustrating me as I don't know where I'm going wrong. Hope someone can help me.... (I have replaced my localhost name, username and password with the correct one for my databse as didn't want to write it below for security reasons)


<?php
$conn = mysql_connect("localhostname", "username",
"password");
mysql_select_db("db191523061"$conn);
$sql = SELECT * FROM Events";
$result = mysql_query($sql, $conn) or die(mysql_error());
$number_of_rows = mysql_num-rows($results);
echo "The number of rows is $number_of_rows";
echo $conn;
mysql_close($conn);
?>


According to the book I'm learning from I should see the result - 'The number of rows is 2' in my browser once it has been put onto my webserver but I don't . I just see the written code as above.

Please help!!

Thanks.

Rich
Link to comment
https://forums.phpfreaks.com/topic/34114-cant-see-my-php-scripts/
Share on other sites

Does the file you are running ending with .php? Also does your 1&1 hosting account allow you to use PHP?

If you are learning PHP it is best to install Apache, PHP and MySQL on your computer locally. This saves you from have to upload to your host and you can learn PHP whilst off-line. There is a package you can install called WAMP (Windows Only) or XAMMP (for Macs and Linux).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.