Jump to content

ricky_vancouver

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by ricky_vancouver

  1. Hail, People, I'm looking for some informations.. I wish to open my own business, a Lan House (Cyber Coffee, and others name around the world).. But, how to start? About the most played games.. I think it's easy to discover, but what is "cool"? What kind of place is the most wanted.. what inside it? Just the computers around or with somekind of "foods and drinks"? And the machines? System requeriments? What kind of local server? Windows? Unix? System requeriments of both, client and server machines.. what is great (cost/benefit)? Hmm.. don't know much more ideas to say.. i really need help. =) Oh, the control program.. I don't know these progs.. Sorry for 'my bed english', I'm learning this language yet.. to read is easy, but to write it's so hard.. =) Thank you all! \o/
  2. Notepadd++ seems to be one of the most popular here.
  3. This is a simply drop down box with three selections, one, two and three. while i try to select option two, i need a message box pop up showing two, if i select option three, the message box will show three. However i got the below error while i select it. Any problem with this simple codes ? Error: 'document.form1.select.value' is null or not an object ================================================================== <? print_r($_POST); print"<br>"; print_r($_GET);print"<br>"; $a = $_GET[select]; print $a; ?> <select name='select' onchange='go(this)'> <option value='one'>one</option> <option value='two'>two</option> <option value='three'>three</option> </select> <form name='form1'> <input type='hidden' name='txtSelect' value='select'> </form> <script type="text/javascript"> function go(opt) { var name = document.form1.select.value; alert (name); } </script>
  4. As in 6'2, I want to be find strings of the form: 6 6'2 6'22 (I suppose I'd like up to two decimal points) 6.2 (for those stubborn people who use odd punctuation) 6,2 (for those stubborn people who use odd punctuation) 6 2 (for those stubborn people who use odd punctuation) I have the following expresssion /^[1-9]?((.|,|\'|\s)([0-9]{1,2}))$/ However while it successfully matches the above it also matches 6666 666 66 Now I can see where perhaps three digits come from, though I'm not sure why it didn't demand something from the punctuation group, but I don't clueless as to how there could be 4 digits. Any help plucking out these faulty matches would be much appreciated!
  5. hey everyone, I'm having trouble using the having clause... here's my situation: I have a table of users, and the date they joined... I want data of the users who signed up in the last 7 days before the last user signup... so my sql statement looks something like this: SELECT * from userlist HAVING created_date <= max(created_date) and created_date >= (max(created_date) - (7 * 24 * 60 * 60)) it either returns everything in the table, or nothing... have be head over heels... thanks for your help...
  6. Hello. I am using forms, and i am getting large edit boxes for some reason...i can;t quite understnad....does anyone know how to shink them down? they are to big vertically....and i donno how to make it smaller even though i got row set to 1. <form method="post" name="idform"> <table align="center" width="550" border="0" cellpadding="2" cellspacing="1"> <tr> <td height="20" width="100">First ID:</td> <td> <textarea name="id1" cols="40" rows="1" id="id1"></textarea></td> </tr> <tr> <td width="100">Last ID:</td> <td> <textarea name="id2" cols="40" rows="1" id="id2"></textarea></td> </tr> <tr> <td width="100"> </td> <td> <input name="btnId" type="submit" id="btnId" value="Load Products""> </td> </tr> </td> </tr> </table> </table> </form>
  7. I am trying to display the contents of a mysql table in descending order by "id". The script works fine until I add in the ORDER BY to the query. You can see below that I have the ORDER BY coded only if $category = hand, so I get an error now if category = hand, but not if category = baby or if cat = makeup. // how many rows to show per page$rowsPerPage = 6; // by default we show first page$pageNum = 1; $category = $_GET['category']; // if $_GET['page'] defined, use it as page numberif(isset($_GET['page'])){ $pageNum = $_GET['page']; } // counting the offset$offset = ($pageNum - 1) * $rowsPerPage; if ($category == "hand"){$query = "SELECT price, title, id FROM tm_inventory WHERE category='hand' ORDER BY id DESC"; } elseif ($category == "baby"){$query = "SELECT price, title, id FROM tm_inventory WHERE category='baby'"; } elseif ($category == "makeup"){$query = "SELECT price, title, id FROM tm_inventory WHERE category='makeup'"; } $pagingQuery = "LIMIT $offset, $rowsPerPage"; $result = mysql_query($query . $pagingQuery) or die('Error 1, query failed'); // print the inventory info in tableecho '<table border="0" cellpadding="2" cellspacing="0">'; while($row = mysql_fetch_array($result)){ $row2 = mysql_fetch_array($result) or $row2['id'] = "1" and $row2['title'] = " "; $row3 = mysql_fetch_array($result) or $row3['id'] = "1" and $row3['title'] = " "; printf("<tr><td align='center'> <img src=\"image3.php?id=%s\" width='150'><br> %s <br> %s </td> \n", $row["id"], $row["title"], $row["price"]); printf("<td align='center'> <img src=\"image3.php?id=%s\" width='150'><br> %s <br> %s </td> \n", $row2["id"], $row2["title"], $row2["price"]); printf("<td align='center'> <img src=\"image3.php?id=%s\" width='150'><br> %s <br> %s </td></tr>", $row3["id"], $row3["title"], $row3["price"]); }echo '</table>'; echo '<br>'; // how many rows we have in database$result = mysql_query($query) or die('Error 2, query failed'); $numrows = mysql_num_rows($result); // how many pages we have when using paging?$maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page oneif ($pageNum > 1){ $page = $pageNum - 1; $prev = " <a href=\"$self?category=$category&page=$page\">[Prev]</a> "; $first = " <a href=\"$self?category=$category&page=1\">[First Page]</a> "; }else{ $prev = ' [Prev] '; // we're on page one, don't enable 'previous' link $first = ' [First Page] '; // nor 'first page' link}// print 'next' link only if we're not// on the last pageif ($pageNum < $maxPage){ $page = $pageNum + 1; $next = " <a href=\"$self?category=$category&page=$page\">[Next]</a> "; $last = " <a href=\"$self?category=$category&page=$maxPage\">[Last Page]</a> "; }else{ $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link}// print the page navigation link//echo $first . $prev . " Page <strong>$pageNum</strong> of <strong>$maxPage</strong> " . $next . $last; echo $prev . " Page <strong>$pageNum</strong> of <strong>$maxPage</strong> " . $next; [a href=\"http://root.danielforsyth.com/mysql/image_upload/view5.php?category=hand\" target=\"_blank\"]http:// Here are some links so you can see what happens: [a href=\"http://root.danielforsyth.com/mysql/image_upload/view5.php?category=hand\" target=\"_blank\"]http://root.danielforsyth.com/mysql/image_...p?category=hand[/a] [a href=\"http://root.danielforsyth.com/mysql/image_upload/view5.php?category=baby\" target=\"_blank\"]http://root.danielforsyth.com/mysql/image_...p?category=baby[/a] Please tell me how to fix this - thanks
  8. Hey guys and gals, Here's my problem. I just finished programming an online game and I have some php script that generates xml files. Well, to do this, I type in the address of the file on the server and pass it to variables in the addressbar. It then queries a database and does everything fine and dandy. Problem is, I need it to do that automatically. I cannot be sitting at my computer 24-7 typing stuff in the address bar. Is there a way I can run the php script and pass those variables automatically?
  9. Hello, I've been assigned the task of creating an internal site for our office that has links to all the websites we use as well as the applications we use. I'm very comfortable using php with mysql for handling forms and displaying database information but I'm not sure how to go about this. So my question is, is there anyway I can use php to open an exe file?
  10. The quick version: I want to put a point/experience program on my site. Every 10 points (or so) your level goes up one. What would be the best way to do this? Is there a way to check and see if the points are an equivalent of 10? Cause that would be the ideal option. Thanks for any help!
  11. I think it is probably something simple I am missing, I am fairly new to PHP and am putting together a page while doing different experimentation with the language. My problem is that I have a user input for two numbers from a drop down menu. $number1 is the variable from the first menu $number2 is the variable from the second menu $total = $number1 - $number2; However, I always seem to get $total = $number1 It completely ignores the subtraction. I.E. If $number1 is 15 and $number2 is 4 Hitting the send button will get $total = 15 and not the expected value of 11.
  12. Here you go. Adjust this code for your convenience. Create main html (index.html) and use this code alone. <script> if (screen.width <= 640) { alert("Sending you to a page appropriate for screen resolution 640x480."); document.location = "index640x480.html"; } else if (screen.width <= 800) { alert("Sending you to a page appropriate for screen resolution 800x600."); document.location = "index800x600.html"; } else if (screen.width <= 1024) { alert("Sending you to a page appropriate for screen resolution 1024x768."); document.location = "index1024x768.html"; } else if (screen.width <= 1152) { alert("Sending you to a page appropriate for screen resolution 1152x864."); document.location = "index1152x864.html"; } else if (screen.width >= 1152) { alert("Sending you to a page appropriate for screen resolution bigger than 1152x864."); document.location = "index_largest.html"; } </script>
  13. It is possible ! You can use the HTML code on this page to force a link to open in a new window. <a href="http://www.google.com" target="_blank">Google</a>
  14. I just was learning preg_match from the manual and i see that theres littile changes to eregi so what can preg_match do what eregi can not. <? $match="my little home"; if(preg_match("/little/",$match)) { echo "matched"; }else{ echo " no match"; } ?> <? $match="my little home"; if(eregi("little",$match)) { echo "matched"; }else{ echo " no match"; } ?>
  15. referring again with to the restaurant db. I want to calculate the total price for the order. how can I calculate the total price of an order..I know its 'amount' x 'quantity' but how to code this..
  16. Hey long time no post So my problem, i am developing a grading system for my college and a function i wrote to work out the grade for the course is based on there current system but modified to be more flexible. The problem is is that i don't know if my maths is correct in it, and have no way to reliably test it. So, the function function WorkOutYearGrade($ProgID){ $ProgID = SecureVar($ProgID); $sql_check = mysql_query("SELECT * FROM student_grade WHERE program_id = '".$ProgID."' AND PSN = '".$_SESSION['PSN']."'"); if(mysql_num_rows($sql_check) != 0) { $sql = mysql_query("SELECT id FROM units WHERE program_id = '".$ProgID."'"); $distinction = 0; $merit = 0; $pass = 0; while($rows = mysql_fetch_assoc($sql)) { $grade = work_out_grade_average("program",$ProgID,$rows['id']); if($grade == "Pass") { $pass += (6 * mysql_num_rows($sql)); } elseif($grade == "Merit") { $merit += (12 * mysql_num_rows($sql)); } elseif($grade == "Distinction") { $distinction += (18 * mysql_num_rows($sql)); } } $points = round(($distinction) + ($merit) + ($pass)); $ExpPoints_d = 18 * mysql_num_rows($sql); $ExpPoints_m = 12 * mysql_num_rows($sql); $ExpPoints_p = 6 * mysql_num_rows($sql); $dist = $ExpPoints_d + $ExpPoints_m + $ExpPoints_p; $merit = $ExpPoints_m + $ExpPoints_p; $pass = $ExpPoints_p; if($points == 0) { return "<span style=\"color:red;\">R</span>"; } else { switch($points) { case $points >= $dist; return "DDD"; break; case $points >= $merit + (48 * mysql_num_rows($sql)); return "DDM"; break; case $points >= $merit + (24 * mysql_num_rows($sql)); return "DMM"; break; case $points >= $merit; return "MMM"; break; case $points >= $pass + (48 * mysql_num_rows($sql)); return "MMP"; break; case $points >= $pass + (24 * mysql_num_rows($sql)); return "MPP"; break; case $points >= $pass; return "PPP"; break; default; return "<span style=\"color:red;\">R</span>"; break; } } }} It is based on their point system which is: a pass = 6 a merit = 12 a distinction = 18 The point system the college was using is based on having 18 units where as mine is dynamic and based on how many units there are. Direct from their spreadsheet system:
  17. I'm a newbie taking a class working on this problem. Which I've got up until the last part. I've got a form with 3 fields; all numbers. So, I type in 3 numbers and then the form is sent to a php page. Here's where my issue comes in; using a loop, I need to calculate the least comon denominator between the middle number and largest number. I know how to get the largest number; $largestNum = (max($num1, $num2, $num3)); Where I'm stumped is how to get the middle number. I think I know the logic but can't figure out how to implement it. Here's what I think I need to do: Create a While loop that finds the largest and smallest variables, and then use the one that is NOT them. Then make it a variable and multiply it times the max value ($largestNUm from above). Am I on the right track? Thanks!
×
×
  • 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.