Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by harristweed

  1. if(!$xml = simplexml_load_file(URL HERE)){
  2. you need to 'sort out' your xml first.... <?php $string=" <document> <entry> <id>1234</id> <name>Name</name> <age>Age</age> </entry> <entry> <id>1234</id> <name>Name</name> <age>Age</age> </entry> <entry> <id>1234</id> <name>Name</name> <age>Age</age> </entry> <entry> <id>1234</id> <name>Name</name> <age>Age</age> </entry> </document> "; if(!$xml = simplexml_load_string($string)){ $message.="Can't connect to xml"; }else{ $count=1; foreach ($xml->entry as $value){ $GLOBALS['Entry'.$count]=$value->id; echo $GLOBALS['Entry'.$count]."<br />\n"; $count++; $GLOBALS['Entry'.$count]=$value->name; echo $GLOBALS['Entry'.$count]."<br />\n"; $count++; $GLOBALS['Entry'.$count]=$value->age; echo $GLOBALS['Entry'.$count]."<br />\n"; $count++; } } ?>
  3. this should work <form action="<?php echo $_POST['formVar']; ?>" method="POST"> If it does not, check that $_POST['formVar'] is set and contains a value
  4. You need to ask specific questions about what you are trying to achieve and what's not working. What error messages are you getting? What's not working? What have you done to rectify the problem?
  5. it's a javascript application rather than php!
  6. <form action="<?php echo($_POST['formVar']}; ?>" method="POST">
  7. http://www.tizag.com/mysqlTutorial/mysqlcount.php
  8. You could only allow file uploads from specific ip's. if($_SERVER['REMOTE_ADDR'] != "127.0.0.1") die("not allowed")
  9. Oh! This also might be a bit obvious but what's the page encoding? <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> or <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  10. Not that I know anything about it but it could be that the Wordpress server is set up differently from the server running your code? Apache is outside of my knowledge. I have had issues with character encoding for years and I confess I've never actually found a perfect solution.
  11. if still getting blank page must likely cause is error in include file. Comment it out and if you now get an error message check the include file! //include('config.php');
  12. http://www.tizag.com/mysqlTutorial/mysqljoins.php
  13. if($current_level_id != $data['level_id']) { $checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); $current_level_id = $data['level_id']; $subject_data = array(); } The array $subject_data will be initialised every loop!. So will only contain the last entry. Move outside the loop! $subject_data = array(); while($data = mysqli_fetch_array($sql)) { if($current_level_id != $data['level_id']) { $checkboxes .= createLevelCheckboxes($subject_data, $level_data, 5); $current_level_id = $data['level_id']; } //Add the current record to the $level_data array $subject_data[] = $data; }
  14. use LIMIT in your query.For 10 add LIMIT 0, 10 as the last item in your sql query
  15. Try $query = ' SELECT p.*,c.name as name_category,t.name as name_type,cy.name as name_country,s.name as name_state,l.name as name_locality,pf.name as name_profile,pf.logo_image as logo_image_profile, ' . ' CASE WHEN CHAR_LENGTH(p.alias) THEN CONCAT_WS(":", p.id, p.alias) ELSE p.id END as Pslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as Cslug,' . ' CASE WHEN CHAR_LENGTH(cy.alias) THEN CONCAT_WS(":", cy.id, cy.alias) ELSE cy.id END as CYslug,' . ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as Sslug,' . ' CASE WHEN CHAR_LENGTH(l.alias) THEN CONCAT_WS(":", l.id, l.alias) ELSE l.id END as Lslug, ' . ' CASE WHEN CHAR_LENGTH(t.alias) THEN CONCAT_WS(":", t.id, t.alias) ELSE t.id END as Tslug ' . ' FROM #__properties_products AS p ' . ' LEFT JOIN #__properties_country AS cy ON cy.id = p.cyid ' . ' LEFT JOIN #__properties_state AS s ON s.id = p.sid ' . ' LEFT JOIN #__properties_locality AS l ON l.id = p.lid ' . ' LEFT JOIN #__properties_profiles AS pf ON pf.mid = p.agent_id ' . ' LEFT JOIN #__properties_category AS c ON c.id = p.cid ' . ' LEFT JOIN #__properties_type AS t ON t.id = p.type ' . ' WHERE p.published = 1 ' .' ORDER BY p.id DESC' 'LIMIT 0, 200 ' ;
  16. try removing the quotes from the table name "INSERT INTO ura_items ( Not "INSERT INTO `ura_items` ( and use straight quote on the field names ('ProductName', Not(`ProductName`,
  17. I have done something similar in the past, here is my code, you should be able to amend it to suit.... $size = GetImageSize ("$path_to_image"); // set image name here $old_width = $size[0]; $old_height = $size[1]; if($old_width/$old_height < 1.33334){//is it landscape or portrate? $new_height=300; $new_width=round($old_width/$old_height*300); }else{ $new_width = $width; $new_height = round($old_height * $width / $old_width); } $source_path=$where_temp; //Source File path $destimg=imagecreatetruecolor($new_width,$new_height) or die("<p>Problem In Creating image</p>"); $srcimg=ImageCreateFromJPEG($source_path.$image_name) or die("<p>Problem In opening Source Image</p>"); // imagecopyresampled for better quality imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die("<p>Problem In resizing</p>"); //create an image 400x300 $base=imagecreatetruecolor(400,300); $white= imagecolorallocate($base,208,244,255); //make white background imagefill($base,0,0, $white); //calculate the starting x position to place image in center of background $xpos=round((400-$new_width)/2); //merge the two images imagecopy($base,$destimg,$xpos,0,0,0,$new_width,$new_height); ImageJPEG($base,$destination_path.$image_name) or die("<p>Problem In saving</p>"); }
  18. Sounds like AJAX is required! Big subject.
  19. Hi, I'm working on the same thing, and I use Jquery form validation. http://www.salebyowner.es/register_step_one.php
  20. Are you sure that: 1. $_REQUEST['password'] is set? 2. Your SELECT Query is working correctly. Have you really got a table called 'user_id' ? Try echoing out the variables and see what you get. Turn error reporting on.
  21. Possibly because submit does not have a value. Try: <input name="submit" type="image" value="submit" src="images/search.gif" class="button" onclick="return checkmail(this.form.email);"/>
  22. Well I guess: $query = "SELECT * FROM table WHERE name LIKE '1%' OR name LIKE '2%' name LIKE '3%' name LIKE '4%'................." will do it!
  23. for $insert read $sql (doh! I just got up!!!)
  24. What I do may give you some ideas, I have a function that send me an email... function problem($message){ $today = date('Y-m-d H:i:s'); $mail_message = $message; $mail_message.="<br /><br />at: $today"; $subject = "Problem on [name of site] Website"; $headers .= "From: info@[domain name]\n"; $headers .= "X-Priority: 2\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; $email = "[email protected]"; if(mail($email, $subject, $mail_message, $headers)); return; } //end of email then I have this in all mysql queries: if(!mysql_query($sql)){ $err=mysql_error(); problem("page name.php - line number XX <br /><br /> $err<br /><br /> $insert");
  25. <?php $xml_feed="http://feeds.bbc.co.uk/weather/forecast/2818/Next3DaysRSS.xml"; if($xml = simplexml_load_file("$xml_feed")); foreach ($xml->channel->item as $value) { $title=$value->title; $title=utf8_decode($title); $title=str_replace(",","<br />",$title); echo "<p>$title</p>"; } ?>
×
×
  • 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.