Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. So it must of been trying to handle the extra quotes inside the braces that killed me. Another learning moment.
  2. I continued trying to fix it. Used Braces and extra escape chars but no luck. Weird.
  3. So - what IS happening? Are you getting an error message? Or does the JS never show up? Here is what I converted it to: $formid = $d_row['FormId']; echo "<td><a href='delete.php?user_id=$formid' onclick=\"return confirm('Are you sure?')\">Delete</a></td>"; Couldn't make it work with the reference to the array element so I moved it to a simple variable.
  4. Can you show us ONE entire block of code that includes the function and the code that calls the function?
  5. I have already asked what those addquote lines were but saw no answer. As for templates, I don't know how that could be part of this nor how they could be buried in the HTML as the OP seems to be doing. I am simply looking at some horrendous html/php mashup and trying to make it clearer to the OP. Apparently I am wrong. I'll step aside.
  6. 2 things. you are spelling a word inconsistently and that is 'sucess' The name of your function is Login_sucess and you call it that way but your success message index is spelled correctly. The other - What is a 'redirect'? I went to the manual and see a lot of talk about being out of date and references to using Header("Location:$url") but nothing about using a redirect. Actually the use of the Header IS a redirect. The only thing that this could be is that you are NOT writing your own code but rather doing copy and pastes of blocks of code that you are finding and one of them is written using a different character set. Be sure your editor is using a character set that works for you and then make sure that all of you copied blocks are using the same.
  7. Looking at your old posts here I found this "line 19". <title> addquote('<?=$bbname?' . '>') addquote('<?=$navtitle?' . '>') </title> I broke it down to make it easier to discuss. Can you see now that you have mis-used the php closing tags here? And just what exactly is "addquote()" Is it a php function? If it is you are definitely not using it correctly. The code all around line 19 is HTML code and right in the middle of it you are introducing a php function call. If you really wanted to write this code here is one way to do it properly: echo "<title>" . addquote("$bbname") . addquote("$navtitle") . "</title>"; Note that my using the echo command here implies that I am IN php mode. Never left. Never re-entered. Note that I also use some space chars to help separate the pieces of that long statement. A good practice to make one's code readable to you down the road and to others who may have to work with it perhaps. And if you are not aware of it, using double quotes (") to wrap php vars is a requirement if you want them to be properly interpreted. Single quotes around the 2 vars in the above would simple give you literally $bbname and $navtitle in your html code and that is not what you want.
  8. Those error messages are telling you that there is an error on line 19. They are NOT telling you that "the web is down...". Show us line 19. PS - many voices here will tell you that you never need to use a PHP closing tag (?>) . So if you follow my previous example (above) if you never try to output html 'outside' of php mode, you'll never need to use a closing tag. Not to brag but I write very long scripts sometimes a 1000 lines and I never leave PHP mode.
  9. If you make it a habit to use the long open tag this won't be a problem down the road. And - if you don't keep switching php modes you won't have to worried about php open tags except at the beginning of your script. Here is the last post of code you submitted. See if it makes sense to you how I converted your coding. Don't know what that addquote thing is but I assumed it was a Php function name. <?php if(!defined('IN_DISCUZ')) exit('Access Denied'); $code=<<<heredocs <html> <head> <meta http-equiv="Content-Type" content="text/html; charset="$CHARSET" /> <meta http-equiv="MSThemeCompatible" content="Yes" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="MSSmartTagsPreventParsing" content="TRUE" /> heredocs; echo $code; include template('css'); $code=<<<heredocs <script type="text/javascript" src="include/common.js"> </script> <link href='include/mh_css_6.css' type='text/css' rel='stylesheet'> heredocs; echo $code; addquote('$url_redirect'); echo " <title>"; addquote('$bbname'); addquote('$navtitle'); echo " </title> </head> <body>";
  10. Or better yet: STOP going in and out of php mode. Stay in php mode and use echo to output your html. Consider this: echo "<title>$title</title> <span class='white'>$subtitle</span>"; A very simple mixture of html and php without leaving the php mode.
  11. Just so you can learn. The line "debug.log" is invalid since it doesn't end with a semicolon. All php lines of code must end with a semi. The error message says unexpected @ because the line before it hasn't been properly ended. Another thing that is good practice - do not put more than one php statement on a single line. Write your code literally 'line by line' to make it easier to read, edit, and to understand error messages the reference a line number. Another good thing is to not use the @ symbol to hide errors. It does you no good to hide errors - they should be resolved rather than hidden or ignored.
  12. Yes all of the formids were probably stored in there but you wrote a query with a WHERE clause asking for one record that matched whatever was in the variable named $FormId. PS Suggestion. Do not use upper and lowercases in your variable names. There is no reason to and it can cause you problems down the road when you forget how you spelled a variable and your code is not working correctly because you spelled something in two ways. All lower case makes perfect sense for vars. Maybe you could use caps in table column names but not your vars. PHP is a case sensitive language so don't introduce cases in your code.
  13. ABSOLUTELY!!! Why do the loop of the results just to create a needless $table when you have what you need right in front of you with the query results???
  14. Ok I'm tired of trying to get you to communicate with me. Here is a very simple solution. Try and understand what is happening here. $q = "SELECT First_name, Last_Name, DATE_FORMAT(Birth_date,'%m/%d/%Y') as dob FROM MMS_Members WHERE 1 limit 10"; $results = $pdo->query($q); $today = date_create(date("m/d/Y")); // only creae $today ONCE. while($row = $results->fetch(PDO::FETCH_ASSOC)) // Do the loop using the actual query results instead of a manufactured $table var. { $diff = date_diff(date_create($row['dob']), $today); echo "{$row['First_name)} {$row['Last_Name']} birthday is {$row['dob']} and age now is " . $diff->format('%y') ."<br>"; }
  15. Show me The Code That is Doing the Calculation, Please.
  16. What part do you consider to be your attempt? Just show us that here.
  17. How about showing us you best php attempt at this problem?
  18. So you aren't showing us any attempt at determining someone's age even though you have a column named 'age' in this table. (IMHO, a bad db design.) What have you done to research this problem on your own so far. There is a pretty good selection of date functions in PHP that I'm sure would reveal a solution to you should you take a gander at the official PHP function reference. Suggestions for this posted code: 1 Why go thru the loop of your query results before checking to see if you had any results at all. Checking the size of the table var you are assigning the results to is a bit late, don't you think? 2 If you go thru your code with a closer eye you would see that you are a) using a single birthday value prior to enter the loop to evaluate them all and b) assigning today's date multiple times while in this same loop instead of swapping those 2 operations places.
  19. What you are saying is that you are trying to send your site's hits to some 3rd party script that will show them ads, rather than your own site's pages? Sounds like a site I don't wan to visit.
  20. BTW - what did you do with the solutions that were offered to you last week on a very similar post here? Are you asking this forum's members to waste their time giving you answers that you will only dismiss?
  21. What do your buttons do? Take you to a main script and have that script use a header to direct you? Or are you using multiple forms that each have a button in them with a different action attribute on each form to direct you? This would be a lot easier to diagnose if you showed us SOME CODE.
  22. Learning moment. Never had to know but now I see that you can correct the data and then change the format.
  23. If the column is NOT a type that is date-related then NO you can't just convert it cause it will still be saved in the wrong type. That's why I took the time to write out what you (may) need to do. Think. Think. Think.
  24. If your date value is stored in a non-date type you would need to add a column to your table that is some kind of date field then run a query on the table to convert all of the bad column values to a yyyy-mm-dd value and update the new column with that value. Then you can remove the bad column from the structure.
  25. I prefer not to be called Senior. You are saying that the username is ON the database but this query is not telling you it was found? How about doing an echo of the $Username variable and the rowcount value so we can see what you were looking for? $stmt->execute(); $Result = $stmt->rowCount(); echo "Looked for $Username and returned # of rows $Result";
×
×
  • 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.