jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
cakePHP is nice, but like learning a whole new language. Def. makes for faster coding though. Yes, that is one way of doing it.
-
json_decode
-
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.
-
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);
-
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.
-
export php page to a file (excel or pdf)
jcbones replied to houssam_ballout's topic in PHP Coding Help
I posted a link to a tutorial that fit your request exactly. -
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.
-
export php page to a file (excel or pdf)
jcbones replied to houssam_ballout's topic in PHP Coding Help
I would suggest the first link -
how to display images when stored link in mysql database
jcbones replied to mark103's topic in PHP Coding Help
You could use CSS to just float that image to the right or left. -
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.
-
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);
-
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;
-
<?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.
-
$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.
-
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.
-
Show us a DB dump of your table structure.
-
Your submitDelete.php script will have header() issues. To resolve these, remove everything outside of your script tags (<?php and ?>).
-
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.
-
Can you help create an array of function for this code?
jcbones replied to wright67uk's topic in PHP Coding Help
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 />"; }} ?> -
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>
-
<?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.
-
creating a new folder and files Using PHP AND inserting the contents.
jcbones replied to seany123's topic in PHP Coding Help
file_put_contents() is essentially calling fopen(), fwrite(), and fclose(), just in one function instead of 3. -
They are in a blob field in your database. At least that is what the script is telling me.