Jump to content

Help Me Please Coding :(


jawad_Anisa

Recommended Posts

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 :(

: :'( : :'( : :'( : :'(  : :'(  : :'( : :'(

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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');
?>
Link to comment
Share on other sites

"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 by bsmither
Link to comment
Share on other sites

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 42
Your $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 by Cornelius
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.