Jump to content

jhc1982

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jhc1982's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks man. That makes perfect sense and I will go ahead with that structure. This is a great forum and helping out loads in my early php/mysql day so i'll be sure to contribute once I am more up to speed! Thanks again
  2. Define 'very long'? MySQL can cope perfectly fine with millions of rows, provided you index it correctly. There's no need to make querying and maintaining the tables more complex than it needs to be. Also you loose out on being able to produce and stats or reports over multiple users. Not millions and millions or rows for sure! Would you be happy with the structure I suggested in that case? Thanks for the help!
  3. Hi Guys, I thought I would get some advice on the best DB structure for my first php project and would love to hear your thoughts. The web app is very basic. Essentially I am providing a members only website where people can keep track of money owed to them. A good example would be a freelancer who wants to keep track off all money owed to them by various clients. I want to have predefined categories for people to choose from. ie, employer, friend, tax rebate, rent on investment properties etc but also have the ability for people to add their own categories. The app will essentially display to users how much is owed to them in each category along with line items. An example of this could be: Employers (2 outstanding debts): $2400 for web project | ABC Inc $1000 for recruitment services | 123 Inc Friends (1 outstanding debt) $20 for the bus! | Jonny Mayo My thought was that I just need a members table with standard, ID, email, Password, City, Country, Registered Date. A category table with CatID, CategoryName. And then I get confused as to whether I should have a table for each users debtor list or just one (potentially very long) combined debtors list from all users. My thought is that it is best to have a table per user. Am I missing anything major here? Any thoughts on improved structure? Thanks
  4. Thanks guys, It is a bit frustrating! This is the second time that copying the book word for word (including typos) has let me down. Next time I think I will take the concept and this about how to put it together myself. Thanks again! Jamie
  5. Hi Guys, I keep getting the following error: Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/pet/petCatalog1.php on line 51 I have copied the code from a tutorial and cannot for the life of me work out what the problem is with line 51???? I have attached the file and pasted the code below. The real problem line is: echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n" The full code is attached - btw, inserting the ">" does not help to fix it!! <?php /* Programme: PetCatalog.php * Desc: Lists all pet categories with radio buttons */ ?> <html> <head> <title>Select a Pet Category</title> </head> <body> <?php /* Database login info - Move to an Include */ $host="localhost"; $user="root"; $passwd=""; $dbname="information_schema"; /* Establishes a connection with the databse */ $cxn = mysqli_connect ($host, $user, $passwd, $dbname) or die ("Could not connect to the database JAMIE!"); /* SQL Query to select all categories of pet from the petType column in the pet table */ $query = "SELECT * FROM PetCatalog.petType ORDER BY petType"; $result = mysqli_query($cxn,$query) or die ("Unable to connect to the database JAMIE"); /* Echo of H1 & H2 above the pet table */ echo "<div style='margin-left: .lin'>\n <h1 style='text-align: center'>Pet Catalogue</h1>\n <h2 style='text-align: center'>The following categories of pets are now available</h2>\n"; /* Create form to diplay pet categories */ echo "<form action='ShowPets.php' method='POST'>\n"; echo "<table cellpadding='5' border='1'>"; $counter=1; while ($row = mysqli_fetch_assoc($result)) { extract ($row) echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n" echo "<input type='radio' name='interest' value='$petType'\n"; if( $counter == 1 ) { echo "checked='checked'"; } echo ">$petType</td>"; echo "<td>$typeDescription</td></tr>"; $counter++; } echo "</table>"; echo "<p>input type='submit' value='Select Pet Type'> </form></p>\n"; ?> </body> </html> [attachment deleted by admin]
  6. Hey guys, I am working through PHP & MySQL for dummies. I have gotten to the application build tutorials at the end of the book and I cannot get my tables to build with an SQL Query from phpMyAdmin. i am trying to create a table called pet with 6 columns, petID, petName, petType, petDescription, price & pix. I am using the following syntax CREATE TABLE Pet( petID INT(5) SERIAL, petName VARCHAR(25) NOT NULL, petType VARCHAR(15) NOT NULL DEFAULT "Misc", petDesc VARCHAR(255), price DECIMAL(9,2), pix CHAR(15) NOT NULL DEFAULT "nopic.jpg", PRIMARY KEY (petID) ); Can anyone spot anything that I may be doing wrong? I really just cannot spot it?? I am using MySQL client version: 5.1.44 which I installed with XAMPP
  7. Thanks loads thorpe! I went a bit crazy on the old ; I can't believe I missed that. Really appreciate your help!
  8. Hi Thorpe, This is the code as copied from the book in an html page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $capitals = array ("CA" => "Sacramento", "TX" => "Austin", "OR" => "Salem" ); ksort ($capitals); foreach ($capitals as $state => $city); { echo "$city, $state<br />"; } ?> </body> </html> I now just get: Austin, TX I have a feeling I may have really missed the thread!
  9. Thanks for the quick reply thorpe. I tried this and it didn't work. Could I have maybe installed XAMPP incorrectly? I just followed its install instructions.
  10. Hi everyone, I am just starting out with php so I am sure this is a really silly question. I have been working through php & mySQL for dummies (latest edition) and each time I read a new chapter I try to implement the tutorial. I have been trying something really simple from the book and have now even tried copying it word for word but it still will not work. I am basically trying to output a list of Cities and States with the following code: <?php $capitals = array ("CA" => "Sacramento", "TX" => "Austin", "OR" => "Salem" ); foreach ($capitals as $state => $city); ksort ($capitals); { echo "$city, $state<br />"; } ?> Instead of getting: Sacramento, CA Salem, OR Austin, TX I just get: Salem, OR I am running XAMPP on Mac OS X 10.6.5. Any ideas or help would be awesome!
×
×
  • 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.