Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Don't bump your post this soon! Remember that people viewing this board are based all over the world, mainly in the US, so many of them haven't even seen your post yet.    I think you should wait at least 4 hours before bumping your post. Now what exactly do you want?  If it's just a list of the Uni's then this will do it... [code]<?php // Open the file $fh = file_get_contents('http://www.collegebookx.com/text.txt'); // Define the pattern $pattern = '|blank">(.*?)</A>|'; // Match patern and place into an array preg_match_all($pattern, $fh, $matches); // Echo the list foreach ($matches[1] as $u){   echo "$u<br>\n"; } ?>[/code] Regards Huggie
  2. Maybe if you gave them longer than 10 minutes before re-posting they'd be more inclined to help Huggie
  3. Ted, if you don't know what fields are called then always print the contents of the array out... [code]<?php // Set the code and query the database $sql = "SELECT i.*, p.photo FROM userinfo i, usercus p WHERE i.username = p.username AND i.username LIKE '%$user%' AND i.gender = '$gender'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); // Echo the array to see what the columns are called... echo "<pre>\n"; print_r($row); echo "</pre>\n"; ?>[/code] Regards Huggie
  4. What OS are you running on? Regards Huggie
  5. Also look here for a reference... http://dk2.php.net/manual/en/ref.tokenizer.php Regards Huggie
  6. Yes, the username is a good example, so your query would look something like this... [code]<?php $sql = "SELECT i.*, p.photo FROM userinfo i, usercus p WHERE i.username = p.username AND i.username LIKE '%$user%' AND i.gender = '$gender'"; ?> [/code] This is assuming that your username column is related in both tables and that your photo column is in the usercus table and the gender column is in the userinfo table. Regards Huggie
  7. If the database is designed well, then the tables should be linked in some way.  So they should have a column in each table with related data.  Than you can use a SQL join. Do you have one? Regards Huggie
  8. Seamless, The GD library uses a lot of memory on an image that size.  The best bet is to leave the settings in php.ini as they were and change the value at runtime using [url=http://uk.php.net/manual/en/function.ini-set.php]ini_set()[/url]. So on each page you have GD functions, set this at the top: [code]<?php // Increase available memory ini_set("memory_limit","256M"); ?>[/code] I included a link in a previous post: http://www.phpfreaks.com/forums/index.php/topic,121661.0.html Regards Huggie
  9. I have no idea where you can get a db from but a quick google bought this site up... http://www.utexas.edu/world/univ/state/ Regards Huggie
  10. I had one at New Year, I believe it had an attachment, but it never made it to me, wouldn't open! Regards Rich
  11. Alpine, I don't think it's permanent, just like it until they've ironed out all the bugs 'post-upgrade' Regards Huggie
  12. Hey stu, Happy New Year... This is a host/server setup issue, I believe probably time-out related.  Check [url=http://dev.mysql.com/doc/refman/5.0/en/gone-away.html]here[/url] Regards Rich
  13. You only need to query the database once, [code]<?php // Assign username from session variable $username = $_SESSION['username']; // Query the database $query = "SELECT sex FROM members WHERE user_name = '$username'"; $result = mysql_query($query) or die ("could not find sex"); $row = mysql_fetch_array($result); // Stick the gender in a variable $gender = row['sex']; // Decide whether we're checked or not $male = if($gender == "male") ? 'checked="checked"' : ''; $female = if($gender == "female") ? 'checked="checked"' : ''; // Echo the form fields echo <<<HTML <input name="info_sex" type="radio" value="female" $female> <strong>A Female</strong><br /> <input name="info_sex" type="radio" value="male" $male> <strong>A Male</strong><br /> HTML; ?> [/code] Regards Huggie
  14. With that error, you can refer to the MySQL manual. Read [url=http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html]this article[/url] Regards Huggie
  15. Yes, they would cause a parse error... echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<?xml-stylesheet href="view_halls.xsl" type="text/xsl"?>'; The above should work...  Also, please put [nobbc][code]...[/code][/nobbc] tags around your code [code]<?php   // This is a lot nicer to read ?>[/code] Regards Huggie
  16. Nick, please use [nobbc][code]...[/code][/nobbc] tags around your code. As for what you do, it's up to you, it's always best to validate some how before doing anything with a value. Regards Huggie
  17. OK, and the form method is definitely POST and not GET? Huggie
  18. I believe the short answer is... It's checking the page you came from, and if it wasn't faq.php then it sends you there.  Quite useful to have on a contact page, to make sure people check your FAQ's first. Regards Huggie
  19. I assume you have a form element called [i]change[/i]? I'm also a fan of single quotes rather than double quotes in the [code=php:0]$_POST['change'][/code] variables :) Regards Huggie
  20. Check out the first paragraph on this page: [url=http://uk.php.net/manual/en/language.operators.string.php]String Operators[/url] Regards Huggie
  21. If MySQL abides by the same rules as oracle then you [color=red][b]MUST[/b][/color] have any columns that appear in the select statement, that aren't group functions, in the GROUP BY clause... [code]SELECT employee, department, AVG(salery) FROM employees GROUP BY employee[/code] The above will give an error, the query must look like this... [code]SELECT employee, department, AVG(salery) FROM employees GROUP BY employee, department[/code] I hope this helps Regards Huggie
  22. Yes, you just need to include them in the body, like this: [code]<?php // Here's the values from my form $fav_colour = $_POST['colour']; $fav_food = $_POST['food']; $fav_animal = $_POST['animal']; // Here's the to and subject fields $to = "myemail@mydomain.com"; $subject = "My Test Email"; // Here's the values from my form all combined into one message variable $msg .= "My favourite colour is $fav_colour\n"; $msg .= "My favourite food is $fav_food\n"; $msg .= "My favourite animal is $fav_animal\n"; // Send the message mail($to, $subject, $msg); ?>[/code] Regards Huggie
  23. Don't bother with the port just yet.  I connect to a remote server with this code: [code]<?php $user="my_username"; $pass="my_password"; $host="xxx.xxx.xxx.xxx"; // I just use the server IP address here, no port as it's the standard one (3306) $dbname="gallery"; $connection = mysql_connect($host, $user, $pass); if (!$connection){   echo "Could not connect to database: " .mysql_error(); } $founddb = mysql_select_db($dbname, $connection); if (!$founddb){   echo "Could not find DB: " .mysql_error(); } ?>[/code] Regards Huggie
  24. [quote author=bubblybabs link=topic=121672.msg501338#msg501338 date=1168440036] How's this?  Somewhat difficult to work with since it's already been altered... [img]http://www.fractalfairy.com/pack-o-peppers.gif[/img] [/quote] BB, I think you're really missing the point here... What Michael's probably saying is that his clients will be uploading many images from now and in the future, and if GD could do the work for him it would be a whole lot better than having to do it manually every time. Regards Huggie
  25. Just use an ORDER BY clause in your sql statement... [code] SELECT column_name FROM table_name ORDER BY numeric_column DESC [/code] 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.