jason2
-
Posts
6 -
Joined
-
Last visited
Never
Posts posted by jason2
-
-
utexas: can you please explain the SQL statement to me? I am not familiar with using that dot operator, like when you have "b.*, t.tag_label". Also, the "AS" parts are confusing as well.
-
Thats exactly what I'm doing, but it won't work. If I want to search for all entries tagged with "tag3", I can't go through and explode every tag string in the database looking for what I want.
-
I don't know why I didn't think of that, I'm using the same sort of idea for my commenting system...*dork*. Although, did you just make up that SQL query or is that legit? lol
-
I want to "tag" some database entries (MySQL) with single word tags, then be able to search for posts that have certain tags. What's the best way to store tags in a database so I can easily search by tag through PHP?
Right now I insert them into one column, each tag seperated by commas...but I want to be able to search all entries for one specific tag...looking for any pointers on this. Thanks -
I'm trying to make a really simple XML parser for my website, but its been a couple years since I've used PHP and so many things are lost in my brain now, lol. Anyway, I'm trying to achieve a simple XML parser object that you can feed it a filename, and it will spit out HTML for the content of that file. However, I'm getting the error:
[code]Warning: xml_parse(): Unable to call handler start_tag() in C:\Program Files\Apache Group\Apache2\htdocs\parser.php on line 34
Warning: xml_parse(): Unable to call handler content() in C:\Program Files\Apache Group\Apache2\htdocs\parser.php on line 34
Warning: xml_parse(): Unable to call handler content() in C:\Program Files\Apache Group\Apache2\htdocs\parser.php on line 34[/code]
In fact, lots and lots of these errors (I'm guessing corresponding to each element it tries unsuccessfully to parse from the file. The problem is that I'm really sure I got the code right, lol. Here's the PHP code for the object, I don't understand why it can't find the functions when I named them right and all.
[code]<?php
/************************
* XML parser class
*************************/
class XML {
var $item_array = array();
var $counter = 0;
function start_tag($parser, $tag) {
global $current;
echo "Start: ".$current;
}
function end_tag($parser, $tag) {
global $current;
echo "Ended: ".$current;
}
function content($parser, $cdata) {
global $current;
echo "Content: ".$cdata;
}
function XML($xml_file) {
$parser = xml_parser_create();
xml_set_element_handler($parser, "start_tag", "end_tag");
xml_set_character_data_handler($parser, "content");
$fp = fopen($xml_file, "r") or die("Cannot open ".$xml_file);
$data = fread($fp, filesize($xml_file)) or die("Could not read file");
if(!(xml_parse($parser, $data, feof($fp)))) {
die("Error on line: ".xml_get_current_line_number($parser));
}
xml_parser_free($parser);
fclose($fp);
}
}
?>[/code]
Thanks in advance for the help!
Structure for "tag" cloud?
in PHP Coding Help
Posted
Upon further thought, I really do not need the ID column for the "tags" table, do I? All I need is what tag is associated with which entry, and thats enough uniqueness to find which posts have which tags. If I'm missing something, though, let me know.