Jump to content

ozestretch

Members
  • Posts

    237
  • Joined

  • Last visited

Everything posted by ozestretch

  1. Now you get to use GROUP BY <?php $query = " SELECT admin_id, server_id, nickname, hostname FROM amx_amxadmins a, amx_serverinfo s, amx_admins_servers c WHERE c.admin_id = a.id AND c.server_id = s.id AND a.id = c.admin_id GROUP BY a.nickname"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<tr><td>".$row['nickname']."</td>"; if($row['server_id'] == "1"){ echo "<td><img src='http://xxx.net/yes.gif' alt=''></td>"; } else { echo "<td><img src='http://xxx.net/mo.gif' alt=''></td>"; } echo "</tr>"; }?>
  2. Just to note, I added those extra 3 queries for you to see it was working... you may not actually need that in a working environment.
  3. I changed it... not sure what I was doing in first one, sorry. <?php mysql_connect("domain","user","user") or die("Couldn't connect"); $theidyouspecify ='';// define this as the id you specify $sql = "DELETE FROM worksheets WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "DELETE FROM calls WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "DELETE FROM customers WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "SELECT `id` FROM `worksheets` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $num=mysql_numrows($result); if ($num<1) { echo 'Worksheets entry deleted<br />'; }else{ echo 'failed to remove from worksheets table<br />'; } $sql = "SELECT `id` FROM `customers` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $num=mysql_numrows($result); if ($num<1) { echo 'customers entry deleted<br />'; }else{ echo 'failed to remove from customers table<br />'; } $sql = "SELECT `id` FROM `calls` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $num=mysql_numrows($result); if ($num<1) { echo 'calls entry deleted<br />'; }else{ echo 'failed to remove from calls table<br />'; } ?> <form name="id" method="POST" action="<?=$PHP_SELF;?>"> Enter worksheet id to delete ($worksheetnum) <input name="name" type="text" id="name" size="40"> <INPUT TYPE="submit"></form>
  4. nl2br() will do just that my reg expresions is not great.. but are you counteracting it here: $pre2[$x] = preg_replace("/\s*<br[^>]*?>\s*/", "", $pre1[0][$x]);
  5. Well 2 options I guess. [*]Change one input to a different name, then insert both values into the field required <input type="text" name="keywordtext" /><select name="keywordselect"><option>David</option></select> INSERT INTO `mytable` (keywords) VALUES ($_POST['keywordtext']."".$_POST['keywordselect']); [*]Create an array from keywords like <input type="text" name="keywords[]" /><select name="keywords[]"><option>David</option></select> INSERT INTO `mytable` (keywords) VALUES ($_POST['keywords'][0]."".$_POST['keywords'][1]);
  6. ehp .... before printed whitespace
  7. Your query seems it will not get those over 1 day, therefore can not display anything for them. If is a larger database, maybe limit timeframe to a week or however long the actual auction is live for, or if you have a status field for active/ended etc.. Try the query getting all data, then checking time offset in the while statement printing the different results as you require?
  8. I assume nicks with more than 1 'a.id' only display once? GROUP BY will do that. Why do you need GROUP BY?
  9. Depends. Is the order for script on the same domain? If so calling the session variable you want will be enough. If it is on a different domain, then POST or GET method should be used.
  10. unless of course your query is the fact it is a query string? in which case is still the same file/page... and if that page does not know those queries (more than likely a .htaccess thing. ) then it will display the page with its 'defaults'
  11. Is not really a php related question... Those links you provide will not be a 404 as the actual page exists the server reads "index.php" as a file, not a folder... so no amount of slashes will convince it otherwise
  12. <?php mysql_select_db("worksheets",$db) or die("Couldn't select database"); $theidyouspecify ='';// define this as the id you specify $sql = "DELETE FROM worksheets WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "DELETE FROM calls WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "DELETE FROM customers WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); $sql = "SELECT `id` FROM `worksheets` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $worksheet = mysql_fetch_row($result); if (!$result) { echo 'Worksheets entry deleted<br />'; }else{ echo 'failed to remove from worksheets table<br />'; } $sql = "SELECT `id` FROM `customers` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $customers = mysql_fetch_row($result); if (!$result) { echo 'customers entry deleted<br />'; }else{ echo 'failed to remove from customers table<br />'; } $sql = "SELECT `id` FROM `calls` WHERE `id` = '$theidyouspecify'"; $result = mysql_query($sql); $calls= mysql_fetch_row($result); if (!$result) { echo 'calls entry deleted<br />'; }else{ echo 'failed to remove from calls table<br />'; } ?> This will delete from all 3 tables (calls, worksheets & customers)
  13. This really depends on how you have the tables set in the database. You can do simple maths in the sql query itself, see: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html ; or http://www.tizag.com/mysqlTutorial/mysqlsum.php
  14. no worries, remember to click solved if sorted
  15. It wasn't displaying 'old' results... as the search term was not defined, it returned ALL results (I assume) Use the code I gave above and test it
  16. where are you defining $username? $find and $term are not being used!? Should they define $username? <html> <head> <title>Guid Search</title> </head> <body> <form action="search.php" method="post"> Search Your GuiD: <input type="text" name="username" /><br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> <?php mysql_connect ("l*******", "****","****") or die (mysql_error()); mysql_select_db ("******"); $find = $_POST['username']; $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); $sql = mysql_query("select * from users where username like '%$find%'"); while ($row = mysql_fetch_array($sql)){ echo '<br/> GuiD: '.$row['name']; } mysql_free_result($sql); ?>
  17. Am unsure the issue? http://www.phpfreaks.com/forums/index.php/topic,269829.0.html/test/does/not/exist/
  18. email() function params: mail($to, $subject, $message, $headers); <?php $name = $_REQUEST ['name'] ; $email = $_REQUEST ['email'] ; $what = $_REQUEST ['what'] ; $headers .= 'From: '.$name.' <'.$email.'>' . "\r\n"; mail( "sunny@sunny-shah.co.uk", "free quote", $what, $headers ); header( "Location: http://sunny-shah.co.uk"); ?>
  19. I was out of ideas at post#66 from me.... you posted with success on post #666 was it line 6 that was causing the issues? haha Glad you got it... what was it? PEBKAC?
  20. <?php mysql_select_db("worksheets",$db) or die("Couldn't select database"); $theidyouspecify ='';// define this as the id you specify $sql = "DELETE FROM worksheets WHERE id='$theidyouspecify' LIMIT 1"; mysql_query($sql); ?>
  21. I would think this belongs in the AJAX forum http://www.phpfreaks.com/forums/index.php/topic,269826.0.html
  22. have you run the above code on its own page? I have and it executes the way it should. If so then I am out of ideas. Good luck
  23. <?php if($you=='no idea'){ echo 'a question with detail'; }else{ header("Location: http://www.php.net"); } ?>
×
×
  • 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.