-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
echo many same id numbers from mysql database
ginerjm replied to sungpeng's topic in PHP Coding Help
Would have been nice to not just mention the MySQL error, but to show it to us. Plus - is id a numeric value? -
Try this instead since you can't insert the normal IF statement in an echo: if ($user_data['id'] == $opened['id']) $sel = 'selected'; else $sel = ''; echo "<option value='{$user_data["id"]}' $sel>{$user_data["fullname"]}</option>"; You could also use the ternary if operator but I never do. Note use of " and {} to condense the statement. (Hope I didn't make a typo here. Couldn't paste my code into this post for some reason.)
-
Is there a way to duplicate divs and increment them?
ginerjm replied to imgrooot's topic in PHP Coding Help
I want to know where's the div? -
Not an OOP guy by any means, but I have to wonder why your object can't contain an 'array' to which you pass this array? It appears that var x is going to $obj=>x so why not just pass the whole array to $obj=>array?
-
Why is my function being called twice or is it ?
ginerjm replied to JkennG's topic in PHP Coding Help
I do see that your second block of code is attempting to include the first as well as define its own 'database' class. -
Maybe you could google "cr lf" or "cr/lf"? And then maybe you could look up the mail function in the official php online manual for an example of how it is used? It's not about learning "a whole new program" it is about learning aabout the "program" you are trying to use right now. The Official PHP manual function reference is: http://www.php.net/manual/en/funcref.php You are welcome.
-
An added note: You don't have to bracket your includes EACH with a php start and end tag. One pair will do it. <?php include.... include..... include.... (more includes) more php lines and more and more ?>
-
Did you mean to say "my code will not show the last line"? How do you know it is not showing it? What do you expect to see? You haven't shown us what the values of prev_button and next_button are so that line as far as we can judge wouldn't display anything, unless your div has a border on it.
-
I have no idea what you have done. A php function operates in a script on a string that is part of that script, whether it is a variable or some data that is read into that script. How you are doing this on a 'page' is beyond me. But if you are happy...
-
I was at a loss about what this topic was about. Your post was spot on as I see now, but to me it was just a bit of "off the wall" input that I did not understand. The OP's post was just so confusing I had no idea where he was coming from or where he wanted to go. Luckily you did!
-
Need some more context. When you say "have an Html page", what does that mean if you can't directly edit it? The page is on the screen? And you want to alter it? Very confusing. And how are you going to "add a bit of php to it" if you can't directly edit it?
-
Guess you have to be a facebook user to deduce this answer from THAT post!
-
"Google for addthis" What does THAT mean? Am I in the dark on some form of "new speak" in use on this topic?
-
I suggest you learn better English so that you can re-write your question. I have no idea what you are trying to ask us. Something about Facebook I think.
-
Why the @ on the session_start? Why are you turning error checking OFF? Don't you want it on since you are having problems? (See my signature) You are missing a " on one of your queries. For future thought - please try and keep your html code separate from your php code (and JS too!). Separate your business logic from your presentation code. Makes it easier to follow, easier to write and maintain and far easier to understand. Your broken up html code is producing multiple html, head and body tags. I have no idea what they will do to your browser, but clearly you have to organize it better. Learn to use php vars embedded into your html so that you can put it all together after getting your data values. That is part of the beauty of using php and html - they blend together so that you can easily insert your data exactly where it needs to go simply by outputting the var when you finally output the html. Personally, I use a function that displays my entire web page. That places most of my static html in one place, while I generate the data-laden html in my php portion and just drop the resulting var into place. Then I call that function to output everything.
-
I'm confused by your mix of "upload" and "download". Please clarify - are you moving files from your client (PC) to the server for storage or are you bringing files FROM your server to your client PC? Personally, I would call the former an upload the latter a download.
-
I have tried to make sense of your code so far. Please review my embedded comments. if(isset($_POST['sendmepass'])) { //??******************************************* // You checked for "sendmepass" but now you are using "affiliatername" // value which you have NOT checked for yet??? $mem_email = $affiliater->GetEmailByUsername($_POST['affiliatername']); if ($mem_email != "") { $newpass = generatePassword(); $affiliater->ReminderPassword($_POST['affiliatername'], $newpass); //Send mail $to = $mem_email; $subject = 'Password Reminder'; //??******************************************* // You are editing affiliatername here but STILL have not verified that it was provided. $body = str_replace("{USERNAME}", $_POST['affiliatername'], FORGOTMAILDETAIL); $body = str_replace("{NEWPASSWORD}", $newpass, $body); //??******************************************* // I believe you HAVE to provide a From address in the headers $headers = "Content-Type: text/html; charset=iso-8859-1\n"; mail($to, $subject, $body, $headers); $error = "Your password will be e-mailed to you at the e-mail address you registered with the system! Please check it to recovery your password"; $diplay = "style='display: none;'"; } else $error = "User inactive or not exists! Please type exactly affiliatername which you used to registry"; } $template->set_filenames(array("body" => "forgotpass.html")); $template->assign_vars(array ( 'ERROR' => $error, 'DIPLAY' => $diplay, 'USERNAME'=> "Username", ) ); $template->pparse("body"); include("footer.php");
-
How about showing the whole form?
-
Why call a script via url? Doesn't that add time to the process? Why not simply create a function that does what you want and call that from the main script inside your loop?
-
Why not do some searching and find something to read and learn from? That's how most of us do it. We could probably show you, but what good would that do you? You wouldn't learn how to do it.
-
"your site"? Who's site? Who's script? Have you talked to "them"? This probably makes sense to someone who understands what you are looking at, so you'll have to wait for that person(s) to see your vague post.
-
Besides your mistitle/misspelled title for this post, you seem to be unable to post a sensible question. Just what does the quoted line above mean?
-
How/What is the correct way to create a function for MS SQL Queries.
ginerjm replied to kat35601's topic in PHP Coding Help
Write the lines of code needed to make a connection. Then when it works properly wrap it in a function header and a return of the resulting "handle" var. Store that whole thing in a file above or next to the html root folder and you have it. Then in a script that needs a connection you include that file and call that function. Personally, I have added a parm to the function to allow me to select the desired database name so you can do the connect and select all at one time. I also added a function to the module to retrieve the last sql error message (I use PDO) so that if my calling script wants to display the message during development I can call that function. -
How/What is the correct way to create a function for MS SQL Queries.
ginerjm replied to kat35601's topic in PHP Coding Help
If I am thinking correctly you said you had multiple servers involved. For each connection type (ie, server) you should create a module and function that you include in order to call that function to open the connection and return the handle to it. Then pass that handle to the query function that you create from my post. You don't really have to worry about closing it (but you can) since when the script dies it will self-close. If you only have the one db server and one set of credentials, then you'll only need one connection function. The beauty of having a connection module/function is that you can then use this in any of your future scripts and should the need arise to alter the creds, you just have one place to modify. Be sure to store this module OUTSIDE of the root folder tree. (not in a sub-folder of it!). -
How/What is the correct way to create a function for MS SQL Queries.
ginerjm replied to kat35601's topic in PHP Coding Help
And post #2 didn't help you see it?