Jump to content

tarleton

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by tarleton

  1. Hi, I've got a pretty basic knowledge when it comes to this development. What I'm wanting to do is to be able to change the contents of a cell of a particular table in my DB at a certain time. From what I've tried to research the best way of doing this is writing a query which is to alter the contents of CELL from what is currently written in it to something else and then get this run via a cron job. But well I'm at a loss on how to write the query (presume very basic) and how to write the cron job. Any help at all is super appreciated! EDIT --- My fault posted in wrong topic can a mod move this to MYSQL topic area please..sorry.
  2. Thankyou so much. I've managed to get that all working except for one problem. I have a php function which calls a text file and allows the user to edit it through their browser (extremely basic) This is that code: <?php // Calls file called records.txt $file_contents = file_get_contents('records.txt'); // creates Save function if(isset($_REQUEST['save'])) { // Creates variable $file_contents which is the contents of the records.txt file $file_contents = $_REQUEST['contents']; // Saves the variable of the $file_contents to records.txt file_put_contents('records.txt',$file_contents); } // Prints the textarea and Save button print "<form> <textarea name=\"contents\" cols='100%' rows='20'>$file_contents</textarea> <br /> <input type=\"submit\" name=\"save\"/ value='Save'>" ; ?> However instead now once I click save it returns to: http://localhost/index.php?contents=whatevercontentwas and of course the include script doesn't allow this. As it just returns u to the homepage, what should I change within the form to make this work? I've tried adding in an action but no luck.
  3. I have a feeling someone is going to say AJAX but here goes, Currently I have a basic php / html page the goes something like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>BASIC HTML PAGE</title> </head> <body> <?php include 'home.inc.php'; ?> </body> </html> Now I've added some links: <li><a href="#">Add</a></li> What I'm after is when someone click on that link is it changes the <?php include 'home.inc.php'; ?> From the base file to <?php include 'add.inc.php'; ?> Help much appreciated!
  4. Hi, Have a text file that is being read. I want to print the contents however I want each line of the text file to appear on a new line in the browser. So far $str = file_get_contents('records.txt'); $lines = explode("\n", $str); echo $lines[0]; Help appreciated
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>bmi.php</title> </head> <?php $name = $_POST['name']; $weight = $_POST['weight']; $height = $_POST['height'] ; ?> <body> <?php echo "<table> <tr> <td>Name:</td> <td>$name</td> </tr> <tr> <td>Weight:</td> <td>$weight</td> </tr> <tr> <td>Height:</td> <td>$height</td> </tr>"; echo "</table>"; ?> <?php $bmi = ($weight)*($weight) ; $bmi = ($bmi)/($weight); echo "$name, your BMI is $bmi <br>" ; //Open the file which order will be written to. $file = fopen("$name.txt","wr"); //Write the string to the file echo fwrite($file,"Name: $name , Weight: $height , Height: $height , BMI: $bmi"); fclose($file); if ($bmi <= 18.5) echo "You are Underweight" ; elseif ($bmi >= 18.5 && $bmi <= 24.9) echo "You are Normal Weight" ; elseif ($bmi >= 25 && $bmi <= 29.9) echo "You are Overweight" ; elseif ($bmi >= 30) echo "You are obese" ; ?> </body> </html> Above is my code fixed and thankyou for your help. A question question however why when I print this does it show the number of characters written to the text file?
  6. Hello. Here is my statement: if ($bmi = < 18.5) echo "You are Underweight" ; elseif ($bmi = > 18.5< 24.9) echo "You are Normal Weight" ; elseif ($bmi = > 25< 29.9) echo "You are Overweight" ; elseif ($bmi = > 30) echo "You are obese" ; ?> But I get Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\W06\bmi.php on line 40 FYI Line 40 = if ($bmi = < 18.5) I've looked at examples on Google and yet they seem to look the same as this what am i doing wrong?
  7. I'm runnng the code in conjunction with a CMS called MODX but i don't see how that could cause a problem.
  8. I was really hoping you wouldn't say that.
  9. This script used to work fine on my local host however when treansfed to a live site i get the following output: echo $data['text']; ?> Here is code: <?php function getStockSite($stockLink){ if ($fp = fopen($stockLink, 'r')) { $content = ''; while ($line = fread($fp, 1024)) { $content .= $line; } } return $content; } function processStockSite($wurl){ $wrss = getStockSite($wurl); $name = '-'; $price = ''; $diff = ''; if (strlen($wrss)>100){ $spos = 0; // Get text $spos = strpos($wrss,'</span>:',$spos)+3; $spos = strpos($wrss,'<big>',$spos); $epos = strpos($wrss,'</div><h1>',$spos); if ($epos>$spos){ $text = substr($wrss,$spos,$epos-$spos); } else { $text = '-'; } $spos = $epos + 10; // Get company name $epos = strpos($wrss,'<',$spos); if ($epos>$spos){ $name = substr($wrss,$spos,$epos-$spos); } // Get actual price $spos = strpos($wrss,'yfs_l10')+strlen('yfs_l10'); $spos = strpos($wrss,'>',$spos)+1; $epos = strpos($wrss,'<',$spos); if ($epos>$spos){ $price = substr($wrss,$spos,$epos-$spos); } else { $price = '-'; } // Get direction $spos = strpos($wrss,'alt',$epos)+strlen('alt')+2; $epos = strpos($wrss,'"',$spos); if ($epos>$spos){ $dir = strtolower(substr($wrss,$spos,$epos-$spos)); } // Get difference $spos = strpos($wrss,'>',$epos+3)+1; $epos = strpos($wrss,'<',$spos); if ($epos>$spos){ $diff = substr($wrss,$spos,$epos-$spos); } } $result['name'] = $name; $result['value'] = $price; $result['diff'] = $diff; $result['direction'] = $dir; $result['text'] = $text; return $result; } // Get stock data //$data = processStockSite('c:\q.htm'); // Google $data = processStockSite('http://finance.yahoo.com/q?s=TLS.AX'); // Google //$data = processStockSite('http://finance.yahoo.com/q?s=MSFT'); // Microsoft //$data = processStockSite('http://finance.yahoo.com/q?s=AAPL'); // Apple //$data = processStockSite('http://finance.yahoo.com/q?s=GE'); // GE ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Stock</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div id="caption"> </div> <div id ="icon2"></div> <div id="result"> <?php echo $data['text']; //echo $data['value'].' '; //if ($data['direction'] == 'up') echo '<span class="up"> +'.$data['diff'].'</span>'; //else echo '<span class="down"> -'.$data['diff'].'</span>'; ?> </div> </div> </body> ?> Help appreciated.
  10. Ahhhh Phpfreaks if only you were a female Cheers
  11. Hi mate so yeah I did. But it still keeps going outside....
  12. Another Quick Question: 1. When I add text how can I make it so it is contained within the div area?
  13. Hi all. I'm after a slideshow type Javascript script thats like the one on the steam page. http://store.steampowered.com/ Anyone got some useful links?
  14. Hi so I'm super new to CSS. Trying to make a 3 col layout (yes I know there are some on the net already but trying to learn). Got a few problems: 1. Right Column isn't staying near header. 2. Mid column isn't going to full length like left column. 3. There is a white border around entire page. Thanks for any help guys. Here is what i've got so far: www.spacioushost.com/test style.css #header { background: #000; height:55px; width:100%; } #leftcol { position: absolute; width: 15%; height: 100%; background:url(images/left_col.jpg) repeat; } #rightcol { width: 15%; height: 100%; background:url(images/right_col.jpg) repeat; float: right; } #midcol { background: #232323; width: 70%; height: 100%; margin-left: 15%; }
  15. Hmm anyone done this before? Anyone point in the right direction google is not being so helpful.
  16. Hi all, I'm wondering if it is possible to get php to call and display the content of a specific worddocument lets say test.doc?
  17. Hi all I know this is a big task i'm just kind of stumpped. I managed to do somthing the same with recent topics however the POLL is just screwing me up. What I want is to display recent poll SSI call like this | <form method="post" action=""> <fieldset class="poll-options"> <dl> <dt><label for="vote_1">I absolutely love it!</label></dt> <dd><input type="radio" name="vote_id[]" id="vote_1" value="1" /></dd> </dl> <dl> <dt><label for="vote_2">Looks good!</label></dt> <dd><input type="radio" name="vote_id[]" id="vote_2" value="2" /></dd> </dl> <dl> <dt><label for="vote_3">Meh, not the best...</label></dt> <dd><input type="radio" name="vote_id[]" id="vote_3" value="3" /></dd> </dl> <dl> <dt><label for="vote_4">You could do a lot better.</label></dt> <dd><input type="radio" name="vote_id[]" id="vote_4" value="4" /></dd> </dl> <dl> <dt><label for="vote_5">No way, this is horrible!</label></dt> <dd><input type="radio" name="vote_id[]" id="vote_5" value="5" /></dd> </dl> </fieldset> <fieldset class="submit-buttons"> <input type="submit" class="entervote" value="Enter Vote" title="Enter Vote" /> <a href="#" class="viewresults" title="View Results">View Results</a> </fieldset> </form> Im guessing I should do it the same way I've done the Recent Topics which looks like this | <?php error_reporting(E_ALL); require("C:/xampp/htdocs/game/forums/SSI.php"); $array = ssi_recentTopics( 3, null, 'array'); foreach ($array as $post) { echo '<li>'; echo '<a href="', $post['href'], '">', $post['subject'], '</a>'; echo '</li>'; } ?> I know there is alot of info any help would be appreciated.
  18. Thanks for ur help guys, Mikes thing didn't work kinda screwed up the display of everything. This is what i've tried echo '<strong><a href="', $post['href'], '</strong>">', <em>$post['subject'], '</a></em>'; Get this error Parse error: parse error in C:\xampp\htdocs\game\manager\includes\document.parser.class.inc.php(770) : eval()'d code on line 9
  19. Hi all real nub questions so sorry. <?php error_reporting(E_ALL); require("C:/xampp/htdocs/game/forums/SSI.php"); $array = ssi_recentTopics( 3, null, 'array'); foreach ($array as $post) { echo '<li>'; echo '<a href="', $post['href'], '">', $post['subject'], '</a>'; echo '</li>'; } ?> I want to make <a href="', $post['href'], '"> <strong> and $post['subject'] <em> however i get errors whenever i add the tags around them.
  20. Hi guys. *note may b wrong topic sorry if is* Intregrating SMF + MODX into a html template for a gaming team, tarleton.syfgaming.com.au. On the page there is a recent match section. Im not sure how I should go about setting that up. So what basically needs to happen, is that information is posted in a form for instance and is then posted there. I was hoping to make a custom field in SMF, then use a SSI call to post them there, like I have done with the forums section above (tarleton.syfgaming.com.au). However SMF doesn't currently have a mod out for custom fields and is above my head to make on. Any ideas on how i should do this....not doesn't have to be done through MODX or SMF. Cheers for any help.
  21. Hi all, wondering if there is a script I can use that if you click on a swf file that it expands to the center of the screen (like most gallerys of pictures do). Any ideas?
  22. Hi, Im developing a Client Site for Drupal, I'm looking for a way to show the Latest Announcements on the front page which are linked to the corresponding page within the site. Can't find a module anywhere any ideas?
  23. I suggest using JS. Here is what I use: <script type='text/javascript'> function checkFields() { if (document.getElementById('fname').value == '') { alert('Please enter your First name!'); return false; }<s/cript>
  24. Printed both still they printed fine still not submitting to 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.