Jump to content

matthew9090

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by matthew9090

  1. yes, my hosting is free so it is down sometimes. This site is a test to see if it is a success, otherwise if there is no progress i will think of another idea. I really want a business when im older and i want to work from home. So im already starting .
  2. This is not just on php or a specific language, it is for all others and anyway im only 13.
  3. I think you mean pagination. So there is arrows and numbers to the next page? Search on google for 'pagination' and there is quite a few good ones out there.
  4. I agree use arial or verdana for your fonts, and maybe increase the font size. Also like Nightslyr use hover effects. i makes it look alot better.
  5. Thanks for that. I need other people to review my site first so i can make further changes.
  6. echo "<ol type=\"a\">"; you got backslash in wrong place edit: sorry didn't see other posts
  7. please could you inspect this code and tell me any errors. It is a dictionary script so i shows words from a database with the definition underneith. here are ones that i can't fix: There are 2 divs ontop of each other which makes some borders thicker than the other Some searches start out as bold word and non-bold descripton(that's meant to happen) but then half way down all the text is bold and the borders are thicker the extend() javascript function does not work other than that everything else works. so please can you help clean up my code and tell me what i need to do to fix some of the things. here's the code: <style type="text/css"> div { font-family:Arial,Helvetica,sans-serif; font-size: 30px; border-style:solid; border-width:1px; width: 700px; background-color: #2CFFB5; padding: 0px; } div#div:hover { background-color:#f1f1f1; cursor:pointer } .highlight { color: red; } </style> <script type="text/javascript"> function hover() { document.getElementById("div").style.border="thick solid #0000FF"; } function extend(str) { document.getElementById("extend").innerHTML=str; document.getElementById("extend").style.width="800px"; } </script> <?php error_reporting(E_ALL); mysql_connect("localhost", "root", ""); mysql_select_db("dictionary"); $words = mysql_query("SELECT * FROM words"); $q = strtolower($_GET['q']); $query = mysql_query("SELECT * FROM words WHERE word LIKE '%$q%' OR definition LIKE '%$q%'"); while ($row = mysql_fetch_assoc($query)) { $tags1 = "<div id=\"div\" onMouseOver='hover()'><b>"; $tags2 = "</b><br />"; $tags3 = "<br /><br /></div>"; $string1 = $row['word']; $string2 = $row['definition']; if (strlen($string2)>43) { $tags1 .= "<div id='extend' onMouseOver=\"extend(".$string2.")\">" . $tags1; $tags3 = $tags3 . "</div>"; $string2 = substr($string2, 0, 40); $tags3 = "...<br /><br /></div>"; } $string3 = str_ireplace($q, "<span class='highlight'>$q</span>", $string1); $string4 = str_ireplace($q, "<span class='highlight'>$q</span>", $string2); $string = $tags1 . $string3 . $tags2 . $string4 . $tags3; $string = strtolower($string); if (strlen($string)>25) { substr($string, 0, 25); } echo $string; } if (mysql_num_rows($query)==0) { echo "No words found"; } if ($q=="") { echo "Type a word"; } ?> and the index page: <html> <head> <script type="text/javascript" src="scripts.js"></script> <style type="text/css"> p { font-family:Arial,Helvetica,sans-serif; color: #FF4B2C; } a:link { color: #FF4B2C; } a:visited { color: #FF4B2C; } html { background-color: #2CE0FF; } h1 { color: #2C76FF; } #input { width: 700px; height: 55px; font-family: verdana; font-size: 35px; background: #A4EF9C url(a.png) no-repeat left -15px ; } #input:hover { background-color: #ffffff; } #input:focus { background: #ffffff url(a.png) no-repeat left -11125px ; } h1 { font-size: 50px; } div { } </style> </head> <body> <h1>The dictionary</h1> <form> <input type="text" id="input" onkeyup="showHint(this.value)" /> </form> <p> <div id="txtHint"></div> </p> <p> <a href="word.php">Make up your word now!</a> </p> </body> </html> and the ajax script: function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","gethint.php?q="+str,true); xmlhttp.send(); }
  8. i prefere to do it my self and i have got this so far: <?php error_reporting(E_ALL); mysql_connect("localhost", "root", ""); mysql_select_db("dictionary"); $words = mysql_query("SELECT * FROM words"); $a = array(); $count = 0; while ($row = mysql_fetch_assoc($words)) { $a[$count][] = $row['word']; $a[$count][] = $row['definition']; $count++; } $q = $_GET['q']; if (strlen($q) > 0) { $hint=""; foreach ($a as $entry){ if (substr($a[$count][0],0,strlen($q))) //line 19<<<<<<<<< { if ($hint=="") { $hint= "<strong>" . $a[$count][0] . "</strong><br /><em>" . $a[$count][1] . "</em>"; } else { $hint = $hint . "</b><br /><br /> <strong>" . $a[$count][0] . "</strong><br /><em>" . $a[$count][1] . "</em>"; } } } } // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint == "") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?> and i get the errors:
  9. this might come in use for you: http://betterphp.co.uk/playlist.html?pid=7413DDD1EB6A14BD
  10. function check_Price($price,$member_id,$description,$ip){ if (isset($price) && (!is_numeric($price))) { setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $price) . "\n"; } } should work
  11. take a look at this http://www.w3schools.com/php/func_string_money_format.asp
  12. im am creating a live search using the w3schools tutorial. apart from im using mysql. here is my current code(which works fine): <?php mysql_connect("localhost", "root", ""); mysql_select_db("dictionary"); $words = mysql_query("SELECT * FROM words"); $a = array(); while ($row = mysql_fetch_assoc($words)) { $a[] = $row['word']; } $q = $_GET['q']; if (strlen($q) > 0) { $hint=""; for($i=0; $i<count($a); $i++) { if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q)))) { if ($hint=="") { $hint=$a[$i]; } else { $hint = $hint . "</b><br /><br /> ".$a[$i]; } } } } // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint == "") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?> as you can see it is edited alot. But my problem is that i need to display underneath the word, the definition aswell. I've been trying to figure this out but i can't seem to do it. I have been trying to use multidimensional arrays.
  13. are you looking for a web scroller? i made one here: http://phpacademy.org/forum/website-spider-t6666.html you might want to change some of the code to what wide_load said
  14. put a backslash (\) before every quote like this: echo '<td width=\"300\" bgcolor=\"#ffffff\" align=\"center\" onmouseout=\"style.backgroundColor=\'#ffffff\'\" onmouseover=\"style.backgroundColor=\'#e8e8e8\';\" style=\"word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);\">\';
  15. this is hard to explain but how can you make it so as php executed the script it shows whats happening as it goes. An example of this is the google sitemap generator. it shows the url every time it finds a new one. Do you need to use ajax.
  16. i was just testing out my oop and wrote this myself <html> <body> <?php error_reporting("E_ALL"); class show { public function connect() { mysql_connect("localhost", "root", ""); } public function sel_db() { mysql_select_db("oop"); } public function get() { $query = mysql_query("SELECT * FROM ppl"); while ($row = mysql_fetch_array($query)) { echo $row['id'] . " | " . $row['name'] . "<br />"; } $num_rows = mysql_num_rows($query); echo $num_rows; } } $a = new show; $a->connect; $a->sel_db; $a->get; ?> </body> </html> but the query doesn't work. I don't get any errors. It will not show anything on the page. It is supposed to show all results from a table.
  17. Please inspect my site for any broken links that still go back to the co.cc one and i don't know if the home page design is too dull. Please give your comments. http://www.coolcodeforum.com
  18. It works fine for me . Is the site still under construction? Because none of the links work.
  19. You could try and use a meta tag to redirect after 0 seconds and put the analytics code first.
  20. yes. I was just wondering. I want do do it for fun to see how many web address it comes out with
  21. im currently using a program called Xenu to browse all of my websites links and report any broken ones. im just wondering if there is a program that doesn't just scroll the links from your site, but then keeps scrolling the other sites found.
  22. this might work <form method="post" id="myForm" action="someotherpage.php"> <input type="text" name="name" value="Value" /> <button type="submit" onload="this.form.submit()">Submit</button> </form>
  23. if you want to check if the url is valid then do something like this: <?php $url = $_SERVER['HTTP_HOST']; //get domain name of the url submitted if (stristr($url, "http://")) { //now do the same for www or co.uk, .com etc...... } else { die("url is not valid"); } ?>
×
×
  • 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.