Jump to content

musicman07

Members
  • Posts

    3
  • Joined

  • Last visited

musicman07's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks for the link. New to PHP yes. I have done SQL before but the setting up users was not something we could practise (this being in Oracle).
  2. Cheers Wizard. No I don't think I did any of that. Where does it tell you how to do this in Heliohost? I assume the mysql_query commands are creating a database somewhere on the server. How to I assign user privileges?
  3. I am new to Heliohost as I am learning PHP and MYSQL. I con't quite see how to set up a database using MYSQL. I entered the following code which worked in WAMP Server but not my Heliohost site (html code was an afterthought). <html> <body bgcolor = "#0000f>" <font color = #fffff"> <?php require("connect.php"); mysql_query("CREATE TABLE `phpacademy`.`people` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `firstname` VARCHAR( 25 ) NOT NULL , `lastname` VARCHAR( 30 ) NOT NULL , `dob` DATE NOT NULL , `gender` VARCHAR( 1 ) NOT NULL )"); mysql_query("INSERT INTO `phpacademy`.`people` (`id`, `firstname`, `lastname`, `dob`, `gender`) VALUES (NULL, 'John', 'Headen', '1989-07-12', 'M'), (NULL, 'Emily', 'Headen', '1988-09-12', 'F')"); $extract = mysql_query("SELECT * FROM people ORDER BY id ASC"); $numrows = mysql_num_rows($extract); echo "<br>"; while ($row = mysql_fetch_assoc($extract)) { $id = $row['id']; $firstname = $row['firstname']; $lastname = $row['lastname']; $dob = $row['dob']; $gender = $row['gender']; echo ("<br>$firstname $lastname was born in $dob"); } ?> <br><br>What we see here is a basic example of editing a PHP site using Mysql to retrieve info from the database. </body> </html> It is not working on Heliohost though. The Connect part works and the echo statements are working fine, but clearly the data is not being saved and retrieved. I am puting everything in public_html and uploading with CoffeeCup Direct FTP.
×
×
  • Create New...