Jump to content

tarleton

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tarleton's Achievements

Member

Member (2/5)

0

Reputation

  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%; }
×
×
  • 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.