Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. OK,  It's returning error1 because that's what you've told it to return... [code]$sqlname = mysql_query("SELECT * FROM guild WHERE guildname='$guildname'") or die("error1".mysql_error());[/code] It means that the call to mysql_query() is failing.  I'm assuming that header.php includes your database connect code.  If it does, can you post it here (but replace the username and password with asterisks). Regards Huggie
  2. Maybe you could tell us what the error is? Regards Huggie
  3. Give this a try... [code]<?php // Connect to your database include('connect.php'); // Define the query (using the GROUP BY feature, look it up in the MySQL manual) $sql = "SELECT DATE_FORMAT(START_DATE,'%Y%m') AS date, TEAM_ID as teamid FROM sf_team_player WHERE OLDCLUB_ID IS NOT NULL GROUP BY teamid ORDER BY date DESC, teamid"; // Execute the query or error $result = mysql_query($sql) OR mysql_error(); // Stick the results into a multi-dimensional array keyed on date while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   if (!isset($data[$row['date']])){       $data[$row['date']] = array($row['teamid']); // Assign the first item of the array   }   else {            array_push($data[$row['date']], $row['teamid']); // Assign additional items into the array   } } // This is here to show you the structure of the array echo "<pre>\n"; print_r($data); echo "</pre>\n"; ?>[/code] If you're not sure what any of it's doing then please ask. Regards Huggie
  4. HuggieBear

    mail

    [quote author=jwk811 link=topic=122603.msg505830#msg505830 date=1168923492] how do you do a copy to thing in the script when mailing? [/quote] I have no idea what the above is meant to mean, as for the BCC question, this can be included as an optional fourth parameter to [url=http://uk.php.net/manual/en/function.mail.php]mail()[/url] Regards Huggie
  5. HuggieBear

    mail

    It is possible, I'd imagine you need to look into the [url=http://uk.php.net/manual/en/ref.imap.php]IMAP functions[/url]. This isn't a simple task for a beginner.  Also, please include more descriptive titles in your post.  You've posted two messages on here both with a title of [i]'mail'[/i].  This isn't helpful to anyone. Regards Huggie
  6. If you're doing this as a little project to help you learn php, then might I suggest an import/export feature? This will give you an insight into parsing content, such as CSV files, maybe some regular expression work.  The export feature could include some XML work too :) I use something similar to import the contacts that I export from my mobile phone. Regards Huggie
  7. OK, this is now solved... I changed the configure command to the following to include a link to the math library... [code]LDFLAGS='-lm' ./configure --with-gd=shared --enable-gd-native-ttf --with-ttf[/code] and it worked perfectly. Thanks for your help shoz. Regards Huggie
  8. Thanks Shoz, I'm getting undefined symbol errors when trying to configure.  They're relating to 'pow' and 'fabs' and the problem is within the libpng.so I'm going to try from scratch again and see what happens. Regards Huggie
  9. I'm afraid I don't but try posting in the [url=http://www.phpfreaks.com/forums/index.php/board,6.0.html]Javascript forum[/url] that we have here at PHPFreaks Huggie
  10. You're right, I'm unable to recreate the problem.  Looking at what you have, I can see what you mean, but I can't see how it's likely to cause a problem.  Maybe your javascript 'tab_manager' function is at fault. Regards Huggie
  11. [quote author=mendoz link=topic=122099.msg503115#msg503115 date=1168612972] Let's see who got what it takes  :-* [/quote] How about you?!?!? Dror, I've helped you out before and I find the task you're requesting now very easy.  Have you attempted it yourself yet?  If not then perhaps give it a go and then post what you came up with here when/if you get a problem. Regards Huggie
  12. [quote author=Anidazen link=topic=122014.msg502582#msg502582 date=1168552571] I've got a script I've worked very hard on, and it's a commercial script - fetching prices from various sites while a user waits. [/quote] For starters you're getting data from other sites, so you're always going to be at the mercy of external constraints. You haven't posted any code (which I'm assuming is because it's a commercial script) so we can only assume, but if you're using fopen() to try and get remote pages then my first suggestion would be to forget that and change to use the CURL library.  This allows you to set a time-out and you can then act accordingly. Regards Huggie
  13. Try this:... [code]<?php while($row=mysql_fetch_row($rs)){   // loop and add <br> tags   foreach ($row as $k => $v){       $row[$k] = nl2br($v);   }   // echo the output   echo("<p class='pagetitle'><strong>" . $row[1] . "</strong></p>");          echo("<p>" . $row[2] . "<br>");   echo("<p>" . $row[3] . "<br>");                              }   echo("</p>"); ?>[/code] Also, as someone suggested nl2br() in a post further up, it's normally customary to investigate the [url=http://uk.php.net/manual/en/function.nl2br.php]manual for that function[/url] and then post your code with what you've attempted based on what you learned from the manual :) Regards Huggie
  14. [quote author=sazzie link=topic=122083.msg503037#msg503037 date=1168605560] can you suggest a way out? [/quote] If you're able to provide some code then we could look into this for you.  Don't forget to surround your code with [nobbc][code]...[/code][/nobbc] tags :) Regards Huggie
  15. No problem, like I said, if you take your time explaining things in the first instance then you'll get things resolved quicker and in this case maybe even offered some alternative code that will work more efficiently. Had I not have asked and just tried to understand what you were doing with your code, we'd have ended up with something similar to what you'd written that worked, but wasn't very effective. Regards Huggie.
  16. In that case you've misunderstood what require_once() actually does... Imagine this: [b]index.php[/b] [code]<?php require('connect.php'); require('header.php'); // Rest of the page code here... ?>[/code] [b]header.php[/b] [code]<?php require('connect.php'); // Rest of the page code here... ?>[/code] You can see here that connect.php is going to be called and loaded twice, once by index and once when header.php is called by index.  A 12k page has just become 24k of bandwidth.  But more importantly, you'll avoid variable redefinitions. By using require_once('connect.php') it will fetch/retrieve this page and if it comes across a require('connect.php') again, it won't attempt to retrieve it, knowing full well that it has it already.
  17. If you want to display it on the page, then you're better of using a client-side language like JavaScript, this will save you submitting the form every time something gets changed. That of course is assuming that amount1, amount2, and amount3 are all editable on the page that's displaying the values for them. Regards Huggie
  18. [quote author=redbullmarky link=topic=122076.msg503027#msg503027 date=1168604606] then please - instead of just getting others to write the code and others to patch them up, you do yourself many many many favours if you actually took the time to understand the code like the rest of us. not being rude, ted - just that almost 99% of every question you have is regarding someone elses script. [/quote] That's a little bit harsh... He's trying look: [quote author=ted_chou12 link=topic=122076.msg503020#msg503020 date=1168604014] thanks a lot, but some things inside looks brand new to me, like: {$row['message_id']} {$row['message_text']} [/quote] I don't suffer fools gladly, but I try my best to steer them on the right path at least twice before reprimanding them :) Regards Huggie
  19. [quote author=sazzie link=topic=122083.msg503024#msg503024 date=1168604470] How do you force a piece of php code to be called only once? [/quote] Only call it once :) How do you know it's being requested more than once? Regards Huggie
  20. As for where to put it, if you break down what I've provided, it's clearly just two blocks... One that selects and displays the rows and one that deletes them.  Try putting them in where you think and see if it works, if not then post back. Regards Huggie
  21. [quote author=ted_chou12 link=topic=122076.msg503020#msg503020 date=1168604014] thanks a lot, but some things inside looks brand new to me, like: {$row['message_id']} {$row['message_text']}[/quote] OK, it's just the way that I'm displaying the variables without exiting the echo... You're probably used to writing it like this... [code=php:0]echo '<input type="checkbox" name="id[]" value="' .$row['message_id']. '">' .$row['message_text']. '<br>';[/code] Regards Huggie
  22. Depending on your Linux distro, most of these are packaged as standard these days and the installers for them make things very simple, if however you want to do it all manually then give this a go... http://www.lamphowto.com/lamp.htm Regards Huggie
  23. OK, in that case I'd use a different method completely... I'd construct a sql string first of all and remove them that way... [code]<?php if (isset($_POST['delete'])){   if (!empty($_POST['id'])){       // turn the id array into a comma separated string       $id_list = implode(", ", $_POST['id']);       // Query to run       $sql = "DELETE FROM messages WHERE message_id IN ($id_list)";       mysql_query($sql);   } } // Select message list from database $sql = "SELECT message_id, message_text FROM messages WHERE user_id = '{$_SESSION['user_id']}'"; $result = mysql_query($sql); // Echo the messages and checkboxes while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   echo "<input type=\"checkbox\" name=\"id[]\" value=\"{$row['message_id']}\"> {$row['message_text']}<br>\n"; } // Echo the submit button echo "<input type=\"submit\" name=\"delete\" value=\"Delete\">\n"; ?>[/code] You could use a foreach() loop or a while() loop, but this way is more efficient as it only queries the database with the delete code once. Regards Huggie
  24. OK, If I understand it correctly, what you want to do is present multiple rows on a page, e.g. member list, each member has a check box next to their name and I can select the boxes and press the delete button at the bottom of the page to remove them from the database? Regards Huggie
  25. Is it occurring the first time the page is loaded, or after the form has been submitted? Regards Huggie
×
×
  • 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.