Jump to content

lukelee

Members
  • Posts

    92
  • Joined

  • Last visited

    Never

Everything posted by lukelee

  1. If i upload an 300X400 image to replace the old image which is 300X300 on my website through cms, the image will be stretched, does anyone know how to make a crop image function? or is there any tutorial?thanks
  2. I have done half of it: <?php $query = mysql_query("SELECT content FROM content Where id='6'"); while($row = mysql_fetch_array($query)) { $content = $row['content']; function format_html($content) { $content = "<p>" . str_replace("\r\n", "<br/>", $content) . ""; $content = "" . str_replace("<br/><br/>", "</p><p>", $content) . ""; return "" . str_replace("<br/><li>", "<li>", $content) . ""; } echo format_html("$content"); }?> it works on 'enter' change a new line, but still not work if i want to have more spaces between words.like: 123 456 it only display 1 space: 123 456 does anyone know what code do i have to add?
  3. I read that, but I dont understand, how do i put those codes into my codes?
  4. I am making a simple cms, i enter the text in a textarea,then save into sql something like: test123 test456 but it display the contents in one line, like: test123test456 does anyone know how to make sql save the 'enter'? thanks here is my codes: <form name="service" method="post" action="service_update.php"> <textarea name="content"></textarea> <input type="submit" name="submit" id="submit" value="Submit" /> </form> <?php session_start(); require_once('db.php'); $content = $_POST["content"]; $result=mysql_query("UPDATE content SET content='$content' WHERE id='6'"); ?>
  5. It's as valid in programming, as it is in algebra. $a && ($b || $c) == ($a && $b) || ($a && $c) But! $filesize3 && $filesize4 == 0 is not the same as ($filesize3 == 0) && ($filesize4 == 0) and I believe lukelee is after the second one. $filesize3 && $filesize4 == 0 first evaluates $filesize3 && $filesize4 and then compares the result to 0 the second one is to compare$filesize3 and $filesize4, does that mean $filesize3 == $filesize4?
  6. I am confusing about the php operator, are these 2 if conditions the same? if(($filesize1 && $filesize2 && $filesize5 != 0) && ($filesize3 ==0)&& ($filesize4 ==0)) if(($filesize1 && $filesize2 && $filesize5 != 0) && ($filesize3 && $filesize4 ==0))
  7. Here is my code, there are 3 inputs, username, password and repeat_password, both of them cant be null, and password must be same as repeat_password. otherwise, shows error message. but my code doesnt work, i think there must be something wrong in if condition. $username = $_POST[username]; $password = $_POST[password]; $repeat_password = $_POST[repeat_password]; if(($username && $password && $repeat_password!= 0) && ($password==$repeat_password || $password)) { $query = mysql_query("UPDATE admin SET username='$username',passwd='$password' where id='1'"); echo "detail has been changed, you will be redirecting to previous page in 3 seconds"; } else { echo "ERROR..... please check the contents you have entered.";
  8. I want to make a form, when people enter an address, and press submit, it auto generate a link to google map with that address. does anyone know how to do this?
  9. here is my codes: it displays the imagedata whatever the $row['imagedata'] is blank.jpg or not. and the unlink always work。 I think I must did something wrong in if condition $query2 = mysql_query("SELECT imagedata FROM house WHERE address='$address' && thumb='1'"); while($row = mysql_fetch_array($query2)) { if($row['imagedata']!=$myFile){ echo $row['imagedata']; unlink($path); }
  10. Here is my codes, when the selected file is not blank.jpg, deleted the file, so I used if($query['imagedata']!=$myFile){ unlink($path); but it doesnt work, can anyone tell me how to write the codes properly <?php require_once('db.php'); $address = $_POST[address]; $imagedata = $_POST[imagedata]; $path="upload/$imagedata"; $myFile = "blank.jpg"; $image1 = $_FILES['image1']['name']; $new_name1 = "upload/" . md5(uniqid(rand(), true)) . substr($image1, strrpos($image1, ".")); move_uploaded_file($_FILES['image1']['tmp_name'], $new_name1); $filesize1=$_FILES['image1']['size']; if($filesize1!= 0) { $image1 = basename($new_name1); $query = mysql_query("UPDATE house SET imagedata='$image1' where address='$address' && thumb='1'"); $query2 = mysql_query("SELECT * FROM house where address='$address' && thumb='1'"); if($query2['imagedata']!=$myFile){ unlink($path); } echo "image has been changed, you will be redirecting to previous page in 3 seconds"; } else { echo "ERROR..... you cant leave the first image empty"; } ?>
  11. thanks for helps. but what is href=\"http://www.yourdomain.com/rss\ and xml is supposed to be something like: <node> <child> 123 </child> </node> how to i insert those data?
  12. I am making a flash form, which include, name, phone, email, radio button,checkbox... when people click submit, I want this form be generated to an xml file through php. I know how to send email through php. but really no idea how to generate an xml through php. can anyone help please? here is the data I collect from flash: $subject = "My Flash site reply"; $name = $_POST["ename"]; $message = $_POST["emessage"]; can anyone please show me how to continue?
  13. I am making a flash form, which include, name, phone, email, radio button,checkbox... when people click submit, I want this form be generated to an xml file through php. I know how to send email through php. but really no idea how to generate an xml through php. can anyone help please?
  14. I dont know if this effect made by php or javascript. http://www.formalred.com.au/retail/accessories.html click a small image, then popup a big image, then you can go pre or next by click on the big image. can anyone tell me how to make it? and what technology is it.
  15. here is my code: <?php require_once('db.php'); $query = mysql_query("SELECT * FROM image WHERE thumb = '1'"); while($row = mysql_fetch_array($query)) { ?> <ul> <li><img src="upload/<?PHP echo $row['imagedata']; ?>" width="150" height="150" border="1" /></li> <li><?PHP echo $row['address']; ?></li> <li><a href="delete_house.php?address=<?php echo $row['address']; ?>">delete</a></li> </ul> <?php } ?> <?php $address=$_GET['address']; require_once('db.php'); $query = mysql_query("DELETE FROM image WHERE address = $address"); ?> I dont know whats wrong with my codes, the data is not deleted while i clicked the delete.
  16. I will make another php file to do the process, but I dont know how to pass the address value.
  17. here is the code: <?php require_once('db.php'); $query = mysql_query("SELECT * FROM image WHERE thumb = '1'"); while($row = mysql_fetch_array($query)) { ?> <ul> <li><img src="upload/<?PHP echo $row['imagedata']; ?>" width="150" height="150" border="1" /></li> <li><?PHP echo $row['address']; ?></li> <li>delete</li> </ul> <?php } ?> the images are house images, so house must have an address,price, description <?PHP echo $row['address']; ?> shows the address, 1 address can contain more than 1 image. I use thumb = '1' image as a thumbnail. when i click delete, all images and data on this address will be deleted. does anyone know how to do this?
  18. done it, i made a stupid mistake. thanks guys
  19. I tryed this in house.php <?php require_once('db.php'); $address=$_GET['address']; echo "this is $address!"; ?> the output is this is ! seems the address wasnt been passed to house.php
  20. <?php require_once('db.php'); $query = mysql_query("SELECT * FROM image WHERE thumb = '1'"); while($row = mysql_fetch_assoc($query)) { ?> <ul> <li><a href="house.php?id=<?php echo $row['pid']; ?>"><img src="upload/<?PHP echo $row['imagedata']; ?>" width="150" height="150" border="1" /></a></li> </ul> <?php } ?> <?php if(isset($_GET['pid']) && is_numeric($_GET['pid'])){ $id = mysql_real_escape_string($_GET['pid']); $get_details_of_image = mysql_query("SELECT * FROM image WHERE pid = $id") or die(mysql_error());} while($row = mysql_fetch_assoc($get_details_of_image)) { ?> <ul> <li><img src="upload/<?PHP echo $row['imagedata']; ?>" width="150" height="150" border="1" /></li> </ul> <?php } ?> I have tried in this way, still not working...
  21. here is my database looks like: pid title address thumb imagedata 1 house carnegie 1 4352fdase234.jpg 2 farm carnegie 2 423fdsg43tghgh45.jpg 1 bed oakleigh 1 hytuy56retgy4.jpg 1 hotel springvale 1 554thser4fs.jpg because each house may have more than 1 image, so I use address to identify different houses. thumb = 1 mean this image will be used as a thumbnail for people to click, thumb = 2 will be the images on house.php if people click the carnegie house, on the house.php, 'house' and 'farm' will be displayed on house.php here is the changed codes: <?php require_once('db.php'); $query = mysql_query("SELECT * FROM image WHERE thumb = '1'"); while($row = mysql_fetch_assoc($query)) { ?> <ul> <li><a href="house.php?id=<?php echo $row['address']; ?>"><img src="upload/<?PHP echo $row['imagedata']; ?>" width="150" height="150" border="1" /></a></li> </ul> <?php } ?> house.php <?php require_once('db.php'); $sql = sprintf("SELECT * FROM image WHERE address = '%s'",mysql_real_escape_string($_GET['address'])); $query = mysql_query($sql) or die(mysql_error()); if(!mysql_num_rows($query)) die("Image not found"); $row = mysql_fetch_assoc($query); //Now you can echo the data from $row ?> it keeps give me the message of Image not found, btw, what is '%s'
  22. seems I cant get this work, I dont know why, the image just cant be displayed on house.php. I have tryed all the methods people told me, there must be something wrong with my codes or the database.
×
×
  • 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.