poleman Posted January 14, 2007 Share Posted January 14, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/34114-cant-see-my-php-scripts/ Share on other sites More sharing options...
wildteen88 Posted January 14, 2007 Share Posted January 14, 2007 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). Quote Link to comment https://forums.phpfreaks.com/topic/34114-cant-see-my-php-scripts/#findComment-160434 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.