Jump to content

madhatter301

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

madhatter301's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yea i never though of that lol Thanks, its pretty obvious that would be a much better way of doing it, cheers.
  2. Well I haven't actually implemented the code yet, I'd just like to know if this database setup is suitable, and if not how best to do it. Its just that i'm no good when it comes to DB design :-\
  3. Thanks for your reply, what i actually meant was do you think its ok to be doing it like this, or is their an easier or better way to do it. Sorry for posting in the wrong place. Thanks
  4. Hi, I have an sql table with various fields in, one of which is "Active" which is an enum 'y' or 'n'. Basically This table holds different events, of which only 1 may be active at one time. So my question is, is their an easier/better way of doing this kind of thing. At the moment I have to check all rows in the table to find which one has active set to 'y', then if i want to change it, set it to 'n' and set the new row i want active to 'y'. Any advice on this would be appreciated. Thanks
  5. You MAY be able to use software such as Xampp. It is an all in one apache server with php mysql etc.... and it can be extracted from ZIP then just run from a local machine without install, so technically I think you would be able to put it onto cd and run from there. Im not 100% sure but it may require you to run a setup.bat file before the service will work, in which case it will not be able to write the config files to the CD meaning you would have to get the customer to copy the entire CD to HD, then run setup, then start the server to browse the site. I know it certainly works from USB pen drives, but thats bcoz the small config script is able to write to them. Anyway have a look, you may be able to work something out. Edit: I just looked on the site and if you make sure the xampp folder is in the root directory of the CD it shouldnt need "setting up". Good luck.
  6. Well thanks anyway m8, you saved me a lot of ??? time i'm sure. Dont suppose you could also advise me on something else? The event table i described above has an "active" column, which is an enum 'y' or 'n'. Basically i only want 1 event active at any given time. So therefore only 1 of the events in the table will have 'y', the rest 'n'. Do you think this is the best way to go about it or is there an easier way? Thanks AGAIN....
  7. Thanks for your reply, I have programmed with other OO languages so thought this would be the best way to go? I see what you mean and I have just changed my code around and got it working thanks Did you mean funtion fetch() { return mysql_fetch_array($this->[b]result[/b]); } Anyway thanks for your swift help I really appreciate it
  8. Hi, I'm trying to do some php but have hit a few problems. I'm new to it all so bear with me ??? Basically I am trying to create a website that takes reservations for different events each year. I have set up my sql tables and am trying to query and insert data into them. I found some helpful tutorials on php classes and so opted for that route to help keep my code tidy. My problem is that I am not sure how to access some of the data once i have retrieved it from my DB. This is what the "event" table I am accessing looks like. Not valid sql i know but just to show you the basic idea. (event_ID VARCHAR(30)) PRIMARY KEY ('event_ID) (event_day1 DATE) (event_day2 DATE) (event_day3 DATE) (event_day4 DATE) My php class to connect to the database looks like this. class dbConnection { var $server; var $db_name; var $data; var $q; var $result; var $connection; var $username; var $password; function dbConnection() { $this->server = "localhost"; $this->db_name = "events_database"; $this->username = "myusername"; $this->password = "mypassword"; } function connect() { if(!$this->connection = mysql_connect($this->server, $this->username, $this->password)) { echo "MYSQL connection problem"; mysql_error(); return false; } mysql_select_db($this->db_name, $this->connection) or die(mysql_error()); } function query() { $this->result = mysql_query($this->q,$this->connection); if(!$this->result || (mysql_numrows($this->result) < 1)) { return 0; } $this->data = mysql_fetch_array($this->result); } } //end class So then i include this php file into my code and use something like: $dbConn = new dbConnection(); $dbConn->connect(); $dbConn->q = "SELECT * FROM event"; $dbConn->query(); What I am not sure about is how to access mutiple rows of the data and exactly how the data is stored. I know i can access by using $dbConn->data but like i say i'm not sure about getting access to all the rows. Any help would be greatly appreciated, Thanks......
×
×
  • 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.