Jump to content

SauloA

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Everything posted by SauloA

  1. When submitting the form, the records are sometimes inserted and sometimes not. I receive no errors stating what the problem is. <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO customer_tbl (customer_first_name, customer_last_name, customer_company, customer_ac, customer_phone, customer_fax_ac, customer_fax_phone, customer_email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['customer_first_name'], "text"), GetSQLValueString($_POST['customer_last_name'], "text"), GetSQLValueString($_POST['customer_company'], "text"), GetSQLValueString($_POST['customer_ac'], "text"), GetSQLValueString($_POST['customer_phone'], "text"), GetSQLValueString($_POST['customer_fax_ac'], "text"), GetSQLValueString($_POST['customer_fax_phone'], "text"), GetSQLValueString($_POST['customer_email'], "text")); $customer_id = false; if(mysql_query($insertSQL, $connCid)) $customer_id = mysql_insert_id(); else echo "There was an error."; } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO quote_request_tbl (customer_id, quote_trans_date, quote_from_company, quote_from_address, quote_from_city, quote_from_state, quote_from_zip, quote_to_company, quote_to_address, quote_to_city, quote_to_state, quote_to_zip, quote_comments) VALUES ('$customer_id', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['quote_trans_date'], "text"), GetSQLValueString($_POST['quote_from_company'], "text"), GetSQLValueString($_POST['quote_from_address'], "text"), GetSQLValueString($_POST['quote_from_city'], "text"), GetSQLValueString($_POST['quote_from_state'], "text"), GetSQLValueString($_POST['quote_from_zip'], "text"), GetSQLValueString($_POST['quote_to_company'], "text"), GetSQLValueString($_POST['quote_to_address'], "text"), GetSQLValueString($_POST['quote_to_city'], "text"), GetSQLValueString($_POST['quote_to_state'], "text"), GetSQLValueString($_POST['quote_to_zip'], "text"), GetSQLValueString($_POST['quote_comments'], "text")); $quote_id = false; if(mysql_query($insertSQL, $connCid)) $quote_id = mysql_insert_id(); else echo "There was an error."; } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1") && (isset($quote_id))) { $insertSQL = sprintf("INSERT INTO building_tbl (quote_id, building_quantity, building_width, building_length, building_height, building_overhang, slope_id, building_type_id, manufacture_id, foundation_id) VALUES ('$quote_id', %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['building_quantity1'], "int"), GetSQLValueString($_POST['building_width1'], "int"), GetSQLValueString($_POST['building_length1'], "int"), GetSQLValueString($_POST['building_height1'], "int"), GetSQLValueString($_POST['building_overhang1'], "int"), GetSQLValueString($_POST['slope_id1'], "int"), GetSQLValueString($_POST['building_type_id1'], "int"), GetSQLValueString($_POST['manufacture_id1'], "int"), GetSQLValueString($_POST['foundation_id1'], "int"); mysql_select_db($database_connCid, $connCid); $Result1 = mysql_query($insertSQL, $connCid) or die(mysql_error()); header('Location: index.php?view=article&id=7'); } mysql_select_db($database_connCid, $connCid); $query_rsSlope = "SELECT * FROM slope_tbl ORDER BY slope_id ASC"; $rsSlope = mysql_query($query_rsSlope, $connCid) or die(mysql_error()); $row_rsSlope = mysql_fetch_assoc($rsSlope); $totalRows_rsSlope = mysql_num_rows($rsSlope); $query_rsSlope = "SELECT * FROM slope_tbl ORDER BY slope_id ASC"; $rsSlope = mysql_query($query_rsSlope, $connCid) or die(mysql_error()); $row_rsSlope = mysql_fetch_assoc($rsSlope); $totalRows_rsSlope = mysql_num_rows($rsSlope); mysql_select_db($database_connCid, $connCid); $query_rsBuildingType = "SELECT * FROM building_type_tbl ORDER BY building_type_id ASC"; $rsBuildingType = mysql_query($query_rsBuildingType, $connCid) or die(mysql_error()); $row_rsBuildingType = mysql_fetch_assoc($rsBuildingType); $totalRows_rsBuildingType = mysql_num_rows($rsBuildingType); mysql_select_db($database_connCid, $connCid); $query_rsManufacture = "SELECT * FROM manufacture_tbl ORDER BY manufacture_name ASC"; $rsManufacture = mysql_query($query_rsManufacture, $connCid) or die(mysql_error()); $row_rsManufacture = mysql_fetch_assoc($rsManufacture); $totalRows_rsManufacture = mysql_num_rows($rsManufacture); mysql_select_db($database_connCid, $connCid); $query_rsFoundation = "SELECT * FROM foundation_tbl ORDER BY foundation_name ASC"; $rsFoundation = mysql_query($query_rsFoundation, $connCid) or die(mysql_error()); $row_rsFoundation = mysql_fetch_assoc($rsFoundation); $totalRows_rsFoundation = mysql_num_rows($rsFoundation); ?> I belve the problem is in this part of the code: if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1") && (isset($quote_id))) Many thanks in advance.
  2. Hello PFMaBiSmAd Thanks for the response. I fiddled around with what you stated and combined what jim stated and ended up with the following: $colname_rsCustomers = "A"; if (isset($_GET['letterID'])) { $colname_rsCustomers = $_GET['letterID']; } mysql_select_db($database_connCid, $connCid); $query_rsCustomers = sprintf("SELECT * FROM customer_tbl WHERE customer_last_name LIKE '%s%%' ORDER BY customer_last_name ASC", mysql_real_escape_string($colname_rsCustomers)); $query_limit_rsCustomers = sprintf("%s LIMIT %d, %d", $query_rsCustomers, $startRow_rsCustomers, $maxRows_rsCustomers); $rsCustomers = mysql_query($query_limit_rsCustomers, $connCid) or die(mysql_error()); $row_rsCustomers = mysql_fetch_assoc($rsCustomers); Seems like everything is running smoothly. Thanks for the help. I'm happy to say this problem is solved.
  3. Thanks for the response jim. I get the following error when doing what you've stated: "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 'A'' ORDER BY customer_last_name ASC LIMIT 0, 10' at line 1" This is how my code looks: $colname_rsCustomers = "A"; if (isset($_GET['letterID'])) { $colname_rsCustomers = $_GET['letterID']; } mysql_select_db($database_connCid, $connCid); $query_rsCustomers = sprintf("SELECT * FROM customer_tbl WHERE customer_last_name LIKE '%%%s' ORDER BY customer_last_name ASC", GetSQLValueString($colname_rsCustomers, "text")); $query_limit_rsCustomers = sprintf("%s LIMIT %d, %d", $query_rsCustomers, $startRow_rsCustomers, $maxRows_rsCustomers); $rsCustomers = mysql_query($query_limit_rsCustomers, $connCid) or die(mysql_error()); $row_rsCustomers = mysql_fetch_assoc($rsCustomers); Any thoughts?
  4. I'm not an expert php programmer and I have been using Dreamweaver to produce PHP webpages. I have run into a problem producing a sql statement. $colname_rsCustomers = "A"; if (isset($_GET['letterID'])) { $colname_rsCustomers = $_GET['letterID']; } mysql_select_db($database_connCid, $connCid); $query_rsCustomers = sprintf("SELECT * FROM customer_tbl WHERE customer_last_name LIKE %s ORDER BY customer_last_name ASC", GetSQLValueString($colname_rsCustomers, "text")); $query_limit_rsCustomers = sprintf("%s LIMIT %d, %d", $query_rsCustomers, $startRow_rsCustomers, $maxRows_rsCustomers); $rsCustomers = mysql_query($query_limit_rsCustomers, $connCid) or die(mysql_error()); $row_rsCustomers = mysql_fetch_assoc($rsCustomers); I have been trying to produce this statement: SELECT * FROM customer_tbl WHERE customer_last_name LIKE 'A%' ORDER BY customer_last_name ASC The current code works with no errors. I don't know how to add the "%" without getting an error. So, the current code is only pulling last names that are "A" and I want last names that start with "A". I'd appreciate some help. Thanks in advance.
  5. I ended up using the code from teamatomic. I received no errors and the code works fine: <!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" /> <!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" /> <?php $title; $path=$_SERVER['PHP_SELF']; $page=basename($path); switch("$page") { case 'index.php': $title = 'Welcome to the Home Page'; break; case 'page1.php': $title = 'This is the Page One'; break; case 'page2.php': $title = 'This is the Second Page'; break; } echo '<title>'.$title.'</title>'; ?> <link href="master.css" rel="stylesheet" type="text/css" /> </head> <body> <link href="master.css" rel="stylesheet" type="text/css" /> </head> <body> Thanks everybody. This is officially solved.
  6. I have a header, like so: header.php <!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>Website Page Title</title> <link href="master.css" rel="stylesheet" type="text/css" /> </head> <body> a footer like so: footer.php </body> </html> and several pages use the header and footer like so: index.php, page1.php, and page2.php <?php include("header.php"); ?> <p>Page Content</p> <?php include("footer.php"); ?> The only problem is that I can't change the page <title> for each page. I tried using this code to change the page <title>: <!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" /> <?php $title; switch($_SERVER['PHP_SELF']) { case 'index.php': $title = 'Welcome to the Home Page'; break; case 'page1.php': $title = 'This is the Page One'; break; case 'page2.php': $title = 'This is the Second Page'; break; } echo '<title>'.$title.'</title>'; ?> <link href="master.css" rel="stylesheet" type="text/css" /> </head> <body> I get no errors but the title always comes out blank. Is there a better solution? or is this the code I should be using?
  7. Thank you HoTDaWg. Your code has sparked the correct idea and achieved what I wanted to do. With your insight I was able to produce the following code: <?php do { ?> <table border="1" width="100%"> <tr> <td><?php echo $row_rsVideoCat['video_cat']; ?> <?php echo $row_rsVideoCat['video_cat_id']; ?></td> </tr> <?php mysql_select_db($database_connDB, $connDB); $query_rsVideo = "SELECT * FROM video_tbl WHERE video_cat_id ='".$row_rsVideoCat['video_cat_id']."'"; $rsVideo = mysql_query($query_rsVideo, $connDB) or die(mysql_error()); $row_rsVideo = mysql_fetch_assoc($rsVideo); $totalRows_rsVideo = mysql_num_rows($rsVideo); ?> <?php do { ?> <tr> <td><?php echo $row_rsVideo['video_title']; ?></td> </tr> <?php } while ($row_rsVideo = mysql_fetch_assoc($rsVideo)); ?> </table> <br /> <?php } while ($row_rsVideoCat = mysql_fetch_assoc($rsVideoCat)); ?> Also, the code you gave me had some errors. I believe it goes something like this: <?php $connection = mysqli_connect('localhost','username','password','db_name'); $query = "SELECT * FROM video_cat_tbl"; $result = mysqli_query($connection,$query); while($row = mysqli_fetch_array($result)) { echo $row['video_cat'] . '<br>'; $query2 = "SELECT * FROM video_tbl WHERE video_cat_id ='".$row['video_cat_id']."' LIMIT 2"; $result2 = mysqli_query($connection, $query2); while($row2 = mysqli_fetch_array($result2)){ echo $row2['video_title'] . '<br>'; }; }; ?>
  8. I've been doing some research and I think what I need to do is combine the 2 recordsets in an array. I still don't know what I'm doing though. I'll keep looking until I find the correct answer or somebody provides me the correct answer.
  9. I have a video table and a video category table. The tables are pretty much set up like the following: video_tbl ------------ video_id video_title video_cat_id video_cat_tbl ----------------- video_cat_id video_cat I have 2 recordsets, 1 for each table, that use the following queries video table SELECT video_cat, video_title FROM video_tbl, video_cat_tbl WHERE video_cat_tbl.video_cat_id = video_tbl.video_cat_id video category table SELECT * FROM video_cat_tbl ORDER BY video_cat ASC And I'm using the following PHP code to display the data: <?php do { ?> <table border="1" width="100%"> <tr> <td colspan="2"><?php echo $row_rsVideoCat['video_cat']; ?></td> </tr> <?php do { ?> <tr> <td><?php echo $row_rsVideo['video_title']; ?></td> </tr> <?php } while ($row_rsVideo = mysql_fetch_assoc($rsVideo)); ?> </table> <br /> <?php } while ($row_rsVideoCat = mysql_fetch_assoc($rsVideoCat)); ?> Using the code above the data displays like this Video Category 1 -------------------- Video 1 Video 2 Video 3 Video 4 Video Category 2 --------------------- But I want it to display like this: Video Category 1 -------------------- Video 1 Video 2 Video Category 2 --------------------- Video 3 Video 4 How do I display all the categories with with their specific Items under them?
  10. alright, I'll have to look into this. Thanks for helping a newb.
  11. I forgot to mention that I'm using MySQL client version 5.0.75
  12. I've been hitting my head against the wall trying to figure this out. I have a video table and a video category table. The tables are pretty much set up like the following: video_tbl ------------ video_id video_title video_cat_id video_cat_tbl ----------------- video_cat_id video_cat I wrote this query and it works fine. SELECT video_cat, video_title FROM video_tbl, video_cat_tbl WHERE video_cat_tbl.video_cat_id = video_tbl.video_cat_id The only problem is that the category appears in every row, as it should. I want it to appear only once. Something like the following. Video Category 1 -------------------- Video 1 Video 2 Video Category 2 --------------------- Video 3 Video 4 I'm trying to create a recordset that will display the videos under a certain category. I was looking into using GROUP BY, DISTINCT, or JOIN in the SQL query but I can't figure out what to do. I'd appreciate the help.
  13. Is anyone gonna hook me up with a solution to this problem? I'd really appreciate.
  14. I'm trying to get the data in my database to display in my RSS Feed but there's supposedly an error in my code. My web browser says it's the "mysql_fetch_array()" in my code where it says "while($row = mysql_fetch_array($result))" in the private function getDetails(). I found this code on the net and modified it to suit my needs. Seems like I don't know what I'm doing though. Can someone help me out? Here's the full code I'm using: This is the code that grabs the items for the RSS Feed: <?php class RSS { public function RSS() { require_once ('Connections/mysql_connect.php'); } public function GetFeed() { return $this->getDetails() . $this->getItems(); } private function dbConnect() { DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)); } private function getDetails() { $colname_rsShops = "1"; if (isset($_GET['stateID'])) { $colname_rsShops = $_GET['stateID']; } $detailsTable = "shop_tbl, state_lookup_tbl"; $this->dbConnect($detailsTable); $query = "SELECT * FROM ". $detailsTable ."WHERE shop_state = ". $colname_rsShops ."AND shop_tbl.shop_approved = 1 AND shop_state = state_lookup_tbl.state ORDER BY shop_tbl.shop_name ASC"; $result = mysql_db_query (DB_NAME, $query, LINK); while($row = mysql_fetch_array($result)) { $details = '<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>Anime Shops In '. $row['full_state'] .'</title> <link>http://www.otakuwanted.com</link> <description>Find And Reveiw Anime Shops Near You At Otaku Wanted. Anime Shops In '. $row['full_state'] .'</description> <language></language> <image> <title></title> <url></url> <link></link> <width></width> <height></height> </image>'; } return $details; } private function getItems() { $colname_rsShops = "1"; if (isset($_GET['stateID'])) { $colname_rsShops = $_GET['stateID']; } $itemsTable = "shop_tbl, state_lookup_tbl"; $this->dbConnect($itemsTable); $query = "SELECT * FROM ". $itemsTable ."WHERE shop_state = ". $colname_rsShops ."AND shop_tbl.shop_approved = 1 AND shop_state = state_lookup_tbl.state ORDER BY shop_tbl.shop_name ASC"; $result = mysql_db_query (DB_NAME, $query, LINK); $items = ''; while($row = mysql_fetch_array($result)) { $items .= '<item> <title>'. $row["shop_name"] .'</title> <link>http://www.otakuwanted.com/shopselect.php?shopID='. $row["shop_id"] .'</link> <description></description> </item>'; } $items .= '</channel> </rss>'; return $items; } } ?> This is the code that's supposed to display all code above: <?php header("Content-Type: application/xml; charset=ISO-8859-1"); include("classes/RSS.class.php"); $rss = new RSS(); echo $rss->GetFeed(); ?>
  15. That's good to know. How do I fix this issue?
  16. Okay I see the error now. I cleaned out my data and it's behind the homepage like you said. But, what exaclty does that error mean? Is that a security issue? Will that error only happen if you go to the with "?PHPSESSID"?
  17. Hey agentsteal, I click on the link that you posted and it sends me directly to the home page. What browser are you using? Am I supposed get the same error you get by clicking on the link you posted? I'm not a PHP expert so you might have to explain things more to me.
  18. Hey agentsteal, How'd you get the error you posted? I don't understand the error. From what I can tell by your post you're saying that if there is no session id than the full path of the page is disclosed. What do you suggest I do?
  19. I've recently completed my website using PHP and MySQL. During the development of my website I looked to PHPFreaks for some coding help and I say thanks. I was going to post my site for beta testing earlier but didn't feel is was suitable for viewing at the time. Now I feel that it is suitable for viewing and ask PHPFreaks to help with any errors, bug, glitches, and security issues, if any are present. There is something that I've been trying to figure out. I want to put the amount of posts in my forums but I'm unclear on what to do to count the posts and display that next to the forum title. Visit http://www.otakuwanted.com
  20. I found the solution to my problem. I found my solution here http://www.phpeasystep.com/workshopview.php?id=21. Thanks anyways. Hopefully I have helped those who have the same problem.
  21. redarrow I can't change your code to work with my specifications. I modified it a little and when I push the submit button nothing happens. Can someone tell me what the problem is?
  22. I am trying to adjust the code below to send a user's username and password by inputting an e-mail in the text box and clicking submit. The code below does work. The code below resets a user's password and sends the new password to their email. I don't want the password to reset and get sent, I just want the existing password to be sent. Also, the email doesn't include the username cuz i don't know how to include it in the email. The name of the table that holds the user's informatin in my database is "user_tbl". The username, password, and email fields in "user_tbl" are named respectively "user_sname", "user_pass", and "user_email". Please use these names when changing the code. I've tried to change the code with my minimal knowledge of PHP several times but the results were a failure. I've been trying to fix this issue for along time and have posted this topic a couple times on PHPfreaks. Hopefully the problem will end here. Thanks for the help. <?php session_start(); // Start Session session_register("session"); // This is displayed if all the fields are not filled in $empty_fields_message = "<p>PLEASE GO BACK AND COMPLETE ALL THE FIELDS ON THE FORM.</p>CLICK <a class=\"two\" href=\"javascript:history.go(-1)\">HERE</a> TO GO BACK."; // Convert to simple variables $user_email = $_POST['user_email']; if (!isset($_POST['user_email'])) { ?> <h2>RECOVER A FORGOTTEN PASSWORD</h2><hr> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p><label for="user_email">E-MAIL:</label> <input type="text" title="Please enter your email address" name="user_email" size="30"/> <input type="submit" value="Submit" class="submit-button"/></p> </form> <?php } elseif (empty($user_email)) { echo $empty_fields_message; } else { $user_email=mysql_real_escape_string($user_email); $status = "OK"; $msg=""; //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); if (!stristr($user_email,"@") OR !stristr($user_email,".")) { $msg="YOUR E-MAIL ADDRESS IS NOT CORRECT.<BR>"; $status= "NOTOK";} mysql_select_db($database_connBlog, $connBlog); echo "<br><br>"; if($status=="OK"){ $query="SELECT user_email,user_sname FROM user_tbl WHERE user_tbl.user_email = '$user_email'"; $st=mysql_query($query, $connBlog) or die(mysql_error()); $recs=mysql_num_rows($st); $row=mysql_fetch_object($st); $em=$row->user_email;// email is stored to a variable if ($recs == 0) { echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not in our database. You can signup and login to use our site. <BR><BR><a href='newuser.php'>Register</a> </center>"; exit;} function makeRandomPassword() { $salt = "abchefghjkmnpqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $i = 0; while ($i <= 7) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_password = makeRandomPassword(); $db_password = md5($random_password); $sql = mysql_query("UPDATE user_tbl SET user_pass='$db_password' WHERE user_email='$user_email'"); $subject = "Your login at www.example.com"; $message = "Greetings, we have reset your password. New Password: $random_password http://example.com Once logged in you can change your password Thanks! Site admin This is an automated response, please do not reply!"; mail($user_email, $subject, $message, "From: example.com Webmaster<sauloa@example.com>\n X-Mailer: PHP/" . phpversion()); echo "Your password has been sent! Please check your email!<br />"; echo "<br><br>Click <a href='http://www.example.com'>here</a> to login"; } else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";} } ?>
  23. I inserted your code on my page and it looks like this: mysql_select_db($database_connBlog, $connBlog); $sql="SELECT user_pass, user_email FROM user_tbl WHERE user_sname='".$user_sname."'"; $r = mysql_query($sql, $connBlog); if (mysql_num_rows($r) == 1) { $row = mysql_fetch_assoc($r); if (!is_null($row['user_email']) && ! is_null($row['user_pass'])) { $msg = "Dear ". $_POST['user_sname'] . "\r\n\r\nHere is your lost password : " . $row['user_pass'] . "\r\n\r\nRegards\r\nMe"; $headers = "From: " . $my_email . "\r\nReply-To: " . $my_email . "\r\n"; mail($row['user_email'], 'Lost Password", $msg, $headers'); } } I removed the "%" in this line: if (!is_null($row['user_email']) && ! is_null(%row['user_pass'])) and changed it to a "$". And I added an ' that was missing in this line: 'Lost Password", $msg, $headers); After doing that the form still doesn't seem to do anything. I push the submit button and nothing happens. You got any other ideas?
  24. Can somebody help me make a form that sends a user's username and password to their email when they forget using a code like this: mysql_select_db($database_connBlog, $connBlog); $sql="SELECT user_pass, user_email FROM user_tbl WHERE user_sname='".$user_sname."'"; $r = mysql_query($sql, $connBlog); and using a form like this: <form name="forgot" method="post" action="forgot.php"> <input name="sname" type="text" value="user_email" size="20"/><br /> <input type="submit" name="submit" value="submit"/> </form> I want the user to be able to input their email and when the submit button is pushed they recieve an email with their username and password.
  25. Instead of trying to get this code to work, can somebody tell me or redirect me somewhere that shows how send a user their password through an email if the user forgets their login information.
×
×
  • 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.