Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. jcbones

    if else

    cakePHP is nice, but like learning a whole new language. Def. makes for faster coding though. Yes, that is one way of doing it.
  2. json_decode
  3. Hey thanks for your reply but this wont solve the problem the jQuery tabs im using is for news posts so the fragment tabs have to be the same 1,2,3,4 it wont work with id. is there a way to tell the mysql to echo the latest second or third or forth post? this way I can echo it in every fragment.. That is what he gave you. Since you haven't posted any code, he gave you arbitrary code. IN that you will have to fit it to your code. It will not work as a drop in. If you post code, we could give better responses.
  4. jcbones

    if else

    Curly brackets are not required IF the if/else statement only has one line following it. I am a fan of using them at all times. That being said, I'm not sure if this line of code does what you want it to: $result5_f == mysql_query($query5_f) As mysql_query() returns a result resource, and not the actual data. It would help you understand this better, if you ran this line: echo mysql_query($query5_f);
  5. Sometimes an email server's spam filter will hiccup and cause it to send muti emails, if the server gets overloaded. You could either talk to your server provider, or you could tell the script to sleep for a couple seconds every so many emails.
  6. I posted a link to a tutorial that fit your request exactly.
  7. jcbones

    #

    In an anchor tag, the # designates a link to an id attribute. If there is no valid id attribute applied after the #, your browser will just reload the same page.
  8. Have you tried something like: <?php include xbobx.class.php; $xbox = new Xbox(); $xbox->setEmail('myemail@myserver.com'); $xbox->setPassword('mypassword'); $xbox->login(); $xbox->sendMessage('mygamertag','Hey it works!'); ?> Of course, this is from 2 minutes with that script. I can't promise that will work, but that is the general idea behind it.
  9. I would suggest the first link
  10. You could use CSS to just float that image to the right or left.
  11. I typically do all of the php processing, then send the output to a template system to process and deliver the content file to the end user.
  12. Oh, it will work, returning the same row in an infinite loop. Causing the script to timeout, which is why it "takes forever".
  13. while($queryFirst=mysql_fetch_array($sqlQueryFirst)){ $hoursSqlFirst= -$queryFirst['SUM(Hours.Hours)'] + $queryFirst['CycleHours']; $webidSqlFirst= $queryFirst['WebID']; $First[]="($hoursSqlFirst,$webidSqlFirst,0,NOW(),'ADJUSTING ENTRY'),"; } echo implode(', ',$First);
  14. See if this works for you: *you can compare the two and see the 1 line that I changed.* <?PHP /* SUBJECT AND EMAIL VARIABLE */ $emailSubject = ' crazy php scripting '; $webMaster = 'ajame@gmail.com '; /* gathering data variable */ $emailField = $_POST['email'] ; $nameField = $_POST['name'] ; $phoneField = $_POST['phone'] ; $budgetField = $_POST['budget'] ; $travelersField = $_POST['travelers'] ; $commentsField = $_POST['comments'] ; $newsletterField = $_POST['newsletter'] ; $body = <<<EOD <br><hr><br> Email : $email <br> Name : $name <br> Phone : $phone <br> Budget : $budget <br> Number of Travelers : $travelers <br> Comments : $comments <br> Newsletter : $newsletter <br> EOD; $headers = "From : $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*results rendered as html*/ $theResults = <<<EOD <html> <head> <title>JakesWorks - travel made easy-Homepage</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <div> <div align="left">Thank you for your interest! Your email will be answered very soon!</div> <div>You have entered the following: {$body} </div> </div> </body> </html> EOD; echo $theResults;
  15. <?php $i++; if(($i % == 0) //is the same as <?php if((++$i % == 0) $i++ will not work as it will increment $i AFTER it is used. So being that $i = 0 on the first loop, you will get a column with 1 image in it. ++$i will increment the count BEFORE it is used, thereby giving you correct results.
  16. $First is being reset everytime the while loop runs. To get by this (other than using it in the loop), you would have to make $First an array, then manipulate the data after the while loop finishes.
  17. Your column in the images table (gallery_user) should be an integer type, that stores your user table (id). That is where Xyph's code comes into play.
  18. Show us a DB dump of your table structure.
  19. Your submitDelete.php script will have header() issues. To resolve these, remove everything outside of your script tags (<?php and ?>).
  20. Could you just zip it, then send it. Using the ZipArchive Class that comes with PHP 5.3 would make it easy to un-zip them into the correct directory.
  21. In other words, this should work: <?php $_GET = array_map('strtolower',$_GET); $treetype['alder'] = 10; $treetype['apple'] = 14; $girthsize['10to12'] = 11; $girthsize['12to14'] = 13; $items = array(); $items['treetype'] = array('legend'=>'treetype','values'=>$treetype); $items['girthsize'] = array('legend'=>'girthsize','values'=>$girthsize); $errors = array(); $result = array(); foreach($items as $key => $record) { if(empty($_GET[$key])) { $errors[] = "The {$record['legend']} type is empty!"; } else { if(!isset($record['values'][$_GET[$key]])) { $errors[] = "The {$record['legend']} type: {$_GET[$key]}, doesn't exist!"; } else { $result[$key] = $record['values'][$_GET[$key]]; } } } if(empty($errors)) { $total = array_sum($result); echo "Your total is: $total!"; } if(!empty($errors)) { echo "The following errors occurred-<br />"; foreach($errors as $error) { echo "$error<br />"; }} ?>
  22. Try this, and see if it works: <div style="float:left;width:110px;"> <?php $i = 0; if (count($images) == 0) { ?> <li>No uploaded images found</li> <?php } else foreach ($images as $id => $filename) { ?> <table cellpadding="10px"><tr><td> <a href="view.php?id=<?php echo $id ?>"> <img src="view.php?id=<?php echo $id ?> " width="100" height="100"/> </a><br /> </tr></td> </table> <?php if((++$i % == 0) { echo '</div><div style="float:left;width:110px;">'; } //if the current incremented value of $i, divided by 8, has a remainder of 0, write a new division.?> <!-- <a href="view.php?id=<?php //echo $id ?>">--> <?php //echo htmlSpecialChars($filename) ?> <!-- </a>--> <?php } ?><!--end of loop--> </div>
  23. <?php function checkFile($file) { //set the function. $filename = end(explode('\\',$file)); //extract the filename from the file path. list($name,$ext) = explode('.',$filename); //extract the $name of the file, and the ext in separate vars. if(is_file($file)) { //if the file exists. $newFile = str_replace($filename,($name + 1).'.'.$ext,$file); //increment it's value. return checkFile($newFile); //check the file again. } return $file; //if it doesn't exist, just return it. } $filepath = '1.txt'; //set the file, it must be a number file, instead of a named file. $myFile = checkFile($filepath); //get the valid file path. if( file_put_contents($myFile,'hello') !== false) { //if the contents get written. echo file_get_contents($myFile); //echo them. } else { //else tell us it wouldn't write. echo 'could not write.'; } ?> Try it out, of course pass it your file path.
  24. file_put_contents() is essentially calling fopen(), fwrite(), and fclose(), just in one function instead of 3.
  25. They are in a blob field in your database. At least that is what the script is telling me.
×
×
  • 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.