Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. I figured that would be one of the responses. What I'm trying to do is create within my database a value to match WordPress slugs in a separate data table I use for personal information for basketball players. It works very well. Just that each year, I enter about 150 names at one setting, and it would be nice to have some of it auto-populate. I put their personal information on their Tag Archive page, so as you click on their tag to see everything they're tagged in, you see their height, school, position, school coach's name, and anything else I choose to put in there.
  2. Ok. Well, the error tells you where it happens, not necessarily what causes it to happen. I think the point is, if I knew what the issue was, I wouldn't have needed the help or would have been more accurate in my description.
  3. Is it possible to set a default value for a column based on what is entered in other columns? Example: Column A: nameFirst Column B: nameLast Column C: 'nameFirst'-'nameLast' So as I type in the A and B, C self populates. I see in my column properties, there is a Default option, but I'm not sure I can put variables in there from other columns.
  4. I didn't know that it mattered. I removed them, and it worked. Thanks.
  5. I've tried two separate captcha options, Securimage and reCaptcha, which is the one I currently have on my page. I got the same error with each code: It's a conflict with the code that moves my User to the 'next step'. Here is the code: (scroll down toward the bottom, just before the email fields) <?php require_once('/home/jwrbloom/public_html/metroindybasketball.com/recaptcha/recaptchalib.php'); $privatekey = "6LetxbwSAAAAAMP2q1q5F5S_tiEcu1sH1_dM3DTl "; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification } ?> <?php /* connect to database */ if(!$con = mysql_connect("localhost","######","######")) { die("Could not connect to database: ".mysql_error()); } mysql_select_db("######_wpMIB", $con); $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $email = $_POST['email']; $addressHome = $_POST['addressHome']; $cityHome = $_POST['cityHome']; $stateHome = $_POST['stateHome']; $zipHome = $_POST['zipHome']; $phoneHome = $_POST['phoneHome']; $phoneMobile = $_POST['phoneMobile']; $school = $_POST['school']; $grade = $_POST['grade']; $coachSchool = $_POST['coachSchool']; $feet = $_POST['feet']; $inches = $_POST['inches']; /* search for existing row */ $sql = "SELECT id FROM fallLeague10 WHERE nameFirst='".mysql_real_escape_string($nameFirst)."' AND nameLast='".mysql_real_escape_string($nameLast)."' AND school='".mysql_real_escape_string($school)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* update existing row */ $sql = "UPDATE fallLeague10 SET confirm='y', email='".mysql_real_escape_string($email)."', addressHome='".mysql_real_escape_string($addressHome)."', cityHome='".mysql_real_escape_string($cityHome)."', stateHome='".mysql_real_escape_string($stateHome)."', zipHome='".mysql_real_escape_string($zipHome)."', phoneHome='".mysql_real_escape_string($phoneHome)."', phoneMobile='".mysql_real_escape_string($phoneMobile)."', coachSchool='".mysql_real_escape_string($coachSchool)."', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."' WHERE id='".$row['id']."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } else { /* insert new row */ $sql = "INSERT INTO fallLeague10 SET confirm='y', nameFirst='".mysql_real_escape_string($nameFirst)."', nameLast='".mysql_real_escape_string($nameLast)."', email='".mysql_real_escape_string($email)."', addressHome='".mysql_real_escape_string($addressHome)."', cityHome='".mysql_real_escape_string($cityHome)."', stateHome='".mysql_real_escape_string($stateHome)."', zipHome='".mysql_real_escape_string($zipHome)."', phoneHome='".mysql_real_escape_string($phoneHome)."', phoneMobile='".mysql_real_escape_string($phoneMobile)."', school='".mysql_real_escape_string($school)."', grade='".mysql_real_escape_string($grade)."', coachSchool='".mysql_real_escape_string($coachSchool)."', feet='".mysql_real_escape_string($feet)."', inches='".mysql_real_escape_string($inches)."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } /* redirect user HERE IS WHERE I AM HAVING MY ERROR */ header("Location:/fall-league/payment"); //exit(); ?> <?php // The message $message = $_POST['nameFirst'] . " " . $_POST['nameLast'] ." has entered the fall league.\n"; $message .= $_POST['feet'] . "'" . $_POST['inches'] ."\", " . $_POST['grade'] . "; " . $_POST['school'] ."\n"; $message .= $_POST['email']; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); $headers = 'From: ' . $_POST['nameFirst'] . " " . $_POST['nameLast'] . " " . $_POST['email']; // Send mail('basketball@metroindybasketball.com', '2010 Fall League Registration', $message, $headers); ?>
  6. Very cool! Thanks it worked. You guys are making me look pretty smart over here. : )
  7. Actually, I have two tables: hhr_schools (my main table) hhr_email_coaches (has email addresses I want to move into the other table) So I'm trying to merge. Through some searching, I think I need to use UPDATE, which makes sense. I don't seem to be getting the syntax right. Here is what I'm using: UPDATE 'hhr_schools', 'hhr_email_coaches' SET 'hhr_schools'.'email'='hhr_email_coaches'.'email' WHERE 'hhr_schools'.'school'='hhr_email_coaches'.'school';
  8. You're a good man. That pretty much worked: $nFirst = $line['nameFirst']; $nLast = $line['nameLast']; $nameFull = "{$nLast}{$nFirst}"; echo '<div><img src="/wp-content/gallery/head_shots/' . strtolower($nameFull) . '.jpg"></div>';
  9. I need to change the variables to all lowercase $line['nameLast'] and $line['nameFirst']. I found what you were referring to, but it doesn't show how to handle multiple column queries. I tried this, but it didn't work: $nf = $line['nameFirst']; $nl = $line['nameLast']; $str = strtolower($nl,$nf); echo '<div><img src="/wp-content/gallery/head_shots/' . $str . '.jpg"></div>';
  10. After changing the collation, I changed my code to echo what the image plugin produces, and the image doesn't show. I just need my code to get nameLast = Smith, nameFirst = Joe, and echo it as smithjoe.
  11. Ok...just changed it to latin1_general_ci, and I didn't get an error. I may have tried a different setting.
  12. I tried changing it to latin1_general_ci because you had referred to that setting, but it gave me an error. How and where (db or query) do I convert from upper to lower using strtolower()?
  13. The code I put here is actually the entirety of my need on this issue. I'm using WordPress, and I'm matching WordPress slugs to records in my custom data table. That has to be case sensitive (or has been my experience), but when I upload images via one of the plugins, it strips the capital letters. I'd like for my other writers to be able to access photos more easily, so that plugin really helps.
  14. Will that change how it's used by other code where it needs the capital letters?
  15. In querying my database, I'm Selecting nameFirst and nameLast, and it produces a name like Joe Smith. I'm trying to match a photo with the name. Right now I'm uploading photos into a folder naming the file (e.g. SmithJoe.jpg). For reasons that involve writers being able to upload and access photos, I'm trying to use an image plugin. When uploading photos, it strips capital letters, so SmithJoe,jpg goes in as smithjoe.jpg, and it's not matching my database query. Here is the code I'm working with that works quite well with this one exception: $query = 'SELECT * FROM wp_playerRank'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { if ($line['wpID'] == $wp_tagID) { echo '<div class="player">'; // Here is the code that produces the image. I need to get rid of capital letters for ease of use echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.jpg"></div>'; echo '<div class="playerData">' . $line['height'] . ' '; if ($line['position'] == 'PG') {echo 'Point Guard';} elseif ($line['position'] == 'SG') {echo 'Shooting Guard';} elseif ($line['position'] == 'SF') {echo 'Small Forward';} elseif ($line['position'] == 'PF') {echo 'Power Forward';} elseif ($line['position'] == 'C') {echo 'Center';} echo '</div>'; echo '<div class="playerData">' . $line['hschool'] . '</div>'; echo '<div class="playerData">' . $line['summer'] . '</div>'; echo '<div class="playerData">Class of ' .$line['year'] . '</div>'; if ($line['committed'] == 'y') { echo '<div> <br>Committed to <strong>'. $line['college'] . '</strong></div> ';} } }
  16. It works now. Thanks...I do appreciate it. Make sure you remove the test echo if should port this over to something you need. That goes for anyone who would use this.
  17. I found the error, and it has nothing to do with what we're talking about. In what you wrote, the School is missing. So as I cleared my test record, when it put it in there it didn't insert the school name.
  18. Here is what it says: However, there is an exact match in the database. I'm looking right at it.
  19. It was an exact match. I back up to the registration page, so all the information is the same. From there I changed street address. It didn't reflect the change. It entered a new record.
  20. It didn't work. I went back to the form, entered my first name, my last name and, the same school name to test it, and I changed my address to a previous one. It didn't update it. It inserted a new record. Could there be an issue with the variables in the IF statement? In what you wrote, they don't appear to match the query.
  21. It's not recognizing the similar record and just inserting.
  22. I really do appreciate your help and your time. I do. I have been involved in a lot of topics on here asking for help and giving a little from the experiences I have had. I never been given the advice of using those escape strings. It was working and worked multiple times, and I tried it on different names, both inserting and updating. Suddenly it doesn't work. That said, the code you wrote didn't work. I got an error:
  23. I commented out of this code, and it passes the User through to the Payment page. What does this code do? if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } Hmmm...not it's not inserting.
  24. I went back to the code I had, without the escapes, as I was getting the same error without the escapes. It is updating the data base, but it isn't passing the User through to the payment page. So it appears to be getting stuck on the following code: if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header( 'Location: /fall-league/payment' ); mysql_close($con)
×
×
  • 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.