matthew9090
-
Posts
135 -
Joined
-
Last visited
Never
Posts posted by matthew9090
-
-
This is not just on php or a specific language, it is for all others and anyway im only 13.
-
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.
-
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.
-
Thanks for that. I need other people to review my site first so i can make further changes.
-
Hey!
echo "<ol type=\"a"\>";
This gives an error, how am I supposed to escape the " " correctly?
echo "<ol type=\"a\">";
you got backslash in wrong place
edit: sorry didn't see other posts
-
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(); }
- There are 2 divs ontop of each other which makes some borders thicker than the other
-
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:
Notice: Undefined offset: 5 in E:\wamp\www\dictionary\gethint.php on line 19
Notice: Undefined offset: 5 in E:\wamp\www\dictionary\gethint.php on line 19
Notice: Undefined offset: 5 in E:\wamp\www\dictionary\gethint.php on line 19
Notice: Undefined offset: 5 in E:\wamp\www\dictionary\gethint.php on line 19
Notice: Undefined offset: 5 in E:\wamp\www\dictionary\gethint.php on line 19
-
this might come in use for you: http://betterphp.co.uk/playlist.html?pid=7413DDD1EB6A14BD
-
Hi Matthew Not sure how to incorporate that with my code.. Please advise
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
-
-
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.
-
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
-
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);\">\';
-
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.
-
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.
-
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.
-
It works fine for me . Is the site still under construction? Because none of the links work.
-
You could try and use a meta tag to redirect after 0 seconds and put the analytics code first.
-
yes. I was just wondering. I want do do it for fun to see how many web address it comes out with
-
what company is it?
-
i use echo
-
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.
-
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>
-
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"); } ?>
my forum
in Website Critique
Posted
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 .