jawad_Anisa Posted April 26, 2014 Share Posted April 26, 2014 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/wgshopus/public_html/submit.php on line 42 :'( AND :'( Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 8 in /home/wgshopus/public_html/index.php on line 39 Help me please i am newbie php :'( :'( :'( :'( :'( :'( :'( Quote Link to comment Share on other sites More sharing options...
Strider64 Posted April 26, 2014 Share Posted April 26, 2014 Let me get put my psychic hat on. Quote Link to comment Share on other sites More sharing options...
therocker Posted April 26, 2014 Share Posted April 26, 2014 Strider64 has a point. There are 2 things that is wrong with this. 1. You are using the old MySQL library. I don't know how you're doing your codes, but you should start using PDO or MySQLi. 2. You haven't shown any of your code which doesn't help with anything. You don't need to be a PHP moderate to know these things. You just need common sense. How is someone going to help you if you don't show them what you need help on? Example. If I tell someone I need help on with my Science homework and I just tell them that and they ask me "Well, show me." And I don't show anything. How are they going to help me? Quote Link to comment Share on other sites More sharing options...
jawad_Anisa Posted April 26, 2014 Author Share Posted April 26, 2014 submit.php <?php #-----------------------------------------------------# # ============Autofollow V1.0============= # # Jangan pernah mengubah tulisan tulisan ini # Ingat jika ingin dihargai menghargailah # Script Autofollow V1.0 By Diki Sianipar # Script ini dibagikan secara gratis kepada kalian. # Copyright jangan dihapus, hargailah. # Twitter : http://twitter.com/webgrupnew # Facebook : http://www.facebook.com/direkturewebgrup # Thanks To My Lovely Nabilah Ratna Ayu Azalia :3 # Thanks To JKT48 CYBER TEAM # Thanks To All #-----------------------------------------------------# /* Memuat file yang dibutuhkan. */ session_start(); require_once('twitteroauth/twitteroauth.php'); require_once('start.php'); /* Jika Akses token kadaluarsa, akan di alihkan kehalaman connect. */ if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ./clearsessions.php'); } /* Pengeksekusi Auto follow. */ $id = ($_POST['follow']); $point = 0; $q = mysql_query("select * from twitter_access_tokens where id='$id' and point='$point'"); if (mysql_num_rows($q) == 1) { $today = date("i"); $next = date('i', strtotime('+'.$limitwaktu.' minute')); $sql = "UPDATE `twitter_access_tokens` set `minute`='{$next}' WHERE `id`='{$id}'"; $result = mysql_query($sql); header('location:clearsessions2.php'); } else { $ids = ($_POST['follow']); $sql = "UPDATE `twitter_access_tokens` set `point`=`point`-'1' WHERE `id`='{$ids}'"; $result = mysql_query($sql); /* Mengambil data pengguna lain secara acak dari database. */ $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT ".$limit.""); while($b = mysql_fetch_array($a)) { $eksekusi = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $b['oauth_token'], $b['oauth_token_secret']); $eksekusi->post('friendships/create', array('user_id' => $ids)); } if ($eksekusi) { header('location:index.php?get=follower'); } } ?> index.php <?php #-----------------------------------------------------# # ============Autofollow V1.0============= # # Jangan pernah mengubah tulisan tulisan ini # Ingat jika ingin dihargai menghargailah # Script Autofollow V1.0 By Diki Sianipar # Script ini dibagikan secara gratis kepada kalian. # Copyright jangan dihapus, hargailah. # Twitter : http://twitter.com/webgrupnew # Facebook : http://www.facebook.com/direkturewebgrup # Thanks To My Lovely Nabilah Ratna Ayu Azalia :3 # Thanks To JKT48 CYBER TEAM # Thanks To All #-----------------------------------------------------# if ($db_host === 'localhost' || $db_user === 'wgshopus_db' || $db_name === 'wgshopus_db' || $db_pass === '123456zz' || $site === 'http://wgshop.us.to/'|| $admin === 'webgrupnew'|| $idadmin === '1122288608' || $text === 'Webgrup'|| $link === 'http://wgshop.us.to/'|| $limit === '5'|| $limitwaktu === '30') {echo "<meta http-equiv='refresh' content='0; url=install.php'>";} /* Memuat file yang dibutuhkan. */ session_start(); require_once('twitteroauth/twitteroauth.php'); require_once('start.php'); /* Jika Akses token kadaluarsa, akan di alihkan kehalaman connect. */ if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ./clearsessions.php'); } /* Mengambil akses token pengguna yang ada di sesi. */ $access_token = $_SESSION['access_token']; /* Membuat objek TwitterOauth dengan konsumen / pengguna token. */ $connection = new TwitterOAuth(lqw2oynnL62qsWfkIzw63c9Pk, LL8vkk7XIpbny4urXEzSkoA7pSSW0xdBx2Cqdh6WQY2vTjrBVL, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* Halaman yang ditampilkan ke pengguna. */ $fol = $connection->get('account/verify_credentials'); $name = $fol->name; $id = $fol->id; $follower = $fol->followers_count; include('html.inc'); $query = mysql_query("SELECT * FROM twitter_access_tokens WHERE id='$id'"); $point = mysql_result($query,0, "point"); if (!empty($_GET['get']) && $_GET['get'] == 'follower') { echo '<div class="list"><center><font size="+1"><h3>BERHASIL MENAMBAHKAN FOLLOWER!</h3></font></center></div>';} echo "<div id=\"header\"><div id=\"wrap\">"; include('pilih.inc'); include('footer.php'); ?> Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 26, 2014 Share Posted April 26, 2014 (edited) "mysql_fetch_array() expects parameter 1 to be resource, boolean given" Without looking at your code, in my experience, 99% of the time the mistake is assuming that the database server will always return a recordset for any given query. A good programmer must always code for the possibility that the database server will return false (which is a boolean value). So, look very carefully at your query on line 41 and make sure you think it should return some records. As of now, it isn't. It's returning false. Something is wrong with the query. The other 1% is from other sloppy coding mistakes. Edited April 26, 2014 by bsmither Quote Link to comment Share on other sites More sharing options...
hakimserwa Posted April 26, 2014 Share Posted April 26, 2014 try removing the last set of quotation marks $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT ".$limit.""); to $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT ".$limit); Quote Link to comment Share on other sites More sharing options...
jawad_Anisa Posted April 26, 2014 Author Share Posted April 26, 2014 I myself confused to replace coding: ( so I hear how it because I want to make a website: '( Quote Link to comment Share on other sites More sharing options...
hakimserwa Posted April 26, 2014 Share Posted April 26, 2014 Whatt??? Quote Link to comment Share on other sites More sharing options...
MDCode Posted April 26, 2014 Share Posted April 26, 2014 mysql_error() Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted April 28, 2014 Share Posted April 28, 2014 Is $limit defined within the script? If it's not, you should get an error if you call mysql_error() as SocialCloud suggested: $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT ".$limit) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Cornelius Posted April 28, 2014 Share Posted April 28, 2014 (edited) For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error. You write: $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT ".$limit.""); while($b = mysql_fetch_array($a)) and you get an error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/wgshopus/public_html/submit.php on line 42Your $a may be boolean only if the result of mysql_query() is FALSE. That means you hadn't queried the database properly. I'd try simple: $a = mysql_query("select * from twitter_access_tokens ORDER BY RAND() DESC LIMIT $limit");Also make sure your $limit is defined. You could also make a report on query: if(!$a){echo "Wrong query at line 42";} Edited April 28, 2014 by Cornelius Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 28, 2014 Share Posted April 28, 2014 If you haven't found the sql error yet, may I suggest that you probably can not use DESC when doing ORDER BY RAND(). Logically, how can you have a random sequence, but then say you want it in a specific order? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.