Jump to content

Q695

Members
  • Posts

    783
  • Joined

  • Last visited

Everything posted by Q695

  1. It's: SELECT * FROM `table` WHERE `column` =value AND `column` =value LIMIT 0 , 30 then you tie the output into a where loop like this while ($row) { //echo this data }
  2. http://php.net/manual/en/function.mysql-num-rows.php <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password"); mysql_select_db("database", $link); $result = mysql_query("SELECT * FROM table1", $link); $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; ?>
  3. I've used it years ago, and the image creator is supposed to be on its own page, as the browser will treat the code like a image not a page. When you go to the submit page it checks the code.
  4. Does anyone know of a script that will easily automatically return where the bad code is in an if statement?
  5. It would be a random name generator incase 2 people decide to choose the same name it won't overwrite a image.
  6. It will be for a game applet. It's a temporary image holder/uploder file until data for the applet is developed. it will upload the images to the temporary folder until the administrator of the applet clicks approve, if it gets denied (i.e. an inapropriate picture) it will sit in the folder for eternity, and not get coppied to the approved content folder later on Users will be primarily in charge of the content development of the applet with the administrator choosing wether the content the administrator has decided to submit is going to be admitted, or not. I figure some people might like being able to say they got something approved, with name recognition with potential for a short/long term artistic contract.
  7. Try doing this: <?php $i = 1; while ($i <= 50000) { echo(rand(1000000000,9999999999)); $i++; /* the printed value would be $i before the increment (post-increment) */ } then doing a database comparison, and then loading it into the database, if the database doesn't already have the number implemented
  8. Instead of using an if, it would be easier to load data into a table, and let the system look for both locations, and pull out the appropriate option if column A, or column B are correct to save on the hundreds of if statements.
  9. Put the data in a form, and use post, then use $_POST to pull the data for where you want to send it to, then mnipulate the data as you want it manipulated.
  10. How do I have the following code count files in folder, and upload them to the folder when it's an image type with the name being the corresponding number? I currently have the following: <form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> <button name="submit" type="submit" class="submitButton">Upload Image</button> </form> <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "images_tester/".$imagename; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "image_tester/" . $imagepath; //This is the new file you saving //don't need this $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 200; $modheight = 200; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; echo "Large image: <img src='images/".$imagepath."'><br>"; //echo "Thumbnail: <img src='images/sml_".$imagepath."'>"; } } ?>
  11. I think I misunderstood the client side stuff category.
  12. How do I have the following code count files in folder, and upload them to the folder when it's an image type with the name being the corresponding number? I currently have the following: <form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> <button name="submit" type="submit" class="submitButton">Upload Image</button> </form> <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "images_tester/".$imagename; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "image_tester/" . $imagepath; //This is the new file you saving //don't need this $file = "images/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 200; $modheight = 200; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; echo "Large image: <img src='images/".$imagepath."'><br>"; //echo "Thumbnail: <img src='images/sml_".$imagepath."'>"; } } ?>
  13. Got it <?php if (isset($_POST['x']) || isset($_POST['xx']) || isset($_POST['xxx'])){ $x = $_POST['x']; $xx = $_POST['xx']; $xxx = $_POST['xxx']; //actions ?>
  14. it's a mysql sort by, not a php issue.
  15. Then table width should be 100%
  16. When there is a 0 returned, it treats it like false, not like data is being returned.
  17. Not sure what the error was, but when I coppied, and pasted from here it became solved without the isset.
  18. Oh, you need to do an isset check just to see if a variable is being passed when there isn't one. When did that change?
  19. Table width="x" should solve it if there's a space in there.
  20. Why are these errors comming from a $_POST variable loader when the post is blank, but solved when it's filled? ( ! ) Notice: Undefined index: x in xxxxxxxxxxxxxxxx on line 6 Call Stack # Time Memory Function Location 1 0.0025 711336 {main}( ) ..\index.php:0 2 0.0205 751136 include( 'xxxxxxxxxxxxxxxx' ) ..\index.php:113 <?php $x=$_POST["x"]; ?>
  21. Thanks, Darker Angel. I didn't know what was going wrong, but whatever you did solved it
  22. <?php //started with: $energy=$row_c['energy']--; //tried: $energy=$row_c['energy']; echo $energy; $energy=$energy--; //value doesn't go -1, what's wrong? ?>
  23. Q695

    Overlapping Images

    I don't know CS as well as I can throw the book.
  24. what seems to be going wrong with the offset section of data? if (isset($_GET['move_x']) || isset($_GET['move_y']) || isset($_GET['door'])){ if (isset($_GET['door'])){ $door=$_GET['door']; $sqld = "select * from doors where id='$door'"; $resultd = mysql_query($sqld, $con) or die ("can not generate result " . mysql_error()); $rowd = mysql_fetch_assoc($resultd); print_r($rowd); if ($cz=$rowd['L1']){ $sqlc="UPDATE user_data SET `c_x` = '$rowd[X2]', `c_y` = '$rowd[Y2]', c_z = '$rowd[L2]' WHERE id =$id"; echo $sqlc . "<br>"; } else if ($cz=$rowd['L2']){ $sqlc="UPDATE user_data SET `c_x` = '$rowd[X1]', `c_y` = '$rowd[Y1]', c_z = '$rowd[L1]' WHERE id =$id"; echo $sqlc . "<br>" . print_r($rowd); } } if (isset($sqlc)){ $result = mysql_query($sqlc, $con) or die ("can not generate result " . mysql_error()); } header('Location: ?page=1'); }
  25. Q695

    Overlapping Images

    Almost, both images are the exact same size (25px X 25px), and one image is supposed to have the other in the background.
×
×
  • 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.