Jump to content

Lytheum

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by Lytheum

  1. for($i = 0;$i < 10;$i++) { $happy["$i"] = 'I am so Happy'; } echo $happy['1']; echo $happy['5']; Seems easier to me lol.
  2. Which phpMyAdmin version are you using? I'm using 2.9.1.1 and when my table is selected on the left, it is the third link on the top menu named 'SQL'. Then, enter the query into the area where it says "Run SQL query/queries on database". Hope that helps..
  3. Look for the portion of your script that has to do with sending the email. Most likely something like "mail($to, $subject, $body, $headers)". Then look to see if there is already something in your code declaring the variable $headers. If not, right above the mail() function, add this: // To send HTML mail, the Content-type header must be set $headers&#160; = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; It would be a good idea to show us your mail(); function and any variables that seem to be used by it.
  4. Basicly run this query on the table that you want, modifying the column names to your liking: CREATE FULLTEXT INDEX full_index ON mytable( mytable_title , mytable_caption , mytable_full_body ); You should only use the columns that you want to be searched.
  5. Try this: <form action="editsite.php" method="get"> <input type="submit" value="Edit Site" /> <input type="hidden" name="site_id" value="<? echo "$site_id"; ?>"> </form>
  6. What does your menu.php file look like? I think it is trying to use a piece of information that it can't find, probably because it's calling it from another directory. For instance: Root - menu.php (stylercss.css) --BASE about.php (include menu.php) Instead of stylercss.css, it will be try to use /BASE/stylercss.css. See what I mean? Same thing with your logo on the about page. It is trying to view it from /root/BASE/logonew.JPG when it should just be /root/logonew.jpg
  7. Plenty of tutorials about this on Google. Although it seems it is more of a Javascript thing. http://www.moock.org/webdesign/javascript/popupwindows/loadurlinparent.html
  8. Do you have two separate tables from which you are trying to cross-reference? 'video' and 'registered_users'? That's the impression I got from the first post, but in the latter ones you stopped using the 'registered_users' table. Maybe I'm wrong.
  9. You need to put the data that you extracted from the database in an array. Example: while($row= mysql_fetch_array($result)){ $productname = $row['ProductName']; $description = $row['Description']; $unitprice = $row['UnitPrice']; $inventory = $row['Inventory']; $catid = $row['CatID']; $subcatid = $row['SubCatID']; $smallimg = $row['SmallIMG']; $largeimg = $row['LargeIMG']; echo "$productname"; echo "$description"; echo "$unitprice"; echo "$inventory"; echo "$catid"; echo "$subcatid"; echo "$smallimg"; echo "$largeimg"; }
  10. $sql =SELECT video.id, title, description_text, category_text, level_text, user_name, FROM video WHERE video.user_id = registered_users.id and DATE_SUB(CURDATE(),INTERVAL - 2 DAY) <= date ORDER BY id DESC; Remove the comma that I colored. Not sure if this would cause an error though
  11. $firstzip = $_POST['zipcode1']; $secondzip = $_POST['zipcode2']; $query = "SELECT * FROM table_name WHERE zip_code = '$firstzip'"; $query = mysql_query($query) or die("MySQL Error"); $row = mysql_fetch_array($query); $latitude1 = $row['latitude']; $longitude1 = $row['longitude']; //Gets info from database about the first zipcode entered (lati, long, etc) $query2 = "SELECT * FROM table_name WHERE zip_code = '$secondzip'"; $query2 = mysql_query($query2) or die("MySQL Error"); $row2 = mysql_fetch_array($query2); $latitude2 = $row2['latitude']; $longitude2 = $row2['longitude']; //Gets info from database about the second zipcode entered (lati, long, etc) That will get your $lat1, $lon1, $lat2, and $lon2. Am I on the right path??
  12. function get_rand_id($length) { if($length>0) { $rand_id=""; for($i=1; $i<=$length; $i++) { mt_srand((double)microtime() * 1000000); $num = mt_rand(1,36); $rand_id .= assign_rand_value($num); } } return $rand_id; } Usage: $id = get_rand_id(24); // Returns random 24 character string.
  13. function spamcheck($text,$nr=10) { $spamtext=explode(" ",trim($text)); $newtext=array(); foreach($spamtext as $k=>$txt) { if (strlen($txt)>$nr) { $txt=wordwrap($txt, $nr, "-", 1); } $newtext[]=$txt; } return implode(" ",$newtext); } So.. $spam = 'Spaaaaaaaaaaaaaaaam'; spamtext($spam); Would Return -> "Spaaaaaaa- aaaaaaaam" Just trying to help ($nr is how many characters you want it to detect)
  14. Did you make that template yourself? If not - where did you get it? I really am looking for something sort of like it (not exact).
  15. Wow, people are so dense. It works like a charm. People just need to learn how to read!
  16. Thanks again dude, you've been great!
  17. As an edit to this, I'd like it to display something such as: You can not post another comment for (5) minutes, where (5) is a variable telling them how long they have until they can post again. So something like a now() - posttime ? The thing is, how can I do it with php rather than mysql, because I don't plan on entering it into the DB. And php's time() function is a bit different than the now(). Will it work if I use time() and make it exactly like the Datetime field (0000-00-00 00:00:00) and then do arithmetic operations on it?
  18. Awesome Barannd, just what I was looking for. I knew there would be a straight-forward way to do it. Thanks for the help, appreciate it. Thanks JakeD for the help. It seemed you were on the right path, but Barand posted a better way.
  19. In my comments system, I'm trying to restrict people to only post comments within 10 minutes from each other. So basicly what I did was make a table in a database, and when someone posts, it adds the current time to a field called "firstdate" and a time 10 minutes from now to a field called "lastdate". Now the problem is, I do not know how to compare those dates. Most likely because I used a DateAdd() function that I found on the net, and the return value is in this format: $temptime = time(); $firstdate = strftime('%Hh%M %A %d %b',$temptime); // Would return 013h25 Sunday 25 Mar $temptime = DateAdd('n',10,$temptime); $lastdate = strftime('%Hh%M %A %d %b',$temptime); // Would return 13h35 Sunday 25 Mar Does anybody understand what I'm asking for? Maybe a solution beyond all of this, an easier way if it's possible.
  20. Just need help with a few things. I have a comments system. In this comment system, people can enter certain strings, and it will break my page layout. Such as repeated characters with no spaces. It will just blow the table way out of proportion and completely ruin my layout. How can I break their input up if such a thing happens? Also, how can you number an array of data that is being withdrawn from the database DESC? Such as.. Thanks for any help!
  21. Does anyone know if there is a source/tutorial already written to generate a dynamic windows tree menu? (Example: http://www.phpguru.org/static/treemenu.html) I tried tying opendir() in with the free source on that webpage but I had no luck. Like I could designate a directory as a variable, and it will show everything in it, like this: [quote] -Main (Main Directory)   -Sub (Folder within Main directory))   ...File1  (File within the Sub folder)   ...File2 (etc..) [/quote] Sorry if I'm not being clear or it doesn't belong here, my excuse is as always, it's late.
  22. Thanks so much. Exactly what I needed. -solved-
  23. I need helping using this function to find some numbers out of a string of html. The html is the following: [code] <div class="mainscroll-content"><table cellpadding="3" cellspacing="0" border=0> <tr> <td align="left"><a href="overall.ws?table=0&user=zezima">Overall</a></td> <td align="right">2</td> <td align="right">2164</td> <td align="right">554,475,897</td> </tr></table></div>[/code] Now, I need to find out what is between the first <td></td>, 2nd, 3rd, and fourth - all dynamically (I don't know the numbers yet, this is an example. This is how I have started it: [code]preg_match_all ("/<div class=\"mainscroll-content\">([^`]*?)<\/div>/", $data, $matches); // Loop through each content item foreach ($matches[0] as $match) {     // Stat     preg_match ("/<a href=\"overall.ws?table=0&user= . $user\">([^`]*?)<\/a><\/td>", $match, $temp);     $stat = $temp['1'];     $stat = strip_tags($stat);     $stat = trim($stat);     // Rank     preg_match ("/<td align=\"right\">([^`]*?)<\/td>/", $match, $temp);     $rank = $temp['1'];     $rank = trim($rank);    // Level     preg_match ("/<td align=\"right\">([^`]*?)<\/td>/", $match, $temp);     $level= $temp['1'];     $level = trim($level);    // Exp     preg_match ("/<td align=\"right\">([^`]*?)<\/td>/", $match, $temp);     $exp = $temp['1'];     $exp = trim($exp);[/code] It works..almost. It finds what is between the first <td></td>. for each different one I called. So it all finds the same data (duh). Sorry for the long code, and if I explained it wrong I will retry tomorrow (1am).
  24. Yeah, I guess that's what happens when you attempt to learn php by using other people's code. Sometimes they don't get the code right to start with, and that can cause even more problems for someone like me. I'll go through it right now adding parentheses (I think that's the problem). Thanks. Well, it's working now the only problem is the script goes on forever because it can't find the words that I gave it. This is because when I use quotation marks within the code, it produces an error: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: syntax error, unexpected T_STRING in C:\Documents and Settings\HP_Administrator\Desktop\xampp\htdocs\crons.php on line 6 preg_match_all ("/<div class=[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]"[!--colorc--][/span][!--/colorc--]mainscroll-content[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]"[!--colorc--][/span][!--/colorc--]>[^`]*</div>/", $data, $matches);[/quote] How do I get around that? I -must- involve quotation marks within the search because that's what the website that I am searching has in it's source.
  25. Hmm, so I gather it is called 'Screen Scraping'. Well I figured out how to do it from a website that I found via Google. Only now, I get a few errors. My code: [code]<?php // Get page $user = 'Zezima'; $data= file_get_contents('http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=' . $user); // Get content items preg_match_all "/<div class="mainscroll-content">[^`]*</div>/", $data, $matches; // Loop through each content item foreach $matches[0] as $match {     // Stat     preg_match "/<a href="overall.ws?table=0&user=zezima">[^`]*</a>/", $match, $temp;     $stat = $temp[1];     $stat = strip_tags$stat;     $stat = trim$stat;     // Rank     preg_match "/<td align="right">[^`]*</td>/", $match, $temp;     $rank = $temp[1];     $rank = trim$rank;          // Level     preg_match "/<td align="right">[^`]*</td>/", $match, $temp;     $level = $temp[1];     $level = trim$level;     // Exp     preg_match "/<td align="right">[^`]*</td>/", $match, $temp;     $exp = $temp[1];     $exp = trim$exp; echo "$stat"; echo "$rank"; echo "$level"; echo "$exp"; ?> [/code] My error is: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Documents and Settings\HP_Administrator\Desktop\xampp\htdocs\crons.php on line 6[/quote] I think it's in the way I'm using preg_match all, since I'm suppose to use (). Any help?
×
×
  • 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.