Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. You really need to do some reading to learn a little bit about php and html processing. Your code shows that you have no clue. Your code shows you placing some values into some session vars. Can I ask you where those values are coming from? Do you know? To us, looking at your script sample, those are undefined values. If you php error checking turned on you would be seeing error messages.
  2. Why are we even debating this? The OP has to get used to a new environment. Let's let him get used to it instead of finding fault with every nuance that is 'nu' to him.
  3. Move those vars you have made to $_SESSION and then they will be available to your next script, if you start it there.
  4. I'm gonna guess that your provider gave you a uid/pswd to access the administration function of your site - cPanel perhaps? That gives you access to the phpadmin tool where you create dbs and tables in your dbs. Each db that you create has to have a userid and pswd created for it since in the long run not all users are going to have access to all your tables in all your dbs (in most situations). Be sure that you have done that before trying to connect. You may have missed that step when creating the db. I use just one set so that all of my connections use the same ones and I only have to create one standard module to do the connecting in any of my scripts. PS - Keep that uid/pswd that logs you into cpanel/phpadmin extremely private. It should not be used anywhere else (meaning don't use the same creds again for a db or an email account).. Period. It is the single most important of data you have that controls your entire site.
  5. Know first that FPDF, while great, still requires work to generate the pdf document. I have read (in posts) of other tools that can take an html page and create a pdf (sorry - you'll have to research them yourself) but I don't know how 'neat' those docs will look. Personally I love FPDF - gives me pretty much total control over my output and with a little experience has become a very handy utility for my apps.
  6. I find it most useful when I want to remove a session variable. Obviously php won't clean those up and at times some of them need to be deleted.
  7. You really don't want to spend time making this one-at-a-time query. Very resource intensive which you don't want to do. I appreciate that you want to have a class, but why not write the query outside of the class and pass the string var containing it? For the arguments you have it right - create an array and pass it to the function doing the execute or the prepare.
  8. We could help you jump off a bridge as well. Would you like that? Your ideas are completely mal-formed and your intent is only going to reap havoc for you. No - we won't help you do that to yourself. You are committing technical suicide.
  9. It's been explained twice to you. If your entire question is simply curiosity about the option, then you won't get anymore here. And if your concern is about the accuracy of the manual, well then, you are going to have a field day with other functions. Signing off - too boring.
  10. I took the liberty of cleaning up your code. I firmly believe that using long var names and mixed cases is the problem with many coding errors. Hence this: <?php error_reporting(E_ALL | E_NOTICE); // Kinds of errors to show ini_set('display_errors', '1'); // turn on display at the client to display the messages $con = mysql_connect($host,"marcomdata",$password); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db("marcomdata", $con)) die("Could not select db: " . mysql_error(); $sql = "SELECT year FROM car_make GROUP BY year ORDER BY year DESC "; echo $sql . '<br />'; // run the query and check if it succeeds $qresults = mysql_query($sql); if (!$qresults) die("Query failed - ".mysql_error(); // begin building select tag // NOTE - I removed semis from your function calls $year_html = '<select id="year" name="year" onchange="do_Auto(this.name,this.value)" onfocus="clear_state(this.name)" onblur="saveData(this.name,this.value)">'; $cur_car_year=""; // This line is given a value in another place. if($cur_car_year=='') { $year_html.='<option></option>'; } // loop thru query results and build options while ($row = mysql_fetch_array($qresults)) { if ($row['year'] == $cur_car_year) { $year_html .= '<option selected>'.$row['year'].'</option>'; } else { $year_html .= '<option>'.$row['year'].'</option>'; } } $year_html .= '</select>'; mysql_close($con); echo $year_html; ?> Note the altered names. I do not see anything here that would cause your sql connection to time out. However I do see a problem with your options since none of them have a value so how are you going to analyze what the user clicks on? I also added an error check DIRECTLY after your db select and query calls. One must do this kind of thing all the time.
  11. Sorry . Don't know what you really want. Try again? Perhaps you need to create array to hold your 'value' possibilities as keys and a sub-array with the desc and cost and then in your php you take the phone[] element and grab it out of the array to get your info.?
  12. Where does it return false? I don't see how you handle the 'false' condition of that if (which I missed before). You're not sure if error checking is on? Can you check that and make sure you are getting all Notices and All errors?
  13. I say this over and over again - Turn On PHP Error Checking. Also - what do you mean by 'it returns false'? What line is that coming from? Try testing your query result to see if it failed or not.
  14. Throw in some echos of your mail variables to be sure that a) you are getting to that line and b) that the vars have the proper content/format
  15. Same for the 't' mode. I think it is because there are so many caveats mentioned in the comments that one needs to be "more" aware of how and why to use both 'b' and 't' mode.
  16. Is your question concerning how to do this or how to use a certain font?
  17. David - I wasn't suggesting that the initial checkboxes be created from POST data. As I showed - they are created manually. They could be created via a query that pulls down 'value' items and 'literal' skill names to be used in the html, but I left that to the OP's imagination and skill level
  18. Checkboxes work by assigning ALL of them the same 'name=' attribute. Your html for a checkbox would look like: <input type='checkbox' name='skills[]' value='1'><label> Skill 1</label> <input type='checkbox' name='skills[]' value='2'><label> Skill 2</label> Create as many of these as you need with each having a unique value attribute and label. Then in your php code you will create a loop to go thru the returned $_POST elements that will be in the 'name' index in an array. $invalid_skill = false; $have_skills=false; foreach ($_POST['skill'] as $skill) { if (!in_array($skill,array(1,2,3,4,5))) { $invalid_skill=true; } else { $have_skills = true; } } if (!$invalid_skill) { $err_msg = "You have an invalid skill";// user hacked the form and produced something wrong } if (!$have_skills) { $err_msg = "You must provide a skill"; } Of course you can use the literal value of the skills in the value clauses instead of a number, but I think this gives you something to work with. Hope to see your code attempt soon!
  19. If you want to produce an output of unknown layers such as you described, recursion is the only way to handle it that I know of. I don't think you can build a query to produce a complete set of data where you have an unknown number of generations to map.
  20. Would be a good place to write a recursive function. Read up on them for some examples. Be sure to rely on local vars passed as arguments to the function and also have a bit of logic to handle the amount of spaces (?) you want to use to indent each lower nest of results or to un-indent once done with a nest/level PS - be sure to set your execution time in your php.ini file to something very very small while developing this. I'd suggest one second..
  21. I always specify absolute paths for things that I know are not going to move. That way they are always 'found'. I don't see it as a problem. In my std. startup logic I always set a couple of vars to be used for this purpose. This logic is included in my scripts, so should I EVER NEED to modify my paths, it's a simple change. If your task is going to reference files that are expected in some odd folder name or under some folder name, simply specify the absolute path to that folder or parent and work from there. One doesn't HAVE to rely on php's search methodology to find things....
×
×
  • 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.