Jump to content

harristweed

Members
  • Posts

    346
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by harristweed

  1. Are you sure the content of "modify.php" is sufficient to need scroll bars?
  2. this works.... $data["content"]="a load of stuff a load of stuff a load of stuff a load of stuff a load of stuff a load of stuff "; // first find the first space after 40 characters, this should be the end of a word $offset =strpos ( $data["content"], " " ,40) ; //then put into variable $shorter_list = substr ($data["content"],0,$offset); //add the trailing dots $shorter_list.="...."; echo $shorter_list; first echo $data["content"] and make sure it has content
  3. If you don't know how to echo variables I suggest you read some basic PHP Tutorials
  4. To choose the first 40 characters might chop a word in half, I think better to display whole word. // first find the first space after 40 characters, this should be the end of a word $offset =strpos ( $data["content"], " " ,40) ; //then put into variable $shorter_list = substr ($data["content"],0,$offset); //add the trailing dots $shorter_list.="....";
  5. change if(isset($_GET["strSale"])) to if(isset($_GET["sale"])) It should then work
  6. Ye I just noticed that! It is a bit late at night here!
  7. $string = '1,2,3,4,5,6,7'; $$string_array=explode(",", $string); foreach ($$string_array as $value) { echo"<category><![CDATA[$value]]></category>\n"; }
  8. As jl5501 pointed out, you are not actually reading the file....try mysql_connect ("localhost","username","password"); mysql_select_db ("database_name"); // Path to the data file $path="test.txt"; // Get the site of the file $filesize=filesize($path); // Open file, read its data and close it $filenum=fopen($path,"r"); $contents = fread($filenum, filesize($filesize)); fclose($filenum); $bits=explode(",",$contents); $arrlen = count($bits); // Listing the array inside a loop, adding it to the database and echo about it. for($i=0; $i<$arrlen ; $i++){ $sql_insert = mysql_query("REPLACE INTO case_numbers (casenumber,casename) VALUES ('$bits[0]','$bits[1]'"); $result = mysql_query ($sql_insert); // reports an error if insert fails. if (!$result)echo mysql_error(); } // All done, let's go home! echo "All rows imported successfully!";
  9. Thanks hostingon, Browser problem. Firefox 3.0.13
  10. This script sends 3 emails, Can anyone tell me why? <?php if($_GET['submit']=="submit"){ if(mail("[email protected]","hello","i dont get it")){ echo"mail sent"; } } ?> <form action="email_test.php" method="get"> <input type="submit" name="submit" value="submit">
  11. not quite right but in a hurry to go out......one correction if(empty($state))echo $select;
  12. It's not a PHP problem it's an HTML problem: $select = "selelected = \"selected\" "; print '<td width="160"><p align="right">State</td>'; print '<td width="600"><p align="left"><select name="state">'; print '<option value="0" '; if(empty($state)echo $select; print '>Select Your State</option>'; print '<option value="AL" '; if($state=="AL")echo $selec; print'>Alabama</option>'; print '<option value="AS" ; $state=="AL")echo $selec; >American Samoa</option>'; print '<option value="AK" '; $state=="AK")echo $selec; print'>Alaska</option>'; etc.....
  13. it's a while since I set my laptop up (vista=nightmare) but I do remember: in httpd.conf line 117 reads: LoadModule php5_module "c:/php/php5apache2_2.dll" line 119 reads:AddType application/x-httpd-php .php and you must also: # configure the path to php.ini PHPIniDir "C:/php" line 406 is: ScriptAlias /php/ "C:/php/" AddType application/x-httpd-php .php .php5 Action application/x-httpd-php "/php/php-cgi.exe" SetEnv PHPRC "C:/php" check those
  14. I'd do it like this, make the cd list the link and have the relevant cd in query string: <?php $Row = mysqli_fetch_row($QueryResult); do { echo "<table width='100%' border='1'>"; echo "<tr><th>CD Type</th><th>CD Name</th><th>Price</th><th>Artist</th></tr>"; echo "<tr><td>{$Row[0]}</td>"; echo "<td><a href=\"update.php?cd=$Row[1]\">{$Row[1]}</a></td>"; echo "<td>{$Row[2]}</td>"; echo "<td>{$Row[3]}</td></tr>"; echo '<a href="index.html"> Delete</a>'; $Row = mysqli_fetch_row($QueryResult); } while($Row); ?>
  15. $gameid=str_replace("search"," & # 8 4 8 2 ;",$gameid); // search is what ever you have in the databse for tm and thats why I put in the spaces
  16. The tm symbol is & # 8 4 8 2 (without the spaces) perhaps you could do a replace: $gameid=str_replace("search","™",$gameid); // search is what ever you have in the databse for tm
  17. while($row = mysql_fetch_object($result)) { echo "<tr align='center'><td>"; echo $row->KEGG_ID; echo "</td><td>"; echo $row->Gene_Name; echo "</td><td>"; echo $row->Uniprot_ID; echo "</td><td>"; } Try: while($row = mysql_fetch_object($result)) { echo "<tr align='center'><td>"; echo $row->KEGG_ID; echo "</td><td>"; echo $row->Gene_Name; echo "</td><td>"; echo $row->Uniprot_ID; echo "</td></tr>"; }
  18. http://us.php.net/manual/en/function.in-array.php
  19. I think that you are mistaken about which are the 'bad' characters. This is a line 338 taken from the validator"<description>please visit site<![CDATA[Very clean 2005 Honda Civic DX(Value Package), Low miles â\x80\x93 31,300, Auto Trans, Blue," '\x80' is the euro symbol I'm not sure what \x93 is but you can tell from the original code so you need to do a string replace i.e. $bad=array("\x80","\x93"); $good=array("&#8364;","?????"); $xml=str_replace($bad,$good,$xml); Also "please visit site" needs to be inside the cdata tags.
  20. start here http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Falltherides.com%2Ffeed.xml Find and remove the 'bad' charaters
  21. You could have a look at: https://www.pppay.com/
  22. The code below works <?php $hello ="a string"; echo "<a href=\"mailto:[email protected]?Subject=Report&Body=" . $hello . "\">email</a>"; ?> So why not try creating the string variable '$hello' outside of the mail bit? $hello=email_table($numresults); Hope this helps.....
  23. Sorry, It was a bit late last nigt. Try: <?php function find_day($transit_time){ $today = time (); $year = date("Y", $today); $month = date("m", $today); $day = date("j", $today); $today_day = date("l", $today); $hour= date("H", $today); $weekday = date("w"); if(($weekday==1 && $transit_time < 5)|| ($weekday==2 && $transit_time < 4)||($weekday==3 && $transit_time < 3)||($weekday==4 && $transit_time < 2)){ $delivery_date=mktime($hour, $minute, $second, $month, $day+$transit_time, $year); }else{ //add 2days for every weekend $weekends=floor($transit_time/7)*2; //already one weekend because we got to this bit! This calculates additional weekends $total_days=$transit_time+$weekends+2;// need to add one that weekend! $delivery_date=mktime($hour, $minute, $second, $month, $day+$total_days, $year); } return $delivery_date; }//end function find_day $transit_time = "3"; $delivery_date = find_day($transit_time); echo date("l F j, Y", $delivery_date); ?>
  24. I think Corbins answer is very good however if you don't have php 5.1 I'd do this.... /* 0=Sunday 1=Monday 2=Tuesday 3=Wednesday 4=Thursday 5=Friday 6=Saturday */ $today=date("w"); if(($today==1 && $number_of_days < 5)|| ($today==2 && $number_of_days < 4)||($today==3 && $number_of_days < 3)||($today==4 && $number_of_days < 2)){ $delivery_date=mktime($hour, $minute, $second, $month, $day+$number_of_days, $year); }else{ //add 2days for every weekend $weekends=floor($number_of_days/7)*2; $total_days=$number_of_days+$weekends; $delivery_date=mktime($hour, $minute, $second, $month, $day+$total_days, $year); }
  25. I use a different method that seems to work. To stop botts sending forms, I have (for example) an email form field called antibott. So the variable $antibott hold the users email. I also have a form text field called 'email'. This is in a separate div Using CSS I make this div invisible so humans can't see it!. Therefore if the variable $email is NOT empty the form was filled in by a bott and the form redirects to a page that only botts see!
×
×
  • 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.