Jump to content

scottrohe

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by scottrohe

  1. I have a few different queries that pull from a very large database in mySQL. It was working fine for the longest time then one day it stopped working. It only pulls like 1 query per request and will not randomize anything. I have tried having it just list the database in PHP but that only pulls out a few things also. I have tried putting backup copies of the database up, that doesn't work either. Has anyone had this problem? I'm sorry its not very detailed, very hard to explain. At once it showed all 50 states like this: Arizona County, County, County... Now it will only show one county under Arizona: Arizona County, ... function randomizeCounties($fState){ $sql2 = mysql_query("SELECT * FROM ZIPCodes WHERE StateName='$fState' GROUP BY 'CountyName' ORDER BY RAND() LIMIT 3"); while ($r2=mysql_fetch_array ($sql2)) { $countyName=$r2["CountyName"]; $i ++; if($i <= "2"){ echo "<a href='?p=county-local-insurance-agent-directory&state=".$fState."&county=".$countyName."'>".$countyName."</a>, "; } else { echo "<a href='?p=county-local-insurance-agent-directory&state=".$fState."&county=".$countyName."'>".$countyName."</a> "; } } } Is what I use for that.. As I said, it was working perfectly. Then if you go into the county to pull up what cities are within that county, it will only pull 1. No matter what I try, it will only pull 1. Thanks in advance.
  2. try  [code=php:0]$to = "myname@gmail.com, yourname@gmail.com";[/code]
  3. Wow, thanks guys! I didn't create the database, didn't even know that indexing the states like that would make that big of a difference in the first place though haha; but that did it. The page now loads in around a second rather than 10+
  4. Hey guys, I have a large database of every state/county/city etc that I have a function accessing and randomizing all of the counties per state and pulling just 3.. running 50x; very long load process.. So, I've been messing around trying to figure out how to make either a popup or a div come up saying "Loading.. Please Wait". Nothing seems to work; popups come up AFTER it is done, even if I put an "onClick" on the link that takes you to the page, although that wouldn't fix the problem as some people will be comming straight from search engines.. Pretty much the same thing with java+divs. Sorry if I posted this in the wrong forum. Here is my function that I use to randomize the counties.. [code=php:0] function randomizeCounties($fState){ $sql2 = mysql_query("SELECT * FROM ZIPCodes WHERE StateName='$fState' GROUP BY 'CountyName' ORDER BY RAND() LIMIT 3"); while ($r2=mysql_fetch_array ($sql2)) {        $countyName=$r2["CountyName"]; $i ++; if($i <= "2"){  echo "<a href='?p=county-local-insurance-agent-directory&state=".$fState."&county=".$countyName."'>".$countyName."</a>, "; } else { echo "<a href='?p=county-local-insurance-agent-directory&state=".$fState."&county=".$countyName."'>".$countyName."</a> "; } } } [/code] Any ideas on howto either a) lessen load time to about 2 seconds, rather than 10... or [b]mainly[/b] b) show a "Loading.. Please Wait" message.. Any help is much appreciated, thanks for your time.
  5. or anything else then? I thought reg expressions would since you can strip tags, etc with them?
  6. Ok so i'm lost atm with regular expressions. Here's the scenario. Users submit text through a textbox, stores it in sql, then i display it on a page. I want them to be able to use HTML (to show images, bold, etc) but i dont want the images to go over a certain size.. So if someone posts a huge image, i want to resize it within the img src tag. so if they put in [code]<img src="blah.jpg">[/code] and its over X amount in width then it remakes it to [code]<img src="blah.jpg" width="20">[/code]. Hopefuly made myself clear, gotta love being sick. Thanks.
  7. Hey guys, having some trouble with my logic CAUSE I SUCKKK. Anyways, Here's what i'm trying to do. I have a Rating system (0-5 stars). I want to display the 'Top Rated Layouts' when I 'ORDER BY ranking' it works but it displays the first layouts that have been rated with 1 vote / 5 stars.. So, what I need it to do is display the actual TOP rated layouts for example.. If a layout has 3 votes, and its average ranking is still 5 stars, obviously it's better than the layout that has only 1 vote with 5 stars. I have tried 'ORDER BY (ranking*votes)' but that bumps say a layout with a average ranking of 4.80, with 3 votes to the second position above a layout that has like 2 votes with a 5.00 ranking average. What am I doing wrong in my logic (I suck at math.)? What do I order by? Thanks for your time.
  8. hmm, ive tried adding the upload code to the forms page, then having the process return as a diff url; ex: ?x=submit&added=yes... then if added = yes, try to upload the image.. but still cant get it to, it just echos the same thing 'test.gif' instead of the full dir.. any help would be much appreciated, thanks.
  9. [b]EDIT: Well, last post at bottom ty for trying to help but that wasnt the problem ( that was just my bad when putting text into here, i was fooling around with it all before then.. turns out the problem was $_POST['file'] had to be $_FILES['file']..[/b] Ok so i'm trying to upload a file using a series of functions and cant get it to work. It seems like it's getting rid of the desired files directory so instead of uploading "c:\blah\blah.gif" its trying to upload blah.gif and is giving me hell. basicaly.. [code=php:0]   function procSubmitLayout(){       global $session, $form;       $retval = $session->addLayout($_POST['title'], $_POST['cata'], $_POST['un'], $_POST['file'], $_POST['comm'], $_POST['Scode']); [/code] is my first function the form goes into, it then throws it over to sessions.php to check for errors.. note [file] [code=php:0] function addLayout($subtitle, $subcata, $subun, $subfile, $subcomm, $subScode) [/code] is the start function in sessions.php ... note [subfile] then.. within that function.. check errors on file uploading, if none.. upload it. [code=php:0]     $field = "file";        $field2 = "file2";        if($subfile == ""){         $form->setError($field, "* Screenshot not entered");       } else { $uploaddir = "/home/cetricc/public_html/eys/layouts/up"; $allowed_ext = "jpg, gif"; $max_size = "1048576"; // check file path $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = explode(", ", $allowed_ext); for($iz = 0; $i < count($allowed_paths); $i++) { if ($allowed_paths[$i] == "$extension") { $okk = "11"; } } if ($okk == "11") { if($_FILES['subfile']['size'] > $max_size) {         $form->setError($field2, "* Image size is too large! *"); // show error on submit form.. } // upload if(is_uploaded_file($_FILES['file']['tmp_name'])) { move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['tmp_name']); } } else {         $form->setError($field2, "* You can only upload .jpg or .gif ScreenShots. *"); // show error on submit form.. } [/code] after that, it throws it over to database.php to add the gathered info to the database.. it correctly adds JUST "test.gif" or whatever the file may be to the database. which is what i wanted, but.. it doesnt upload the file.. ive tried it other ways and basicaly i can get it to output the error for invalid extension, and when i echo the result it just shows 'test.gif'. ive also tried changing 'file' variable within the uploading process to 'subfile'.. same result. hope i explained myself well enough. on another note.. the code alone, just the file upload part with error checking works fine on a test form page.. so i know thats not the problem, its the input thats the problem.. grr. any help is much appreciated.
  10. Ok well I have everything right I just need to know WHICH date format I should use when entering the date into the db. ex; I've tried: [code=php:0] <?php       $date = date('dmy', strtotime($date)); ?> [/code] so I get the result of '050806' but when I order that in a sql queue  'ORDER BY date DESC', and i test it by changing the date around on tables, it just doesn't work flawlessly. I was also wanting to add in like a timestamp so if 2 items are added at once, but one is added a second or two later, it's newer and therefore displays ahead of the one added 2 seconds before it.. what would my 'date' variable be? Thanks.
  11. [quote author=bltesar link=topic=102829.msg409131#msg409131 date=1154633838] [quote author=scottrohe link=topic=102829.msg409097#msg409097 date=1154630273] [code=php:0] <?php   $q = "SELECT * FROM favorites WHERE username='$session->username' AND favid='$hl_id'";     $sqlfavc = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());           $exists=mysql_num_rows($sqlfavc);           if($exists == $hl_id) { ?> <a href="?x=delf&f=<?php echo $hl_id;?>&c=layouts&s=<?php echo $hl_subcat;?>"><img src="i/alreadyfav.gif" hsrc="i/alreadyfav2.gif" align="left" border="0"></a> <?php           } else {?> <a href="?x=addf&fav=<?php echo $hl_id;?>&cat=layouts&sub=<?php echo $hl_subcat;?>"><img src="i/favicon2.gif" hsrc="i/favicon2_2.gif" align="left" border="0"></a> <?php           } ?> [/code] when i print_r($exists);  it shows the id "1" for both, layout 1 and 2.. like it picks out the 1st id and saves it to the variable then stops... thats why the 2nd one is getting that same output, which confuses the hell out of me since its already in a loop! thought it was right then tested and got that :( closeeeee.... [/quote] you're almost there.  instead of  if($exists == $hl_id), you should have if($exists).  Remember, $exists is the number of rows, which should be either 1 for a macth or 0 for no match. [/quote] THANKYOU. That did it :) RELIEF!!!!!!!!!!!!!!! heh. Thanks a lot for all the help you guys have gave, it's greatly appreciated. I'm sure i'll be back again sometime. Once again thanks.. Better go before I piss myself outa excitement.
  12. [code=php:0] <?php   $q = "SELECT * FROM favorites WHERE username='$session->username' AND favid='$hl_id'";     $sqlfavc = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());           $exists=mysql_num_rows($sqlfavc);           if($exists == $hl_id) { ?> <a href="?x=delf&f=<?php echo $hl_id;?>&c=layouts&s=<?php echo $hl_subcat;?>"><img src="i/alreadyfav.gif" hsrc="i/alreadyfav2.gif" align="left" border="0"></a> <?php           } else {?> <a href="?x=addf&fav=<?php echo $hl_id;?>&cat=layouts&sub=<?php echo $hl_subcat;?>"><img src="i/favicon2.gif" hsrc="i/favicon2_2.gif" align="left" border="0"></a> <?php           } ?> [/code] when i print_r($exists);  it shows the id "1" for both, layout 1 and 2.. like it picks out the 1st id and saves it to the variable then stops... thats why the 2nd one is getting that same output, which confuses the hell out of me since its already in a loop! thought it was right then tested and got that :( closeeeee....
  13. everything else appears to be right and fine.. everything else displays fine and works fine but when i add the favorites part in, the favs part just.. doesnt work.. lol
  14. my If statement is; [code=php:0] <?php           $exists = ($row['favid'] == $hl_id) ? true : false;           if($exists) { ?> <a href="?x=delf&f=<?php echo $hl_id;?>&c=layouts&s=<?php echo $hl_subcat;?>"><img src="i/alreadyfav.gif" hsrc="i/alreadyfav2.gif" align="left" border="0"></a> <?php           } else { ?> <a href="?x=addf&fav=<?php echo $hl_id;?>&cat=layouts&sub=<?php echo $hl_subcat;?>"><img src="i/favicon2.gif" hsrc="i/favicon2_2.gif" align="left" border="0"></a> <?php           } ?> [/code]
  15. ill try to explain how it looks better. "What's Hot?" if the user [b]doesnt[/b] have it in their personal favs it should appear as ( * being a 'star' signifying 'add to favorites' ): Layout ID:1 _________ |thumb    |  *  Layout Name |of          |      Layout Catagory |hotlayout |      Author if the user [b]does[/b] have it in their personal favs it should appear as ( x being a 'X image' signifying 'delete from favorites' ): Layout ID:2 _________ |thumb    |  X  Layout Name |of          |      Layout Catagory |hotlayout |      Author whith the current code i posted above i am seeing this: Layout ID: 1 _________ |thumb    |  X  Layout Name |of          | *  Layout Catagory |hotlayout |      Author Layout ID:2 _________ |thumb    |  *  Layout Name |of          |  X    Layout Catagory |hotlayout |      Author hope this is better, thanks.
  16. do you think it could be doing this because its inside another loop? i dont think it would effect it but... [code=php:0] <?php $sqltwo1 = mysql_query("SELECT * FROM ".TBL_LAYOUTS." ORDER BY views DESC LIMIT 3"); while ($r=mysql_fetch_array ($sqltwo1)) {        $hl_id=$r["id"];     $hl_subcat=$r["subcat"];     $hl_username=$r["username"]; e    $hl_lname=$r["lname"];     $hl_thumb=$r["thumb"];     $hl_views=$r["views"];         $hl_views++;     $sqltwo2 = "UPDATE ".TBL_LAYOUTS." SET views='$hl_views' WHERE id='$hl_id'";     $result = mysql_query($sqltwo2); //top 3 layouts table is right here.. add/delete to favorites images are within the table.     $q = "SELECT favid FROM favorites WHERE username='$session->username'";     $sqlfavc = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());     while($row = mysql_fetch_assoc($sqlfavc)) {           $exists = ($row['favid'] == $hl_id) ? true : false;           if($exists) { //show delete favorite image           } else { //show add favorite image           }     } ?> [/code]
  17. Ken, ty for the fast reply. Sadly though, same result.
×
×
  • 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.