Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. It is since the parms are not 'user input' but simply values that your script produced. FYI - you can avoid the bind-param calls if you simply create an array of your parms and their values like this: $parms = array( 'min_price' => $min_price, 'max_price' => $max_price, 'featured' => $featured); $find_records-> execute($parms); allows for easier maintenance later on and avoids all of the bind-param calls.
  2. See if this makes sense to you. <?php /* ****************************** script name description of what this does end of comments ********************************* */ session_start(); error_reporting (E_ALL ^ E_NOTICE); include "includes/db.php"; $query = "SELECT videoid, titulo, url_video from videos"; $result = mysqli_query($connection, $query); $num_per_page =05; $table_data = " <table border='1' width='100%'> <tr> <th>Video Id</th> <th>Titulo</th> <th>Video</th> </tr> "; while (list($videoid, $titulo, $url_video) = mysqli_fetch_row($result)) { $table_data .= " <tr> <td>$videoid</td> <td>$titulo</td> <td>$url_video</td> </tr>"; } $table_data .= " </table> <br> "; $query = "SELECT * from videos"; $pr_result = mysqli_query($connection, $query); $table_data .= "Results found: " . mysqli_num_rows($pr_result); // // Now output the html data including the generated data above. // echo $html=<<<heredocs <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> </div> <!--VIDEOS--> $table_data <br> <div id="footer"> <!--FOOTER--> heredocs; // echo $html; // include "includes/footer.inc.php"; echo " </div> </div> </body> </html> "; exit(); I may have not inserted the table data in the correct place in your html block but I'm sure you can place it in the correct spot if not.
  3. 1 - Yes! Stop going in and out of php mode. Learn how to code better. 2 - How about those echos you buried in the td statements? They look a bit different from your other lines doing similar things. Add a semi.
  4. Do you ever read your code when you write it? "delete records where user_id = a date value?" I thought user ids were integers like 1,2 or 3 as you used earlier. Now they are date values?
  5. Why do you begin the second script with a leap to ANOTHER script? Makes no sense at all.
  6. Is the echo for "not being inserted" showing up? PS - your check to see if a row is returned matching your $email could also be done by simply checking the number of rows returned. Plus - using the input value directly could compare a bad input value against the most-likely 'good' value saved in your db if your user is providing 'bad' input.
  7. Can I ask why all the parens and braces??? A simple assignment statement looks like this (in a simpler format): $a = $b; No need to be typing: $a = {($b)};
  8. But - getting back to your original question. If the script used to work and now it doesn't something has changed. If not the code then, as Barand said, it must be your environment. PHP Version? Default folders in use? .INI settings? I mean - what has changed? We know something has, you just have to find it. Basically - what is the difference between the time when it did work and now? Do you have php error checking turned on in your ini? Have you checked the error log file?
  9. And I would learn how to structure your scripts to separate the logic (PHP) from the presentation (HTML/JS) so that it is easier to read/understand and maintain. As it is your script is very hard to follow. A good style would be to place your php at the beginning and your html at the end and your js embedded inside of that HTML. Test the current status of the script's execution (is this the first time in here? or not?) to determine what you php code should do and avoid trying to handle things from the form that don't yet exist. A nice clean method of writing php scripts would leave you with just one pair of php tags (<?php & ?>) in it.
  10. While reading the item linked to by Barand would be a great place to improve your PDO knowledge, a simple loop on a fetch is the usual way of outputting the results of a query. One problem with your query though is all you are asking for is a count of the rows that match your where condition. Don't you want so select some fields from those matching records to be displayed? After that you simply do this: echo "<table>"; while ($row = $stmt-fetch(PDO::FETCH_ASSOC)) { echo "<tr> <td>{$row['fieldname1']}</td> <td>{$row['fieldname2']}</td> <td>.....</td>.... </tr>"; } echo "</table>"; This will give you a nice html table of the results. You can add your own table headings (th tags) to improve it. And you could add some css code to make more improvements. Note - the "fieldname1 and "fieldname2" are made-up names for your query results. Obviously you would substitute your queried item names for the $row elements. PS - you should also add some error handling code to ensure that the query has actually run or that you have some results to be displayed before starting the loop.
  11. Not trying to be difficult here but I want to ask - What has changed in your code? Working scripts that suddenly don't work usually means you changed something. Have you tried adding any kind of debugging code (echo's or writes to a text file) to track the actions that your script is taking?
  12. array_pop is just an array function that works on any array. Using it on a $_SESSION array is no different than any other array. If you pop something off an array it is no longer a member of that array and that's that. And using it on the $_SESSION array itself (and not a member array) is the same. Why do you think that using it on a $_SESSION array or $_SESSION itself would give you something different? PS - What is this "REQUEST" item that you mention? It is not an automatic entry that I know of.
  13. Actually the OP began this topic by stating that he was working on a 'string' value (from a form). If he is willing to move forward with that and is comfortable that the users will input a valid currency amount, my suggestion made sense. Afterall, it doesn't appear to be a mathematical situation here, simply a formatting change.
  14. Couldn't you just use the str_replace to remove the dot?
  15. I wasn't trying to be insulting, merely questioning the needs he has to be sending out that many email per day.
  16. I'm a bit leary of your proposal. You are need of help to send out 100k emails a day and you don't already have the talent available to guide you in this? I don't like the sound of this project of yours. Should we be helping out a future email-scammer? Or is there an explanation that would convince us that we are not encouraging such behavior?
  17. Yes - you have the right idea. I was only pointing out that if you built your page with the complete link embedded in it you wouldn't need the extra step in the middle. For me - being pretty is not important since the user is only going to see it for about 2 seconds on screen depending upon his/her connection speed. After that the page that is returned will have its own url.
  18. You didn't show ANYTHING like that in your previous example.
  19. IMHO - showing the exact url that you are really using right up front is more intuitive rather than going thru a re-format of it for no real reason.
  20. I'm asking why you don't simply produce the same url from the LINK instead of passing a shortened version to your script that then produces that same url.
  21. I dont' see why you have step 3. You're open about the name of your starting gallery script in the url. But why not with the url that your link is sending? Why have to reformat it as step 4?
  22. Is there a problem here? What's keeping you from a) formatting your script so it is readable and b) from doing it?
  23. Just an odd thought. A "sort order" field being defined as a decimal field seems wrong. A simple field, char or integer, for sorting would make more sense.
  24. Nice that you posted it correctly, but still WAY too much code for the point of your question imho
  25. Uh.... When you unset the variable any test for it not being empty or not being null is going to fail so no echo. If you had php error checking turned on you would probably be seeing a warning/notice concerning that session var.
×
×
  • 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.