
headmine
Members-
Posts
40 -
Joined
-
Last visited
Never
Everything posted by headmine
-
Exactly what I needed. I knew about spaces and a str_replace is exactly what I was going to do. Thanks so much for your help.
-
I have a string of Data. Inside this string there is a line of text that says Where: 1234 Main Street. What I would like to do is grab the address that comes after "Where:" and have the output with a link to google maps ex Where: <a href="http://maps.google.com?q=1234+Main+Street">1234 Main Street</a> Would I use preg_replace for this? Or am I attacking this the wrong way?
-
Ok. I got it. So here it is for anyone else that might run into this problem $sql = "SELECT value2, COUNT(value2) as total FROM mydb WHERE value1 = 'state' GROUP BY value2" foreach ($sql as $state) { echo $sql->meta_value . ' (' . $sql->total .')<br />'; } This would echo: state (count) CA (3323) NV (93) etc.
-
OK. I've gotten it this far. SELECT value1, COUNT(value2) FROM mydb WHERE value1 = 'state' GROUP BY value1" foreach ($v as $vn) { echo $vn->value1 . '<br />'; } This prints out each state listed . How do I get the numbers next to it? Any help would be appreciated!
-
OK! Breakthru! I was able to do this within the SQL database. SELECT value2, COUNT(value1) As total FROM mydb WHERE value1 = 'state' GROUP BY value2 When I do this in SQL it works beautifully! It breaks down the states and how many records there are for each. When I do this in php. I only get the first Value! =( How do I get it to display all the values? THANKS!
-
I have a database with 4 fields. Primary Key, Userid, Value1, Value2 Userid holds the User Id for the site. Value one is basically anything. It could be state, zip, phone etc. Value2 relates to Value1. I would like to make an sql query that would echo each UNIQUE Value2 and display a Count next to it which represents how many times it's duplicated. Example: CA(200) NY(300) TX(250) etc. Here's what I have so far. SELECT COUNT(DISTINCT value2) FROM mydb WHERE value1 = 'state' This returns 43 Which is probably correct because there are only 50 states in the U.S. Do I need a foreach loop? Please help. Thanks in Advance!
-
Sorry output is: <?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Headmine</title><description>Example of a RSS feed.</description><link>http://headmine.org</link><copyright>Copyright (C) 2009 headmine.org</copyright><item><enclosure length="1234567" type="image/jpeg" url="http://johnregalado.com/the-test/a-river-runs-though-it.jpg" /><url>http://headmine.org/the-test/a-river-runs-though-it.jpg</url></item><item><enclosure length="1234567" type="image/jpeg" url="http://johnregalado.com/the-test/mark-ruhi.jpg" /><url>http://headmine.org/the-test/mark-ruhi.jpg</url></item><item><enclosure length="1234567" type="image/jpeg" url="http://johnregalado.com/the-test/mark.jpg" /><url>http://headmine.org/the-test/mark.jpg</url></item><item><enclosure length="1234567" type="image/jpeg" url="http://johnregalado.com/the-test/namrok.jpg" /><url>http://headmine.org/the-test/namrok.jpg</url></item></channel></rss>
-
I've made a few edits.... Here is the link to the page: http://headmine.org/the-test/index.php I've only been able to get the icons to show with links. I'd like the images to display. here is the updated code <?php $channel = array("title" => "Headmine", "description" => "Example of a RSS feed.", "link" => "http://headmine.org", "copyright" => "Copyright (C) 2009 headmine.org"); foreach (glob("*.jpg") as $filename) { $items[] = array("img" => $filename); } $output = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $output .= '<rss version="2.0">'; $output .= "<channel>"; $output .= "<title>" . $channel["title"] . "</title>"; $output .= "<description>" . $channel["description"] . "</description>"; $output .= "<link>" . $channel["link"] . "</link>"; $output .= "<copyright>" . $channel["copyright"] . "</copyright>"; foreach ($items as $item) { $output .= "<item>"; $output .= "<enclosure length=\"1234567\" type=\"image/jpeg\" url=\"http://johnregalado.com/the-test/". $item["img"] ."\" />"; $output .= "<url>http://headmine.org/the-test/". $item["img"] ."</url>"; $output .= "</item>"; } $output .= "</channel>"; $output .= "</rss>"; header("Content-Type: application/rss+xml; charset=utf-8"); echo $output; ?>
-
I don't understand? Like this foreach ($items as $item) { $output .= "<items>"; $output .= "<item>"; $output .= "<content><img src=\"http://LOCATION/" . $item["img_local"] . "\" /></content>"; $output .= "</item>"; $output .= "</items>"; }
-
When you view the file through a web browser it looks like a feed but no images show up. If I remove <img src= etc then the name of the files will appear. But as soon as I add img tags everything disappears.
-
What im trying to do is create a dynamic rss image feed based on images within a folder. Your array fix helped me but its . Still not working foreach (glob("*.jpg") as $filename) { $items[] = array("img_local" => $filename); } $output = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $output .= '<rss version="2.0">'; $output .= "<channel>"; $output .= "<title>" . $channel["title"] . "</title>"; $output .= "<description>" . $channel["description"] . "</description>"; $output .= "<link>" . $channel["link"] . "</link>"; $output .= "<copyright>" . $channel["copyright"] . "</copyright>"; foreach ($items as $item) { $output .= "<item>"; $output .= "<content><img src=\"http://LOCATION/" . $item["img_local"] . "\" /></content>"; $output .= "</item>"; } $output .= "</channel>"; $output .= "</rss>"; header("Content-Type: application/rss+xml; charset=ISO-8859-1"); echo $output;
-
Is there an easier way to do this? I am trying to get create a dyamic array based on files within the folder. foreach (glob("*.jpg") as $filename) { $items = array("title" => $filename) } $output = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $output .= '<rss version="2.0">'; $output .= "<channel>"; $output .= "<title>" . $channel["title"] . "</title>"; $output .= "<description>" . $channel["description"] . "</description>"; $output .= "<link>" . $channel["link"] . "</link>"; $output .= "<copyright>" . $channel["copyright"] . "</copyright>"; foreach ($items as $item) { $output .= "<item>"; $output .= "<title>" . $item["title"] . "</title>"; $output .= "</item>"; } $output .= "</channel>"; $output .= "</rss>"; header("Content-Type: application/rss+xml; charset=ISO-8859-1"); echo $output; ?> This doesn't even work correctly.
-
Never mind. I've asked about this before and just found my answer. Anyway to delete this?