-
Posts
364 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Love2c0de
-
Have you checked whether the mail function is returning TRUE or FALSE? Put this line instead: if(mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader)) { echo "Email sent"; } else { echo "Email not sent"; } Also, I've had issues in the past where it was saying 'Email sent', yet I wasn't receiving any emails, although I think that was down to not sending any headers IIRC. Are you testing this script on your localhost or live host by the way? Regards, Lc
-
mysqli_connect() accepts 4 parameters: host, user, pass and database name. You only have 3. I'd suggest using a prepared statement such as: $conn = new mysqli("localhost","root","","portfolio") or die("Error: ".mysqli_error()); $stmt = $conn->prepare("SELECT * FROM users WHERE username=? AND password=?") or die("Error:".mysqli_error()); $stmt->bind_param("ss",$_POST['username'],$_POST['pwd']); $stmt->execute(); $stmt->store_result(); $row = $stmt->num_rows; if($row==1){ session_start(); $_SESSION['username'] = $_POST['username']; $_SESSION['pwd'] = $_POST['pwd']; header("location:Home.html"); } else { echo "Wrong name or Password"; } try this out and see what happens. Kind regards, L2c
-
Can you post both of your updated files, edit2.php and editordelete.php? Regards, AoTB.
-
Yea sorry a65 that was my fault. I thought you were using PHP to write the html elements, not knowing you was breakig out of PHP mode and writing the actual HTML stynax. Also, re-read post #8, it might help you. Regards, ATb.
-
Hello, I just tried to edit a post of mine and it said I do not have permissions to edit this post. Any reasons why? I have already been able to edit my posts? Kind regards, AotB.
-
The problem could be the single quotation on this line: mysql_connect("localhost","root","")'; I also noticed that you haven't closed the PHP tag in your <form> here: <td><input type=text name=myname value=<?php echo($row['name']); </td> Just a tip also, I'd really put your HTML attributes in in quotes, if only for good practice. I also don't think you need to be echo'ing the value when passing it through the URL, maybe take the echo out and see what value you get. On the first line of edit2.php, try putting this: var_dump($_GET['id']); Regards, AoTb.
-
Sorry, I was under the impression you had to wrap XHTML attributes in quotations. I thought his table elements were written with PHP and not switching back to HTML mode to write it, which is why I thought the opening and closing php tags were unnecessary. But yes, sorry a65, you need to switch your first link back to how it was because you need to go into PHP mode to get the value to pass. Thank you for re-iterating my last solution though. Regards, AoTB.
-
Have you got your whole code for edit2.php? The error which is showing is related to that line 4 of the edit2.php file. Regards, AoTb.
-
You need to write your link like so: <td><a href="edit2.php?id={$row['id']}">Your Link</a> Kind regards, Aotb.
-
Warning: Mysql_Fetch_Assoc() Expects Parameter 1 To Be Resource, Boolean
Love2c0de replied to a65's topic in PHP Coding Help
Looking at the query you have spelt 'SELECT' like 'SELEECT. If you change it to 'SELECT' it should work, I can't see anything else on first glance which could be causing it. Kind regards, AoTb. -
I wish I knew how to but I think you got some very talented coders helping you here, so you should really stick with their advice! I'm quite new to php so I'm not in a position to help when it comes to more advanced stuff. Regards, AoTB.
-
To make your array more readable, you can print it like this: echo "<pre>"; print_r($array); echo "</pre>"; Regards, AoTb.
-
How To Get Background Defined In External Css?
Love2c0de replied to beyzad's topic in Javascript Help
What result do you want? Do you want just the filename so you can work with it in PHP? Regards, AoTB. -
As your code stands it would look like: NameOfFile.SC2Replay If you want to add the username to the beginning of the file string, you need to concatenate it before moving the file if my memory serves me correctly. Also, instead of sending them an error message saying the file already exists, what I have done previously is generate a random number between 10 and 99 then concatenate the result to the end of the file name, before the extension but making sure you let the user know you had to edit the filename. Not sure if you should edit the filename or send an error but I'd much prefer my site to edit the filename and send a success message than to send an error message because if the user really wants to upload it, he will just go and edit the filename and attempt to re-upload it. He could potentially rename it to the same name as another file in your DB and have the same error which would potentially cause the user to not bother and leave the site. By using a while loop and checking the return values of an expression, you can guarantee you will generate another string which is not in use already. For example: //lets say you have already got the file name and removed the extension. and saved it into $filename //$filename = "your_video_name" while (file_exists($filename)){ $filename.rand(10,99).$extension; } Code not tested but I believe you should understand the jist of it. Kind Regards, AoTB.
-
Call To Undefined Function Mysql_Connect() Revisited....
Love2c0de replied to ack's topic in PHP Coding Help
Hello, Could you possibly post some PHP/SQL code and/or database information?? Kind regards, AoTB. -
Just so I'm clear, is the problem with the text box not aligning correctly with your submit button? If that is an issue, then change your top: 8px to top: 0px on your #searchform input[type=submit] element. That's the only issues I'm seeing at the moment. Regards, AoTB.
-
Can you post your CSS? Without seeing it, I'd suggest declaring a text-align: center; on your <ul> (this will make your <li>'s sit in the center of your <ul>) Give your <li>'s a global padding style of whatever you want, i.e 10px. Declare a text-align: center on your <li>'s too. Regards, AoTB.
-
Can you post some more HTML and CSS or a link to a live version of the page? Regards, AoTB.
-
If you can post your CSS file I will be willing to help you debug it. Regards, AoTB.
-
Welcome to PHPFreaks, I've not been here long but it's a great community. Always get help in detail and people always explain why certain things happen rather than just giving you code or saying what is actually happening, they take the time to help you understand. Had a lot of help from here, I think just half my posts are on one thread Many times you will see me just post code to someone because I'm not 100% in PHP and don't know why certain things happen, but I always try to help people out if I think I have the capabilities. Definitely worth the bookmark and sticking around. If it weren't for frequenting online forums I wouldn't be half as good as I am (and I've still a loooong way to go) so it's really down to people who have helped me understand and of course documentation.. Kind regards BuNgLe
-
Is That Good Practice To Alyways Have Tag Ids?
Love2c0de replied to programming.name's topic in HTML Help
Just to note you can only have one id per page. For instance, you can't declare 2 <div> tags and give them both the same ID. That kind of thing you would use a class for I believe. -
Grabbing Single Value From Other Table To Insert
Love2c0de replied to Kristoff1875's topic in PHP Coding Help
What is the name of your other table? I think you may have to do a join. Regards, AoTB. -
It's viewing pretty much identical in FF and IE 8 for me. What version of IE? I'm on XP so can only go as high as 8 :@ Regards, AoTB.
-
Just played around with your code and it seems to be working now how you want (I think). Check it out: http://jsfiddle.net/BMEXR/44/ You can add any width to the parent div now and your links will always align to the center. This is because your unordered list is spanning 100% of the parent but what really makes it work is setting the text-align: center style. However large your unordered list area is, setting text-align to center will ensure it is always centered within the div. Hope this is your desired result! Kind regards, AotB.
-
If you want your javascript function to run when they submit the form, you have to add the onclick event handler to the submit button like so: <input type="submit" value="Submit" onclick="incorrectAnswer()" /> When you submit your form, this function will run first. You can return true or false from your javascript function to determine whether to carry on with the submit, or whether to cancel the submit. Let's say your function validates some fields, if the user entered the wrong data, you can return false from the function which will stop the submission to the server. You accommodate this by changing the input tag to this: <input type="submit" value="Submit" onclick="return incorrectAnswer()" /> You return true or false depending on what the results of your 'test' was. False stops the submission, true carries on and executes the php script. If you're having some difficulty, i'd drop the javascript and validate it all with the php. In relation to your value not being echo'd, it might seem quite a silly thing to ask, but you have added the closing semicolon haven't you? It's just in your example there is no semicolon after the echo statement. It's hard to say what it could be. Are you getting any error messages come up? PHP usually tells you exactly where the error is, which is a blessing. Kind regards, AotB.