Jump to content

gibsongk55

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gibsongk55's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks but not quite. I still have no idea how to get this script to work again now that Google changed things. Here is where the script came from. But the link is no longer valid. Also with the settings there is not much to change there. //PageRank Lookup v1.1 by HM2K (update: 31/01/07) //based on an alogoritham found here: http://pagerank.gamesaga.net/ //settings - host and user agent $googlehost='toolbarqueries.google.com'; $googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5';
  2. HI, I have been using toolbarqueries.google.com in a php script to retrieve the PR for domains and update them in a database. Recently it has stopped working and all domains show a PR 0. Any help would be appreciated. Thanks, Gibs
  3. ok thanks. Let me play around with it and see what i can do. Gibs
  4. Hi Again, I looked over some more and there are some mistakes so I fixed them but haven't tested it yet until i can clarify how to get the field data. The code updated is: SELECT domain.manual_approve register.username FROM alldomain LEFT JOIN domain ON (domain.id = alldomain.id) LEFT JOIN register ON(alldomain.userid = register.id) WHERE alldomain.domain = '$link_url' $x_manual_approve = domain.manual_approve $x_username = register.username Further study I think it would be a faster query if I searched for the match on the link_url entered in the form. First thing should be a match with the link_url equals the alldomain.domain_name. I rewrote your code, does this seem logical? SELECT alldomain.domain_name FROM alldomain WHERE alldomain.domain_name = '$link_url' LEFT JOIN alldomain ON(alldomain.userid = register.id) LEFT JOIN register ON(alldomain.userid = register.id) $x_manual_approve = domain.manual_approve $x_username = register.username Thanks so much, Gibs
  5. Hi, Thanks for the reply. Quick question though. At the end of this query to get the values from the two fields, can I just assign after that? Like this: SELECT domain.manual_approve register.username FROM alldomain LEFT JOIN domain ON (domain.id = alldomain.id) LEFT JOIN register ON(alldomain.userid = register.id) WHERE alldomain.domain = '$link_url' $x_manual_approve = domain.manual_approve $x_username = register.username Is that correct? Thanks again, Gibs
  6. Hi, I am still learning php and I've been racking my brain to get some field data from the mysql database and put the results into variables to use. I need to do a query to get the data from two fields and place them in a variable. I have this field from a form: $_REQUEST['linkurl'] So i need to check this form field against (tablename, fieldname) alldomain.domain_name when the match is found I need to store the value of tablename, fieldname) domain.manual_approve into $x_manual_approve and then check that rows userid field: (tablename, fieldname) alldomain.userid and equals (tablename, fieldname) register.id the userid and id are matching from two different tables (tables alldomain and register). When I get that match I need to get (tablename, fieldname) register.username and store the value into $x_username Thanks much for any help, Gibs
  7. Hi Keith, I went back to an old post you helped me before with and worked on some code I couldn't get to work before. I actually got it to show the 9 records correctly that meet the criteria. Only thing is that is does not display the title line above the image and it does not show the gold.jpg for the 10th spot since only 9 out of 10 records are found. I had to change the LEFT OUTER JOIN to INNER JOIN and select from dle_post first instead of dle_images because the post table has the fields to check if approve=1 and gold=1, otherwise all the image files in the dle_image table will have invalid records. I know this piece of code is missing: $title_id[$row2['id']] = stripslashes($row2['title']); which in the new code there is now $row2, so i changed it to: $title_id[$row['id']] = stripslashes($row['title']); but I don't know where to place it without getting an error. Here is what I have so far: <?php function dle_img () { global $db; $arr_Out = array(); $result = $db->query("SELECT * FROM dle_post INNER JOIN dle_images ON dle_post.id = dle_images.news_id AND dle_post.gold=1 AND dle_post.approve=1 ORDER BY RAND() LIMIT 10"); $imgar = array (); $i = 1; while ( $row = $db->get_row($result)) { $images = $row['images']; if (!in_array($images, $imgar)) { $imgar[] = $row['images']; $images = explode("|||",$images); $images = $images[0]; // if (empty($row['news_id'])) { if ( $title == "...") { $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\"></font></center></b></td> </tr> <td style=\"background-color:transparent\"> <div style=\"height:2px\"></div> <img border=\"0\" src=\"http://www.rent4bowls.com/uploads/posts/gold.jpg\" width=\"150\" height=\"95\"></td> </td> </td> </table> <p><p><p> </a></td></tr></table>"; } else { if (file_exists(ROOT_DIR."/uploads/posts/".$images)) {$file_dir = "posts";} else {$file_dir = "files";} substr($row['title'],0,25)."...";} $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\">{$title}</font></center></b></td> </tr> <td style=\"background-color:#000000\"> <div style=\"height:2px\"></div> <a href=\"/index.php?newsid={$row['news_id']}\"> <img border=\"0\" src=\"/uploads/".$file_dir."/{$images}\" width=\"150\" height=\"95\" title=\"{$title}\"></td> </td> </table> <p><p><p> </a></td></tr></table>"; } if($out) { if(($i % 5) == 0) {$arr_Out[] = $out; $out = '';} $i++; } } if ($out != '') { $arr_Out[] = $out; } return $arr_Out; } $dle_img = dle_img(); ?> Thanks again for your help. Gibs
  8. Hi Keith, I appreciate your input. Not sure where to go from here. Okay this is what I need to happen. If FROM dle_post (table) approve=1 AND gold=1 then I need an image for that record which is JOINED from another table dle_images to display on the main page. There are 10 places on the main page to display these records. If there are more than 10 records in the database meeting this criteria, then I need it to randomly choose 10 to fill all spots on the main page. Currently I am only showing a total of 4, 5, 6, or 7 selected records on the main page when in fact there are 9 records that meet the criteria approve=1 AND gold=1. I don't understand arrays at all as this was programmed for me. Appreciate any help you can give. Regards, Gibs
  9. Hi, I had problems with this script before and thought it was fixed but it still does not work correctly. What this should do is find records in the database that match the criteria of gold=1 AND approve=1 The results should be taken randomly if in case there are more than 10 results. There are 10 places on the main page of the site to show an image for these results. If there are more than 10 records that meet the criteria it should randomly grab 10. If less than 10 records I have it display the image "gold.jpg" instead which just displays a seal that says advertise here. Currently the database has 10 records that meet the criteria but it is displaying about 5 seals when there should only be 1. Here is the code. <?php function dle_img () { global $db; $arr_Out = array(); $result = $db->query("SELECT id,title,approve FROM dle_post WHERE gold=1 AND approve=1"); while ($row2 = $db->get_row($result)) { $title_id[$row2['id']] = stripslashes($row2['title']); } // $result = $db->query("SELECT * FROM dle_images INNER JOIN dle_post ON dle_images.news_id = dle_post.id ORDER BY RAND() LIMIT 20"); $result = $db->query("SELECT * FROM dle_images INNER JOIN dle_post ON dle_images.news_id = dle_post.id ORDER BY RAND() "); $imgar = array (); $i = 1; while ( $row = $db->get_row($result)) { $images = $row['images']; if (in_array($images, $imgar)) continue; $imgar[] = $row['images']; $images = explode("|||",$images); $images = $images[0]; if (file_exists(ROOT_DIR."/uploads/posts/".$images)) {$file_dir = "posts";} else {$file_dir = "files";} $title = substr($title_id[$row['news_id']],0,25)."..."; // if (empty($row['news_id'])) { if ( $title == "...") { $out .= "<table align=\"center\"><tr><td align=\"center\"> <img border=\"0\" src=\"http://www.sbowlrentals.com/uploads/posts/gold.jpg\" width=\"150\" height=\"95\"></td> </td> </a></td></tr></table>"; } else { $out .= "<table align=\"center\"><tr><td align=\"center\"> <a href=\"/index.php?newsid={$row['news_id']}\"> <img border=\"0\" src=\"/uploads/".$file_dir."/{$images}\" width=\"150\" height=\"95\" title=\"{$title}\"></td> </td> </table> <p><p><p> </a></td></tr></table>"; } if($out) { if($i == 5) {$arr_Out[] = $out; $out = '';} if($i == 10) {$arr_Out[1] = $out; $out = '';} $i++; } } return $arr_Out; } $dle_img = dle_img(); ?> Appreciate any help. You can see site here ---> http://www.rent4bowls.com Gibs
  10. Hi Keith, I am really close with fixing this. The MySQL part works now. Only problem with the result is that I have 9 records as a query result. The site will only show 8 at any time. Of course on refresh the 9th will show but still only a total of 8 appear. Appreciate any help. Gibs <?php function dle_img () { global $db; $arr_Out = array(); $result = $db->query("SELECT id,title,approve FROM dle_post WHERE gold=1 AND approve=1"); while ($row2 = $db->get_row($result)) { $title_id[$row2['id']] = stripslashes($row2['title']); } $result = $db->query("SELECT * FROM dle_images INNER JOIN dle_post ON dle_images.news_id = dle_post.id ORDER BY RAND() LIMIT 20"); $imgar = array (); $i = 1; while ( $row = $db->get_row($result)) { $images = $row['images']; if (in_array($images, $imgar)) continue; $imgar[] = $row['images']; $images = explode("|||",$images); $images = $images[0]; if (file_exists(ROOT_DIR."/uploads/posts/".$images)) {$file_dir = "posts";} else {$file_dir = "files";} $title = substr($title_id[$row['news_id']],0,25)."..."; // if (empty($row['news_id'])) { if ( $title == "...") { $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\"></font></center></b></td> </tr> <td style=\"background-color:transparent\"> <div style=\"height:2px\"></div> <img border=\"0\" src=\"/uploads/posts/clear.jpg\" width=\"150\" height=\"95\"></td> </td> </td> </table> <p><p><p> </a></td></tr></table>"; } else { $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\">{$title}</font></center></b></td> </tr> <td style=\"background-color:#000000\"> <div style=\"height:2px\"></div> <a href=\"/index.php?newsid={$row['news_id']}\"> <img border=\"0\" src=\"/uploads/".$file_dir."/{$images}\" width=\"150\" height=\"95\" title=\"{$title}\"></td> </td> </table> <p><p><p> </a></td></tr></table>"; } if($out) { if($i == 5) {$arr_Out[] = $out; $out = '';} if($i == 10) {$arr_Out[1] = $out; $out = '';} $i++; } } return $arr_Out; } $dle_img = dle_img(); ?>
  11. Hi Keith, Okay I ran that query in myphpadmin and received 4 rows... correct! However with the script, instead of the 4 images loading on the left and right side of the page I get this: Note that the code before did display correctly only that it was showing all records (max 10 places on the page) because it never checked for gold=1. Thanks, Gibs
  12. Hi Keith, I appreciate your help and time. I don't quite understand the a and b part of the code. I assume it is the 1st table dle_post and the 2nd table dle_images. Anyway I ran the statement: SELECT a.images, a.news_id b.id,b.title,b.approve,b.gold FROM dle_images a INNER JOIN dle_post b ON dle_images.news_id = dle_post.id WHERE dle_post.approve =1 AND dle_post.gold = 1 ORDER BY RAND() LIMIT 20 In the SQL query in phpmyadmin and I received this error: "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id,b.title,b.approve,b.gold FROM dle_images a INNER JOIN dle_post b ON dle_imag' at line 1" I am still confused. Thanks, Gibs
  13. Thanks Keith. Not sure what to try either. There is an array which stores the results. I used the LEFT JOIN because the first table has less records than the 2nd. Here is the entire script. Do you have any suggestions or testing solutions? Thanks, Gibs <?php function dle_img () { global $db; $arr_Out = array(); $result = $db->query("SELECT id,title,approve,gold FROM dle_post WHERE approve= 1 AND gold = 1 "); while ($row2 = $db->get_row($result)) { $title_id[$row2['id']] = stripslashes($row2['title']); } $result = $db->query("SELECT * FROM dle_images LEFT JOIN dle_post ON dle_images.news_id = dle_post.id WHERE dle_post.approve =1 AND dle_post.gold = 1 ORDER BY RAND() LIMIT 20"); $imgar = array (); $i = 1; while ( $row = $db->get_row($result)) { $images = $row['images']; if (in_array($images, $imgar)) continue; $imgar[] = $row['images']; $images = explode("|||",$images); $images = $images[0]; if (file_exists(ROOT_DIR."/uploads/posts/".$images)) {$file_dir = "posts";} else {$file_dir = "files";} $title = substr($title_id[$row['news_id']],0,25)."..."; if (empty($row['news_id'])) { // if ( $title = "..." ) next($row) { $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\">{$title}</font></center></b></td> </tr> <td style=\"background-color:#000000\"> <div style=\"height:2px\"></div> </td> </td> </table> <p><p><p> </a></td></tr></table>"; } else { $out .= "<table align=\"center\"><tr><td align=\"center\"> <table cellpadding=\"0\" cellspacing=\"0\" style=\"margin-right:10px\" height=\"135\"> <tr> <font face=\"arial\" size=\"1\" color=\"#000000\">{$title}</font></center></b></td> </tr> <td style=\"background-color:#000000\"> <div style=\"height:2px\"></div> <a href=\"/index.php?newsid={$row['news_id']}\"> <img border=\"0\" src=\"/uploads/".$file_dir."/{$images}\" width=\"150\" height=\"95\" title=\"{$title}\"></td> </td> </table> <p><p><p> </a></td></tr></table>"; } if($out) { if($i == 5) {$arr_Out[] = $out; $out = '';} if($i == 10) {$arr_Out[1] = $out; $out = '';} $i++; } } return $arr_Out; } $dle_img = dle_img(); ?>
  14. Hi, I have been working for days trying to get this to work. $result = $db->query("SELECT id,title,approve,gold FROM dle_post WHERE approve= 1 AND gold = 1 "); while ($row2 = $db->get_row($result)) { $title_id[$row2['id']] = stripslashes($row2['title']); } $result = $db->query("SELECT * FROM dle_images LEFT JOIN dle_post ON dle_images.news_id = dle_post.id WHERE dle_post.approve =1 AND dle_post.gold = 1 ORDER BY RAND() LIMIT 20"); The above code I can run each of the two MySQL statements in phpmyadmin as a SQL query and for each query I receive 4 rows. This is correct as 4 different rows contain approve=1 AND gold=1. Now my php shows it has selected none. Is there a way to combine these two SQL statements into one? A friend that is a programmer checked it and said he is 100% sure the sql statements are not working. But why would it work in phpmyadmin and not in the php code? MySQL version 5.1.47-community-log PHP version 5.2.13 Appreciate any help. Thanks, Gibs
  15. Hi, I get a "Bad Gateway" error and i am told it is because the fopen command is not working. I am leasing our webserver so I am the only support. How can i fix this problem? Thanks, Gibsongk55
×
×
  • 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.