Jim R
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Need to GET the slug value for use in another data table…This is a new development or a new method of wanting to do it. As I will have multiple authors, I wanted to make this step automatic instead of manually going in and applying Tag ID’s.
I’m sure I have all the data I need.
Did I miss a reply? The last one you helped me on, I haven’t been back since you pointed me in the right direction. Now, I think I just need to Update my custom table, which has many more names than my WP table, as I increase the number of Tagged names.
I’m not following what you have just typed above very well. I know I have the Tag ID, and I know I have the slug title. For example, I know the Slug alexander-hutson has the Tag ID of 68. My custom table already had the Slug value in place. I need to find the matching Slug value and Update that row of data with the 68.
Forum: Fixing WordPress
In reply to: Need to GET the slug value for use in another data table…Ok…as t31os_ might remember, nothing I ask is just that simple. I “get” something so I can use it, and only being able to read PHP and understanding the logic, I’m not always good at writing my own code.
Most of my Tags are basketball player names. As Posts get published with Tags, I’m trying to match data in two tables with the “Slug” then attach the Tag’s ID to the item in my custom table.
So I have this custom table within my WP database. As I type in the names (they are ranked by the position they play, as well as what grade they are in), I actually type in what their slug would be in WordPress. I then try to match the slugs in each table, so I can figure out which Tag ID to Update my custom table with.
At least that’s how I understand it working. Here is the code I’m trying to use, but of course, it’s not working:
mysql_select_db("jwrbloom_wpHHR"); $wp_tagID = get_query_var('tag_id'); $wp_slug = get_query_var('tag'); $query ="UPDATE wp_playerRank-backup SET wpID = '$wp_tagID' WHERE wpSlug = '$wp_slug'";
Part of the issue is that I may not know where to put that code. Right now, I have in the post.php file just before the script at the end of the file.
Forum: Fixing WordPress
In reply to: Need to GET the slug value for use in another data table…I”m using to echo my results:
mysql_select_db("jwrbloom_wpHHR"); $wp_tagID = get_query_var('tag_id'); $wp_slug = get_query_var('single_tag_title'); echo $wp_tagID; echo $wp_slug;
$wp_tagID is producing the correct results.
$wp_slug isn’t producing anything.[moderated–bump removed. Please refrain from bumping as per Forum Rules]
Forum: Fixing WordPress
In reply to: Need to GET the slug value for use in another data table…BTW…these are Slugs for Tags, not Categories, Posts, Pages, etc.
Forum: Fixing WordPress
In reply to: Tags and POST’ing to a database…??
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…I do appreciate all the time you guys put into the responses. Even if the direct advice isn’t the result, which most of the time it is, it gets me thinking of other things to try as I try to work through the logic.
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…Ok…been playing around with it. To review, I put my table in the same database at WP. It was suggested it would have fewer conflicts due to interacting with multiple databases. What I have done is used a regular MySQL query, and it worked.
I have my data, and my widgets work. I’m connecting to my WP database.
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…In other words, the link provided above, $wp_tagID = 68. So it should look for the one where wpID = 68 and print that one. It worked using a regular mysql query, but that caused my widgets to stop working. Then I read somewhere the table should be in the same database as WP for fewer conflicts, and then I saw the stuff about $wpdb.
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…Well, two problems I can see on the surface then. First, that’s it already is set up to do, and it has worked with the exception of shutting down the other widgets (that was another topic). Second, the actual result should just be one set of that, instead of 435 sets of it, and it should be for the one matching….
if ($line['wpID'] == $wp_tagID)
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…I get this for each one of my entries.
[0] => stdClass Object ( [id] => 1 [year] => 2010 [position] => PG [grouping] => 1 [rankClass] => 7 [deviation] => [rankPos] => 1 [nameFirst] => Jesse [nameLast] => Berry [wpID] => 40 [height] => 6'1" [level] => H- [hschool] => Lafayette (Jeff) [college] => Dayton [committed] => y )
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…Otto, while I understand a little of what you’re talking about, I’m not sure of the solution.
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…Ok…I changed the table name, and it’s still not working.
Forum: Fixing WordPress
In reply to: New to $WPDB, can’t figure out syntax…There should be some profile information from my database about the kid, Alexander Hutson. That and a picture should show up between the page name and the Recent Articles header.
Forum: Fixing WordPress
In reply to: I need to GET the ID of a Tag, so I can use it…When I remove the mysql-select-db code the widgets reappear. It does it on other pages too where I have that code in a tab. It just stops them working. The framework kind of shows up, but the content doesn’t.
Forum: Fixing WordPress
In reply to: I need to GET the ID of a Tag, so I can use it…Not sure I follow. I made the change you suggested, but my code was working as it’s intended, with the exception the widgets in the sidebar stop functioning. The code above is in the tag.php file, using Hyrbrid News theme.