Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. You ask what to do with "non-included" scripts. Well - if they are not being used as includes then it sounds like they are what I called major scripts, meaning that they start a process. So - yes, do a session start. A notice is a notice. As I also said - if you see a notice, fix that script.
  2. You are using an array for your inputs. Why? Why not simple variable names for each input field. You say that you want to search for the name of a game. Is that stored in a field called "id"? Seems more like it belongs in your "game" field. Plus - you should enclose that in quotes since it is a string value. And you may need braces around the variable name as well.
  3. Continuing off-topic here: I copied your code Barand and came up with a much better looking table BUT it still doesn't cut/paste into anything that maintains the format. Is there a way to copy the output into a post on the forum?
  4. Do you REALLY expect us to read that code???? Try formatting it then post it here using the <> icon for posting code. And perhaps explaining better what you are trying to do? Sounds like you want to produce a series of values based on a starting one and a number repetitions you need but that's only a guess on my part.
  5. I"m sorry. I wrote the code and tested it out and it worked great. Only after I posted it did I realize that I could not "copy" it to anywhere where the visual structure remained the same. So perhaps someone smarter than me knows how to take a web page image of this output and insert it somehow into a post (perhaps) without losing the proper formatting.
  6. FWIW - how about this for a function that will give you an html table of the structure? //**************************** $table_desc = Dump_Table_to_HTML('albany_data', '25_man_pool_players', $errmsg); if ($table_desc === false) { echo "Could not dump table - message is: $errmsg"; exit(); } echo "<div style='max-width:80%;margin-left:2%;'>"; echo "$table_desc<br>"; echo "</div>"; exit(); //**************************** function Dump_Table_to_HTML($db, $tblname, &$rtn_msg) { // check that the call is valid if ($db == '' || $tblname == '') { $rtn_msg = "Missing dbname or table name"; return false; } // make a db connection $pdo = PDOCOnnect($db); // your function to make a db connection // List the the field names and types for the specified table $q = "DESCRIBE $tblname"; $tbl_desc = $pdo->query($q); // Get all the rows from the query $cols = $tbl_desc->fetchall(); // initialize the var to hold the returned data $output = "Description of table: $tblname<br><br>"; $output .= "<table border=1 style='border-collapse:collapse;'>"; // add a bit of css to the html table cells $cell_style = "style = 'padding:2px 4px;'"; // get the first row of the query results $col =$cols[0]; // start the headings row of the html table output $output .= '<tr>'; // now loop thru this first query result row // to get the table headings foreach($col as $heading=>$value) $output .= "<th $cell_style>$heading</th>"; // done with the headings $output .= '</tr>'; // Now loop thru all the query result rows just to get the values foreach ($cols as $col) { // start a data row $output .= '<tr>'; // output all of the values for this row foreach($col as $heading=>$value) $output .= "<td $cell_style>$value</td>"; // end this row $output .= '</tr>'; } // end the html table $output .= '</table>'; $output .= '<br>End of Structure'; // send the generated html table back to caller. return $output; } I tested it out with my own db and table so I know it works. It may give you a tool for future use.
  7. As a newbie you need to learn to focus your post on the parts that are giving you the problem. Posting a hundred lines of html code is not going to get the attention you need on the PHP code that is the source of your problem. Limit your posts to the parts you want us to help you with and since this is a PHP forum, all that extraneous html code is a lot of code to wade thru.
  8. Change ." ".(& to .' '.(& and why do you wrap things in parens? $page_number++; echo " <a href='?page=$page_number&country=$cleaned_current_page_country'>Next </a>"; Note that I incremented the page num before the href
  9. Can you use the <> code icon to open up a window and then do a copy and paste from your editor into that code window so that we can see the real code you are running? Not all of it - just the part you are questioning.
  10. This really is a question for a CSS forum, don't you think?
  11. PS - A better way to dump your arrays would be to do this: echo "POST is: <pre>" . print_r($_POST,true) . "</pre>";
  12. Your form processing logic is flawed. The data proves it. You have 4 ids incoming but only one quantity. Your logic does an update with the first pair of id/qty. Then the remaining ids are processed but the qty < 1 so a delete is what you are asking for. You should be checking the two input arrays and ensure that each key of your first array has a non-empty value in the second array. That's called good programming practice.
  13. I don't like either of your queries. Do you know that they run without error?
  14. Ok - so you use that info to follow the rest of your php code and see what it does with the input. Echo out any query statement that you build and try to execute. Check the results of your query. What exactly is happening. You say you have a problem but what is it?
  15. What have you done to debug this? Any echos? Any dumps of the vars in use during the query processing? Anything? The html is of no use to us if you simply dump the $_POST array to begin with.
  16. Have you tried adding some tracing to that code to see what it is doing, shows you values of things, etc? And who uses js script tags in the middle of their php logic?
  17. You should be able to do that with your current hosting plan if one is made a sub-domain of the primary. That's what I am doing. Works great. If they support sub-domains.
  18. Do an edit of the input from the search box and if there is nothing there, return the same page with an error message.
  19. Who are you using as a hoster? The ones that I reviewed prior to making my selection many years ago all offered sub-domains which is pretty much what you can do I believe. I have two function domains that may call each other but I never do it. They are distinct things and don't need to share anything.
  20. So - did you learn how to output html and php vars a little better?
  21. If your input is a valid time string (or if not) there are plenty of date-related functions and formatting types that make your 'problem' a no-brainer. RTM!
  22. My host offers mutliple domains for no extra cost. I pay a domain registration fee each year to have another name and I then assign that as a sub-domain under my original hosted domain. POC!
×
×
  • 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.