Jump to content

turbocueca

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

turbocueca's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for your help. The DB is created and the file is created but now I don't know how to call the download.
  2. How can I make a downlaod hit counter with PHP? I want to know how many downloads the people do on ym website. Thanks before.
  3. Dont bother replying, I figured out I have many problems in my code that doesn't let this work properly.
  4. [code]<?php     if (isset($_POST['query'])) {                 $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM usbextreme WHERE name LIKE '%$query%' OR system LIKE '%$query%' OR postedby LIKE '%$query%'"),0);                 if ($total_results!=0) {                 echo '<span class="style79">Searched results:</span> <span class="style80">'.$total_results.' - <a href="index.php">Reset</a></span'; } else { echo '<span class="style79">No results</span> - <a href="index.php">Reset</a>'; } }                      elseif (isset($_POST['select'])) {                 if ($_POST['select']="today") {                 $now=date(dmy);                     $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM usbextreme WHERE ins_date LIKE $now"),0);                 if ($total_results!=0) {                 echo '<span class="style79">Filtered results:</span> <span class="style80">'.$total_results.' - <a href="index.php">Reset</a></span>'; } else { if (!isset($_POST['select'])) { echo '<span class="style79">No results</span> - <a href="index.php">Reset</a>'; } } } }                                  else {                 $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM usbextreme WHERE system LIKE '$filter' OR work_status LIKE '$filter'"),0);                 if ($total_results!=0) {                 echo '<span class="style79">Filtered results:</span> <span class="style80">'.$total_results.' - <a href="index.php">Reset</a></span>'; } else { echo '<span class="style79">No results</span> - <a href="index.php">Reset</a>'; } } ?> [/code] [a href=\"http://infocenter.awardspace.com/inter/ps2ub/index.php\" target=\"_blank\"]http://infocenter.awardspace.com/inter/ps2ub/index.php[/a] If you enter this link, you will find something at the bottom of the page like this "No results - Reset", that shouldn't be there without searching the db or using the filter. For any reason, I'm not being able to make it disappear. Please check the code.
  5. I get a result from a database , for example "hello", and i put it in a variable, how can I limit the number of chars to 3? changing the variable value automatically to "hel" ?
  6. How to limit a field's char length using PHP without changing anything to the db atributes?
  7. Hello again. Now that the basics of my dynamic page are done I want to improve some things. [a href=\"http://infocenter.awardspace.com/inter/ps2ub/index2.php\" target=\"_blank\"]http://infocenter.awardspace.com/inter/ps2ub/index2.php[/a] The pagination here works properly. However when doing a search on the database the pagination doesn't work properly anymore. It writes the number of pages fine but when clicking in one of those pages, it returns to the whole database and shows the page that has been clicked but of the whole database and not from the search. Please test it and tell me how to make this work properly please. Thanks before.
  8. problem solved, had '%query%' instead of '%$query%'
  9. [b]A code that works:[/b] [code]<form method="POST" action=""> Search Word: <input type="text" name="query"> <input type="SUBMIT" value="Search!"> </form> <? include 'db.php'; if (isset($_POST['query'])) { $result = mysql_query("SELECT name,system FROM usbextreme WHERE name LIKE '%$query%'") or die (mysql_error()); while(list($column1, $column2)=mysql_fetch_array($result)){ echo "Result: $column1, $column2 <br />"; } } ?>[/code] [b]My code:[/b] [code]<form method="POST" action=""> Search:<input type="text" name="query"> <input type="SUBMIT" value="Search!"> </form> <?php    if (isset($_POST['query']))         {         include 'db.php';         $execute=mysql_query("SELECT name,system,work_status,postedby,comments FROM usbextreme WHERE name LIKE '%query%'") or die (mysql_error());         while (list($name,$sys,$stat,$user,$comment)=mysql_fetch_array($execute))         {         echo "$name   $sys   $stat   $user   $comment";         }         } else         {         echo "You didn't press the button!";         } ?>[/code] Can someone please tell me what's wrong with my code, 'cause it doesn't search anything.
  10. no problem thanks. I managed to get the page working. Just added two ' on the search string.
  11. Here is what happen: [a href=\"http://infocenter.awardspace.com/inter/ps2ub/search.php\" target=\"_blank\"]http://infocenter.awardspace.com/inter/ps2ub/search.php[/a] [code]<html> <head><title>ola</title></head> <body> <form method="POST" action=""> Search Word: <input type="text" name="query"> <input type="SUBMIT" value="Search!"> </form> <? include 'db.php'; // PHP Search Script $result = mysql_query("SELECT name, work_status FROM usbextreme WHERE name LIKE '". $_POST['query']. "' OR work_status LIKE '". $_POST['query']. '"') or die (mysql_error()); while(list($column1, $column2)=mysql_fetch_array($result)){ echo "Result: $column1, $column2 <br />"; } ?> </body> </html>[/code]
  12. just let me eat somethin' and i'll test the code
  13. whats this? : Parse error: parse error, unexpected '\"' in /home/www/infocenter.awardspace.com/inter/ps2ub/search.php on line 50 [code]$sql = mysql_query("SELECT name, work_status FROM usbextreme WHERE name LIKE "" . $_POST['query'] . "" OR work_status LIKE "" .$_POST['query'] . """) or die (mysql_error());[/code] Note: I did the first way and mysql said something about the syntax, then I tried with the way justin16l told and it gave this error.
  14. cool, where can i find a simple tutorial to search mysql results?
  15. Yeah the manual said the same thing, but is this too important ?
×
×
  • 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.