Jump to content

Mundo

Members
  • Posts

    86
  • Joined

  • Last visited

    Never

Everything posted by Mundo

  1. Say my URL is http://www.example.com/catalog.php?category=hats&prodID=53 and I use Mod-rewrite to make it http://www.example.com/catalog/hats/53/ Can I still use $_GET['category'] to get the parameters? If so, how?
  2. The problem there is im using Wordpress... So my code is: <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> // first iterations: <div class="1"> <h3><?=the_title()?></h3> <?=get('custompost_image')?> <?=get('custompost_blurb')?> </div> // second iterations <div class="2"> <h3><?=the_title()?></h3> <?=get('custompost_image')?> <?=get('custompost_blurb')?> </div> // third iterations <div class="break"></div> //reset back to 0... <?php endwhile; ?> If you get me?
  3. This is for display purposes... Is there any way i can make my while loop do the following: <div class="1">$item1</div> <div class="2">$item2</div> <div class="break"></div> <div class="1">$item3</div> <div class="2">$item4</div> <div class="break"></div> <div class="1">$item5</div> <div class="2">$item6</div> <div class="break"></div> Really can't think of a nice, simple, elegant solution for this...
  4. Hello I have a while loop which outputs countrys from the database (im making a "filter by" function). For example, the loop outputs: Denmark Belgium Holland Brazil Japan Brazil Denmark I want to sort these alphabetically and then remove duplicates... Can somebody explain to me how? I don't know how to get them into an array to do it...
  5. I've created a quotation form and some of the values are passed in an array (i've used jQuery to clone the form for necessary fields). I currently have the following: foreach ($_GET as $var => $value) { // Stick POST names into "$var" and the values into "$value" if(!is_array($value)) { // Test us $value contains and array (horse detials are an array everything else isn't) echo "<strong>$var:</strong> $value<br />\n"; // Echo out the customer detials and additional information } else { // If the value is an array.... } } } But i'm kind of stuck for ideas on how to echo out the rest of the details in the way i need it... There are 6 arrays, I know I can do something like: $array = $_GET['quote-details']; foreach($array as $detail) { echo "<strong>Detail:</strong> $detail<br />\n"; } But I have to do this 6 times... I also want to sort these details in a logical manor, but again im a little stuck. So instead of it exporting like: Detail1 Detail1 Detail1 Detail2 Detail2 Detail2 etc, I want it to export as: Detail1 Detail2 Detail1 Detail2 If anyone can give me any help I would be VERY grateful! Regards, Mundo
  6. Say i the address of my page is http://anything/?styleid=2 Is there anyway that I can get a webpage that is loaded in an iFrame on that page to read that variable with Javascript? Any help appreciated
  7. I'm a little stuck... Say the URL is http://ilovecars.com/index.php?car=Volvo and I have a loop which outputs my options such as: <option value="$car">$car</option> I want to have the car which is selected (in this case volvo) selected in the list. For example: <option value="$car" selected="selected">$car</option> Obviously I don't want "selected" on the rest of the listbox... How could I get PHP to do that? Many thanks for any help
  8. Oops, made a typo. You might want to copy again.
  9. <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("databasename") or die(mysql_error()); $query = mysql_query("ALTER TABLE `snews` ORDER BY `id2` DESC"); ?> It might also be useful for you to read the following: http://www.tizag.com/mysqlTutorial/index.php
  10. Mundo

    SimpleXML

    For example, an entry from the XML file is: <device id="nokia_3330_ver1" user_agent="Nokia3330" fall_back="nokia_generic_series20" actual_device_root="true"> <group id="product_info"> <capability name="model_name" value="3330" /> </group> <group id="storage"> <capability name="max_deck_size" value="2800" /> </group> <group id="object_download"> <capability name="wallpaper_gif" value="true" /> </group> <group id="display"> <capability name="max_image_height" value="36" /> </group> <group id="markup"> <capability name="xhtml_support_level" value="-1" /> <capability name="preferred_markup" value="wml_1_1" /> </group> <group id="streaming"> <capability name="streaming_real_media" value="none" /> </group> </device> How would I lookup "preferred_markup" depending on the HTTP_USER_AGENT with the SimpleXML features?
  11. Mundo

    SimpleXML

    I know it's something to do with the following: $xml->$agent->screenwidth But I don't know the format it should be in? Could someone more knowledgeable download the WURFL file and tell me?
  12. I'm using an XML database called WURFL - it can be found here: http://wurfl.sourceforge.net/index.php I want to use this to find out if a device can support either xHTML or WML and the resolution of the screen. Can anybody help me with this? I've got something like this but I'm a bit stuck... <?php $agent = $_SERVER['HTTP_USER_AGENT']; $xml = simplexml_load_file('wurfl.xml'); echo "Prefered Markup: " . $xml->$agent->preferred_markup; echo "Maximum screen width: " . $xml->$agent->screenwidth . "px"; ?>
  13. Ah sorry, was as simple as nl2br($row['method']); Sorry I must have misread your post before. Thanks for the help!
  14. $query = mysql_query("SELECT * FROM recipes WHERE id = '$_GET[recipeid]'"); $row = mysql_fetch_assoc($query); $method = $row['method']; $method = str_replace('<br />', "\n", $method); I've currently got this, but this won't add my line breaks back in either. What do you mean, see the format i've already done?
  15. (ignore the narrow layout etc, it's designed for iPhone)
  16. Well basically the data in the database has linebreaks but when i output it the linebreaks disappear... I want them back without having to insert HTML into the database. As you can see in my screenshot... I want my linebreaks to back to make it more readable. [attachment deleted by admin]
  17. I have data in my MySQL such as: but when i echo it out, there is no formatting left it comes out as: is there an easy way to stop this?
  18. How can I copy pictures into a database with PHP?
  19. Okay, I think I sussed it: $result = mysql_query("SELECT * FROM diary, customer WHERE diary_id = '$_GET[searchterm]' AND diary.customer_id = customer.customer_id"); Thanks for the help, guys. :-\
  20. Mundo

    MySQL Joins

    I posed in the wrong place and can't move my topic, so I'm posting a link here because I feel like I'll get a better response... http://www.phpfreaks.com/forums/index.php/topic,245543.0.html
  21. $result = mysql_query("SELECT * FROM diary LEFT JOIN customer ON customer_id = customer_id WHERE diary_id LIKE '$_GET[searchterm]'"); My understanding is it works like that but it doesn't seem to work... I want to query: Everything from both the customer and diary tables, where the diary_id but linking the the two tables together by the customer_id
  22. I have the following 2 tables: http://i44.tinypic.com/9gc0oh.jpg http://i39.tinypic.com/9zoug6.jpg Can somebody explain to me how to use a JOIN to link the two "customer_id" together? $result = mysql_query("SELECT * FROM diary WHERE diary_id LIKE '%$_GET[searchterm]%'"); That's my current query... I don't really understand how I would link to it.
  23. Mundo

    Time/Date

    Ah I know why, if I select June, it will only add the amount of seconds in June and not all the seconds between now and the end of June... Anybody have any ideas on how I can calculate this? Nobody seems to be responding...
  24. Mundo

    Time/Date

    I know it's something to do with the following line: $date = time() + ($days_thatmonth * 24 * 60 * 60); Any ideas on the maths?!
×
×
  • 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.