Jump to content

ram4nd

Members
  • Posts

    461
  • Joined

  • Last visited

Everything posted by ram4nd

  1. even if there are not then you can make 1 yourself
  2. or use iframes
  3. To display into input text box as pre-filled. You just have to put your sting in value attribute. <INPUT type="textbox" value="This will be displayd">
  4. use '' instead of "";
  5. There is something wrong with this: $q = "SELECT * FROM `tests`";
  6. or you could pass on data with POST method, tere are hidden fields you know.
  7. What are you planning to do, i am sure that there is easyer way to do that.
  8. Well if the header is activted then it redirects you to login.php, so you have to put the code there.
  9. Yes. But use tinyint to hold the value. Checked is 1, unchecked is 0 or something. I thing there is no true/false type columns in mysql.
  10. Shows couple of errors, I think if I copye my sql code to here than that's enought. function doQueryA($query) { $this->doConnect(); $result = mysql_fetch_assoc(mysql_query($query, $this->connect)); $this->doDisconnect(); return $result; }
  11. I need to get some rows from mysql table. I have 2 tables: categories and subcategories. I need to get categorie and subcategories what are linked with that catagorie. I have table where are: subcategorie name and categorie_id. I wonder how can I get all those subcategories. When i tryed i got only the first subcategorie name. This code takes categore names and prints them all. $mysql = new mysql(); $num_rows1 = $mysql->doQueryC('SELECT * FROM category'); for($i = 0; $i <= $num_rows1; $i++) { $cat = $mysql->doQueryA('SELECT name FROM category WHERE id = ' . $i); echo $cat['name'] . '<br>'; }
  12. Umm, ok it is not associated. It takes data sepperately from sql tables. Like in the post what i did before this.
  13. Umm, what do you mean by table setup? Sql table setup?: category - id name subcategory- id name category_id
  14. Ok yes, that is right. If I want to put subcategories into categories then i have to do?: array_merge($categories, $subcategories)
  15. I would like to create a multidimensional array. Whith 2 existing arrays. Just put them together in 1 array. Theese are my arrays: $results1 = $mysql->doQueryA("SELECT name FROM category_id"); $results2 = $mysql->doQueryA("SELECT name FROM subcategory_id");
  16. ram4nd

    Classes

    All i had to do was to change my sql class code function like this: function doQuery($query) { $this->doConnect(); $result = mysql_fetch_row(mysql_query($query, $this->connect)); return $result[0]; } I am useing PHP 5. Ok basically I need a good link from wher i could learn about php classes. Because just when I thought that I am getting that classes thing then this showed up.
  17. ram4nd

    Classes

    Well then do a little class and test it, you wont belive your eyes.
  18. ram4nd

    Classes

    Ok I added it, still nothing. There is 1 value in my db. Maybe the query is wrong?. I also repared my conection class: <?php class mysql { var $db_host, $db_name, $db_user, $db_password, $connect, $select, $query, $result; function doConnect() { require_once('../database_settings.php'); $this->connect = mysql_connect($this->db_host, $this->db_user, $this->db_password); $this->select = mysql_select_db($database_name, $this->connect); if($this->connect) return true; else return false; } function doQuery($query) { $this->doConnect(); $this->result = mysql_query($query); return $this->result; } function doDisconnect() { mysql_close($this->connect); } } ?> But that is not the reason why it doesn't work, 9three.
  19. ram4nd

    Classes

    Hmm, I am not getting it to work: <?php require_once('mysql_class.php'); class box { var $link_id; function name($link_id) { if(is_numeric($link_id)) { $mysql = new mysql(); $query = 'SELECT name FROM links WHERE id = ' + $link_id; $return = $mysql->doQuery($query); echo $return; } } } $box = new box($mysql); echo $box->name(1); ?>
  20. ram4nd

    Classes

    Do I need to make var $mysql, in the beginning of the "otherClass" class?
  21. ram4nd

    Classes

    require_once('../database_settings.php') This code is in that: <?php $this->db_host = "localhost"; $this->db_name = "****"; $this->db_user = "****"; $this->db_password = "*******"; ?> But still how can I use my sql connection class in some other class. Is there something to do with parent and child classes?
  22. ram4nd

    Classes

    How can I use 1 mysql connection class in other class? Sql connection class: <?php class mysql { var $db_host, $db_name, $db_user, $db_password, $connect, $select, $query; function doConnect() { require_once('../database_settings.php'); $this->connect = mysql_connect($this->db_host, $this->db_user, $this->db_password); $this->select = mysql_select_db($database_name,$connection); if($this->connect) return true; else return false; } function doQuery($query) { $this->doConnect(); if(mysql_query($query, $this->connect)) { $this->disconnect(); return true; } else { $this->disconnect(); return false; } } function doDisconnect() { mysql_close($this->connection); } } ?>
  23. I need to make rating, at 5 point system, and hold data in msql table. Is it better to make 1 column for rating and use substr to seperate the numbers or to make seperate coumns, 1 or eatch.
  24. ram4nd

    include

    Ok, thank you.
  25. ram4nd

    include

    If I have 3 folders system, control and view. Control and view folders are in system folder. How can I include stuff from control folder to view folder?
×
×
  • 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.