Jump to content

rdkd1970

Members
  • Posts

    163
  • Joined

  • Last visited

Everything posted by rdkd1970

  1. Okay that brought the page up with no errors but why did the Welcome, firstname not show up??? Oh and thanks for that....
  2. Can someone help me with this error message...I tried another layout but I think I am getting the same problem where it is not recognizing the next page of the sessions and including the id for a member to continue Invalid query:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #4' at line 1 Whole query:Resource id #4 This is the page. <?php session_start(); ?> <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: login.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ include('Connections/connect_to_mysql.php'); $id = ''; $firstname = ''; $lastname = ''; $country = ''; $email = ''; //Formulate Query //This is the best way to perform an SQL query $query = mysql_query("SELECT id,firstname FROM `Members` WHERE id='%s' AND firstname='%s'"); //Perform Query $result = mysql_query($query); //Check result //This shows the actual query sent to MySQL and the error. Useful for debugging. if(!$result){ $message = 'Invalid query:' . mysql_error() . "\n"; $message .= 'Whole query:' . $query; die($message); } //Use result //Attempting to print $result won't allow access to information in the resource //One of the mysql result functions must be used //See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while($row=mysql_fetch_assoc($result)){ echo Welcome, $row['firstname']; } //Free the resources associated with the result set mysql_free_result($result); ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html> :'(
  3. I solved it I see the path is set with my hosting company. I just have to figure out my coding. I will be back new topic.
  4. I have been having a coding problem. Went back to the books and came across this bit of information. Can anyone tell me if I should be updating my C drive Enabling file uploads and sessions. the windows installer designates two folders in your user area as the values for upload_tmp_dir and session.save_path. However, file uploads and sessions won't work unles you create the folders yourself. In Windows XP go to C:\Documents and Settings\<username>\Local Settings\Temp. Create a new folder called php, and inside that folder, create two subfolders called upload and session. Is this information true as it is not set in my computer. Just need to know if this will help my session :-\
  5. I put the codes at the top with the codes open and close around them like below still get the same error message. <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); ?> <?php session_start(); session_id(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: login.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ $firstname = ''; $id = ''; if (isset($_SESSION['id'])) { $id = $_SESSION['id']; } else { echo "can not get id"; } include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE id=$id"); $row = mysql_fetch_array($result); if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not = echo "Welcome, $firstname"; } else { //so incase the condition is not as expected echo "Sorry you are not $firstname"; } ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html> :'(
  6. Help. When I add data to database it does not upload to the next welcome page. Can someone check my codes and let me know what I am doing wrong. I get this message when it goes to welcome page. can not get id Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/login.php on line 34 Welcome, This is my first codes for them to fill out then it should go to the next welcome page below codes. <?php error_reporting(E_ALL); ini_set("display_errors", 1); include_once ("Connections/connect_to_mysql.php"); $err=''; $id=''; $firstname=''; $lastname=''; $country=''; $email=''; if(isset($_POST["submit"])){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen if($results){ header("Location: login.php"); }else die(mysql_error()); } } } ?> <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'''<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> WELCOME PAGE <?php session_start(); session_id(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: login.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; $id = ''; if (isset($_SESSION['id'])) { $id = $_SESSION['id']; } else { echo "can not get id"; } include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE id=$id"); $row = mysql_fetch_array($result); if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not = echo "Welcome, $firstname"; } else { //so incase the condition is not as expected echo "Sorry you are not $firstname"; } ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html>
  7. All right I put the vars at the top of the page under the connection to db. $err=""; $id="";$firstname"";$lastname""; etc things are looking better. I am going say before I test it updating data to the database that is is a good well done thanks all.
  8. Okay I was wrong about the error message in the form line is the error message <br /><b>Notice</b>: Undefined variable: firstname in <b>/home/ebermy5/public_html/form.php</b> on line <b>60</b><br /> due to the coding <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> Sorry for my confusion.
  9. I put in the isset codes and it removed the error on line 9 it does not show any errors now just the form has the <?php echo htmlspecialchars($email) ?> in each of the fill in form lines.
  10. Okay I got the error message to go and now I am not sure what I am doing as before my page live was not doing showing the coding in the lines to insert member information live. Same coding as before not much has changed but the error reporting.
  11. Can someone help with this error message when I had the @ sign in front of include (db connection etc) I was able to post to my db now I inserted the error_reporting to see why sessions was not going to next page welcoming the member I took out @ added in the error_reporting and get this message. Notice: Undefined index: submit in /home/ebermy5/public_html/form.php on line 9 line 9 is the if($_POST["submit"]){ below <?php include_once ("Connections/connect_to_mysql.php"); error_reporting(E_ALL); ini_set("display_errors", 1); $err=''; if($_POST["submit"]){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen if($results){ header("Location: login.php"); }else die(mysql_error()); } } } ?> <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'''<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> this is my next page after the top information is added to the db. <?php session_start(); session_id(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: login.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; $id = ''; if (isset($_SESSION['id'])) { $id = $_SESSION['id']; } else { echo "can not get id"; } include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE id=$id"); $row = mysql_fetch_array($result); if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not = echo "Welcome, $firstname"; } else { //so incase the condition is not as expected echo "Sorry you are not $firstname"; } ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html>
  12. I am getting the same error message with the row=results.
  13. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/login.php on line 27 Welcome, This is the corrections I made $id=''; and in the select firstname from members.... line so I think it is now the $row not getting the results or I did the result wrong. error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; $id = ''; include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE firstname=$id"); $row = mysql_fetch_array($result);
  14. I had the id in my db. I will try fix this to your suggestions and get back to you.
  15. form <?php @include_once ("Connections/connect_to_mysql.php"); $err=''; if($_POST["submit"]){ // Validate form data if($_POST["firstname"]=='') $err.='Please enter First Name<br>'; if($_POST["email"]=='') $err.='Please enter Email<br>'; if($err==''){ // Check if there are duplicate entries in the 'contacts' table $results = mysql_query("SELECT id FROM `Members` WHERE firstname='".addslashes($_POST["firstname"])."' and Email='".addslashes($_POST["email"])."'"); if($row = mysql_fetch_array($results)){ $err.='Can not add duplicate entry<br>'; } else{ // adding new record to 'contacts' table mysql_query("INSERT INTO Members (firstname,lastname,country,Email) values ('".addslashes($_POST["firstname"])."','".addslashes($_POST["lastname"])."','".addslashes($_POST["country"])."','".addslashes($_POST["email"])."')"); // redirecting to success screen if($results){ header("Location: login.php"); }else die(mysql_error()); } } } ?> <html> <head> <title>Add New Contact</title> </head> <body> <h2>Register with us</h2> <?php echo $err==''?'''<p style="color:red;">'.$err.'</p>') ?> <form method="post" action="form.php"> <table border="0"> <tr> <td valign="middle">First Name:</td> <td><input type="text" name="firstname" size="30" value="<?php echo htmlspecialchars($firstname) ?>"></td> </tr> <tr> <td valign="middle">Last Name:</td> <td><input type="text" name="lastname" size="30" value="<?php echo htmlspecialchars($lastname) ?>"></td> </tr> <tr> <td valign="middle">Country:</td> <td><input type="text" name="country" size="30" value="<?php echo htmlspecialchars($country) ?>"></td> </tr> <tr> <td valign="middle">Email:</td> <td><input type="text" name="email" size="30" value="<?php echo htmlspecialchars($email) ?>"></td> </tr> </table><br> <input type="submit" name="submit" value=" Submit! "> </form> </body> </html> Welcome page (login.php) <?php session_start(); session_id(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: New_member.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; $database_id = ''; include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE database_id=$id"); $row = mysql_fetch_array($result); if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not = echo "Welcome, $firstname"; } else { //so incase the condition is not as expected echo "Sorry you are not $firstname"; } ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to eBermylove Main Page"> </form> </div> </body> </html>
  16. I know it is something so easy that we are missing but me being new to this I would not have a clue. Here is my codes and then the message I got this time error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; $id = $_SESSION['id']; include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE $id=$_SESSION"); $row = mysql_fetch_array($result); Notice: Undefined index: id in /home/ebermy5/public_html/login.php on line 23 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/login.php on line 27 Welcome,
  17. Okay I tried it as follows $_SESSION='id'; and in the $result = $query i put where $_SESSION='id' it added to db and it does not show error message but it is not echoing the Welcome, firstname. It shows Welcome,
  18. I pasted this over the one I have and it just states in the codes there is a syntax error on that line.
  19. I get the same message. Could it be my form. I see it is downloaded to my phpmyadmin.
  20. I am so glad someone told me about putting in the error_reporting ALL because I was not sure why my id for members was not picking up on the next pages. Can someone let me know how I can fix this I thought it automatically picks it up and sets it to private pages for each member. Notice: Undefined index: id in /home/ebermy5/public_html/login.php on line 25 <?php session_id(); session_start(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: New_member.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ error_reporting(E_ALL); ini_set("display_errors", 1); $firstname = ''; include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE id='{$_SESSION['id']}'"); $row = mysql_fetch_array($result); if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not = echo "Welcome, $firstname"; } else { //so incase the condition is not as expected echo "Sorry you are not $firstname"; } ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise from experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to eBermylove Main Page"> </form> </div> </body> </html>
  21. Got it. I am so thankful.
  22. <?php error_reporting(E_ALL); ini_set("display_errors", 1); ?> if(@$_SESSION['id'] == "yes") Is that correct. I am not sure what would go in the brackets???? sorry I am so new at this but I love this scripts it is the best I am socking up all this knowledge.
  23. Are you saying it should be written with "no" instead of the "yes" if (@$_SESSION['auth'] != "yes")
  24. Welcome member. I am able to get data added to my db and when it gets to the welcome page I want it to welcome $firstname but it comes up blank. How can I fix my echo statement. <?php session_id(); session_start(); ?> <!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=utf-8" /> <title>Welcome</title> </head> <body> <?php /* Program: New_member.php * Desc: Displays the new member welcome page. Greets * member by name and gives a choice to enter * restricted section or go back to main page. */ if (@$_SESSION['auth'] != "yes") @include('Connections/connect_to_mysql.php'); $result = mysql_query("SELECT firstname FROM `Members` WHERE id='{$_SESSION['id']}'"); $row = mysql_fetch_array($result); echo "<html> <head><title>New Member Welcome</title></head> <body> <h2 style='margin-top: .7in; text-align: center'> Welcome, $firstName </h2>\n"; ?> <p>Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise for experts, and much more.</p> <p>Your new Member ID and password were emailed to you. Store them carefully for future use.</p> <div style="text-align: center"> <p style="margin-top: .5in; font-weight: bold"> Glad you could join us!</p> <form action="profile.php" method="post"> <input type="submit" value="Enter the Members Only Section"> </form> <form action="index.php" method="post"> <input type="submit" value="Go to Main Page"> </form> </div> </body> </html> :-\
×
×
  • 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.