Jump to content

jedeye

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Texas

jedeye's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. make your db vars constants the use this in your DBClass, and do as you were by extending off DBClass with other classes. class DBClass { protected function __construct($dbConnectionNew){ $this->dbConnection = $dbConnectionNew; } function getConnection(){ $db_connection = pg_connect("host=" . self::db_host . " dbname=" . self::db_database . " user=" . self::db_user . " password=" . self::db_pass); return $db_connection; } } then from with-in your other classes you need to call it like this.. class OtherClassName extends DBClassName { private static instance; public function getInstance (){ if (!isset(self::$instance)) { self::$instance = new OtherClassName(parent::getConnection()); } return self::$instance; } }
  2. Try here: http://www.the-art-of-web.com/css/radial-gradients/
  3. no tables since i cant see how it was before here is some base for a horizontal nav ul#menu { float: right; /* or use left */ margin: -65px 0px 0px 0px; /*aligns the menu along the y-axis */ } ul#menu li { display: inline; /* crucial */ margin: 0px auto; padding: 0px; text-align: center; /*optional */ } ul#menu li a { color: #FF6600; display: block; /* crucial - makes the entire block a href */ float: left; margin: 0px 0px 0px 35px; /* use margin here to push and pull links together - prolly you error of trouble last time */ padding: 0px 0px 0px 5px; text-decoration: none; /*optional */ } ul#menu li a:hover, #menu li.current a, #menu li a:focus { /* will take care of all mouse-over states */ border-bottom: 2px solid #FF6600; color: #FFF; }
  4. Good tip, thanks
  5. sorry, you're right that was var_dump() sorry.. prior to everything i was using print_r()
  6. @mj> that was a print_r @wild> OMG.. i feel real dumb, thank you. i was totally trying to over complicate it by trying to slice the array n such I also tried that exact step... however, i put it outside a loop for testing, just to see if it would spit out what i needed... $connectDAO = daoFactory::getModelSpecs(); $model_specs = $connectDAO->getModelSpecs(); $model_specs->spec_name; thanks again..
  7. i have tried many different built in functions from the php manual to no avail... i have a class with a function to return the values from a query in an array...when it returns it returns as a multidimensional array function code: function getModelSpecs() { $array_of_specs = array(); $i = 0; $result = pg_query($this->dbConnection,self::stringGetModelSpecsSQL); while( $rows = pg_fetch_row($result) ){ $specs = new ModelSpecsDTO(); $specs->spec_id = $rows[0]; $specs->spec_name = $rows[1]; $specs->spec_description = $rows[2]; $specs->css_category_name = $rows[3]; $specs->spec_index = $rows[4]; $array_of_specs[$i] = $specs; $i++; } return $array_of_specs; } my return values from "var_dump" array(4) { [0]=> object(ModelSpecsDTO)#2 (5) { ["spec_id"]=> string(1) "1" ["spec_name"]=> string(5) "Width" ["spec_description"]=> string(13) "Product Width" ["css_category_name"]=> NULL ["spec_index"]=> string(1) "0" } [1]=> object(ModelSpecsDTO)#3 (5) { ["spec_id"]=> string(1) "2" ["spec_name"]=> string(6) "Height" ["spec_description"]=> string(14) "Product Height" ["css_category_name"]=> NULL ["spec_index"]=> string(1) "1" } [2]=> object(ModelSpecsDTO)#4 (5) { ["spec_id"]=> string(1) "3" ["spec_name"]=> string(5) "Depth" ["spec_description"]=> string(13) "Product Depth" ["css_category_name"]=> NULL ["spec_index"]=> string(1) "2" } [3]=> object(ModelSpecsDTO)#5 (5) { ["spec_id"]=> string(2) "-1" ["spec_name"]=> string(4) "Misc" ["spec_description"]=> string(13) "LSI Misc Data" ["css_category_name"]=> NULL ["spec_index"]=> string(1) "3" } } The problem is... All i want to is the spec_name value from each array, but having a hell of a time trying to figure out the algorithm to step through the array and pull only that value for each array. Any help is greatly appreciated...
  8. I'm aware of the isset() function and what you just posted is how I have already approched it, but i guess I'm just trying to over complicate my code by not using if, else statements i was thinking something along the lines of: chk_var = $_GET['o']; if ( isset($chk_var) && $chk_var == "1" ( { switch ($chk_var) { case "value1": // set sql statment case "value2": // set sql statement } } else { // no value continue In my head though I think I'm trying to over complicate it, or just not grasping everything that I should. As I am stuck trying to figure out, how put my theory into actions through that switch() statement, and putting that into a sql statement. Actually, how to append those values from the form input into the sql statement due to the amount of sequences that are involved. (ie: var1 & var3, then only placing those in a sql statement, or var3 only then to the sql statement, or var2 and var3 then into a sql statement, or var1& var2 and into a sql statement, etc.)
  9. Back on the original topic... i have 3 of these 'possible' POST vars.. so I would need 3 'hidden' fields in order to check for them? Because var1 could be used, and the other 2 vars not used... then again, there could be var1 and var3 used then not var2. I guess I'm a bit confused on using the switch() func
  10. thanks for you're replies guys... Spider: you're idea is good, but I thought of that Zanus: Excellent, thanks for completing my thought... I was thinking about using a select case switch() statement, but couldn't really come up with a good way of using it. I'll also look into that AJAX part... I have been playing around with a bit of jQuery on the design end, and want to start incorporating it into my scripts. I have a question.. on this script I've been talking about.. Some of the files that would be uploaded are quite large, I know how to setup the php.ini to allow for bigger files, however, instead of just showing a blank browser while the script is running the queries and uploading the data. If I used something similar to "document.ready()" function in an if statement I could show a "Loading.." graphic while those queries are running in the background?
  11. Alright, so I am writing a script for a secretary to do some data entry. With this script there is a few file upload fields, now depending on the item entered not all fields need to be filled out. Therefore, the SQL statement will change depending on whether or not that field was filled out. Should I just use IF statements to check too see if the POST var was sent, then change the statement accordingly, or would there be a more productive way? Thanks for any feedback..
  12. From just looking at what you're typing. To create those 'carrage returns' and 'line feeds' you use "\n\r" your slashes are backwards. Alternatively you can just Google "free contact form" and find a ton of them for free without having to know a bit of PHP.
  13. I'm working with Postgres... and using "pg_escape_string()" instead I put together a function for that.. it's not bulletproof, but there is no such thing anymore. It 'sanitizes' for the most part though function form($data) { $data = preg_replace("[\'\-;|`,<>]", "", $data); $data = pg_escape_string($data); return stripslashes(trim($data)); } I'm not completely 'new' to PHP. I just have not had much practice working with arrays... Thanks again bro for your replies Edit: edited to say thanks one last time
  14. Hello there... I stubbled into this forum and like that the site is active. I have recently been up-rooted from my 'contract' jobs into a corporate environment as a web developer, and hoping to give what advice I can, as well as, get some good info along the way. Definitely a change of pace in a corporate environment, it is "gogogo" for learning. Much better than being out on your own as you are forced to learn new things; instead of trying to 'think' of new stuff to do Peace.
  15. I was in this situation also recently... - Install Linux Distro of your choice (pref Ubuntu) - Install Apache2 - Install mod_php for Apache2 - Install PostgreSQL - Install PG Admin3 (Frontend for Postgres, similar to phpMyAdmin) Then test away on your localmachine. There are several tutorials out there to walk you through those above steps. I like recommend "BlueFish" as and IDE. It has lovely syntax highlighting, recommendations when you start typing pre-defined functions, and its open-source.
×
×
  • 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.