Jump to content

Jim R

Members
  • Posts

    988
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jim R

  1. This is what I'm using now, and if it's a .jpg file, it's not printing at all, just shows an image placeholder. If it's a .JPG file it's echo'ing the image. $file_name = "/wp-content/uploads/". $line['nameLast'] . $line['nameFirst'] . ".jpg"; if (file_exists($file_name)) { echo '<div><img src="<'. $file_name .'"></div>'; //Do nothing } else { echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.JPG"></div>'; }
  2. Gwolgamott, neither of those work, and just looking at it there is no echo codes. I added the echo code, and they still don't work. They just echo the .JPG file. The suggestions utilizing the explode code are conceptually over my head. I don't know how to apply them.
  3. Because I'm not sure how to do that either.
  4. I have a large number of images in one section of my website with the .jpg format. I'm adding a bunch of new images thanks to a new camera, but in using Picasa to bulk export smaller images sizes, they are all exported with .JPG. These are head shots (mug shots) for basketball player profile pages. It's just supposed to be one photo, but the .jpg code isn't printing the .JPG files, which is obvious, so I added a line to print the newly exported .JPG files. The problem is I'm getting two items printed, the image and an image holder. How do I code it to basically say.... "if *this* file type exists....echo *this* file....else if *this* file type exists....echo *this*. Here is the code I'm using: echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.jpg"></div>'; echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.JPG"></div>';
  5. Is there any chance you could take what I have presented above and show me what the syntax should be? Because I know a string to be a variable with a $. Every example I have read shows something in single quotes. Some of the examples appear to be column headers. I have tried it with single quotes, without, with commas, with periods, with backticks, and now what I have is: UPDATE wp_playerRank SET wpSlug = CONCAT (nameFirst,'-',nameLast) Still getting a syntax error.
  6. Tried this: UPDATE wp_playerRank SET wpSlug = CONCAT (nameFirst,-,nameLast) Still getting a syntax error:
  7. Well, the documentation you showed me uses single quotes. So learning by reading documentation, to quote you, I should be using single quotes, but like I said, I didn't understand what was there to begin with so I came here for assistance. BTW...I used commas, still didn't work.
  8. I've already looked at that. That's why I came here.
  9. I'm trying this and getting an error: UPDATE wp_playerRank SET wpSlug = CONCAT ( 'nameFirst' . '-' . 'nameLast')
  10. Ok...I was using another post and just about to try that when this reply notification came in. I'm looking at this from another post: UPDATE wp_playerRank SET wpSlug = CONCAT(???????????) wpSlug is the column I want to input/retrofit the information I need. It needs to read: nameFirst-nameLast
  11. For anyone who might know, I have to retrofit, so to speak, the column data I want for my previous 449 entries. How do I do that?
  12. One more question before I go, my custom table has other columns, I assume I need to format all of those too? $sql="INSERT INTO fallLeague09reg(nameFirst,nameLast,email,addressHome,stateHome,zipHome,phoneHome,phoneMobile,school,grade,coachSchool,feet,inches) VALUES ('$_POST[nameFirst]','$_POST[nameLast]','$_POST[email]','$_POST[addressHome]','$_POST[stateHome]','$_POST[zipHome]','$_POST[phoneHome]','$_POST[phoneMobile]','$_POST[school]','$_POST[grade]','$_POST[coachSchool]','$_POST[feet]','$_POST[inches]')";
  13. I'll play with that and get back to you. Thanks.
  14. BTW...I have 449 rows of data in my custom table.
  15. I've studied up some on this since my first post on it. I'm assuming I would have to do a bulk Update, but for the future, I could input my raw data, so to speak, via a PHP form. Would the PHP form be able to produce the results I want? In other words, I imagine I would $_POST to individual columns in my custom table, but then could I also post to my wpSlug (nameFirst-nameLast) column in the custom table?
  16. I searched, using my subject line, and didn't find what I was looking for. In my custom table, I have columns nameFirst and nameLast. As I'm entering names directly in the database, I'd like a column to auto generate data that equals: nameFirst-nameLast Basically, I'm trying to create data so my WordPress slugs can check for an equal, then post a Tag's ID to my custom table.
  17. It's a require code referring to a connections page, which is linked to my header in Wordpress. I have the problem solved. I moved my custom tables into my WP database.
  18. The mysql_select_db line is causing my WordPress widgets to disappear. I tried putting in a require statement in my theme's header, but then the code below doesn't work as it should. I'm new enough to connecting to MySQL that I'm not sure how else to connect to my database, aside from I have below. <?php $wp_tagID = get_query_var('tag_id'); mysql_select_db("jwrbloom_hhr"); $query = 'SELECT * FROM playerRank'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { if ($line['wpID'] == $wp_tagID) { echo '<div class="player">'; echo '<div>' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</div>'; echo '<div><strong>' . $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 '</strong></div>'; echo '<div><strong>' . $line['hschool'] . '</strong></div>'; echo '<div><img src="/wp-content/uploads/' . $line['nameLast'] . $line['nameFirst'] . '.jpg" width=150 height=200></div> </div>'; } } ?>
  19. That was it. I didn't close either one of them. THANKS!!!
  20. Still not producing any results.
  21. Yes, it is a defined function within WordPress, and when on its own, echo'ing $wp_tagID produces the desired value.
  22. Ok...I got the desired value out of WordPress. Take a look at this. When I echo out $wp_tagID, which is defined in the first line of the PHP code, it outputs the correct value. There is a corresponding ID in my playerRank table, and it should be echo'ing information from the one that matches. I'm putting this code in a PHP widget block in WordPress, but I'm getting no result. <?php $wp_tagID = get_query_var('tag_id'); mysql_select_db("jwrbloom_hhr"); $query = 'SELECT * FROM playerRank'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { if ($line['wpID'] = $wp_tagID) { echo '<div>' . $line['nameFirst'] . ' ' . $line['nameLast'] . '</div>'; ?>
  23. Mike, So you're saying if that class had multiple functions, I would telling it which function to get within that class? I'm trying to apply what Garet said, because I'm mostly just going to be doing the "getting" and not much of the producing of code. I want to take a variable from one result and use it to drag information off of another MySql table. More specifically, I'm talking WordPress Tags. When an Post is written, it can have Tags assigned to it, which I'm sure everyone knows, but I'm new to WP. Those Tags have a number of a values associated to them, including an ID. When you click on the Tag on my site, the URL is nameofsite.com/tag/firstWord-secondWord. In most cases, my Tags are names of basketball players. So essentially when you click on a link, you're getting to an Archive.php page that has every Post Tagged with that player's name. From there I want to assign information from another table, as a way to create kind of a profile on their Archive page. So I have to get the Tag ID#. The rest, I think I can do. WP has ways of doing it, but I'm new enough and don't know enough basic PHP to really know what I was searching for. As I learn what to look for, I can at least start to learn how to apply it. But WP does have a lot of wonderful widgets on which to apply lots of functionality that in PHP would require lots of extra coding.
  24. What does this line mean: $tag = $wp_query->get_queried_object(); I don't follow what the " -> " is for, and it's hard to search for it. Thanks.
×
×
  • 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.