Jump to content
MakeWebGames

can anyone help


Newbie
 Share

Recommended Posts

hey me again sorry to be a pain in the ass but cant figure this out

 

iam working on orgcrimes and i edited it a little to give out min respect and max respect basicly what i want to do now is send a event or insert it into gang events as it dont tell you if u pass or fail the event function wasnt working normaly

 

heres what i done so far

 

event_add($r['username'], "Your Gang's Organised Crime Failed. Go <a href='oclog.php?ID=$i'>here</a> to view the details.", $c);

 

$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang's Organised Crime Succeeded. Go <a href='oclog.php?ID=$i'>here</a> to view the details');");
Link to comment
Share on other sites

hey me again sorry to be a pain in the ass but cant figure this out
$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang's Organised Crime Succeeded. Go <a href='oclog.php?ID=$i'>here</a> to view the details');");

$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details');");

Link to comment
Share on other sites

$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");

 

Sorry, forgot to remove the ; in the query, causing it to fail.

Link to comment
Share on other sites

$i won't work within single quotes like that.

Single quotes:

$db->query("INSERT INTO `gangevents` VALUES (NULL, '{$gangdata['gangID']}', unix_timestamp(), 'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=' . $i . '\'>here</a> to view the details')");

 

Double quotes:

$db->query("INSERT INTO `gangevents` VALUES (NULL, '{$gangdata['gangID']}', unix_timestamp(), "Your Gang's Organised Crime Succeeded. Go <a href='oclog.php?ID=$i'>here</a> to view the details")");

 

$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");

 

Sorry, forgot to remove the ; in the query, causing it to fail.

none of the above work still not sending a gang even saying failed or success could it be that im putting it in wrong place ?

 

<?php
include "config.php";
global $_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
$db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME >0");
$q=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0");
while($r=$db->fetch_row($q))
{
$suc=rand(0,1);
if($suc) {
$log=$r['ocSTARTTEXT'].$r['ocSUCCTEXT'];
$muny=(int) (rand($r['ocMINMONEY'],$r['ocMAXMONEY']));
$resp=(int) (rand($r['ocMINRESPECT'],$r['ocMAXRESPECT']));
$log=str_replace(array("{muny}","'"),array($muny,"''"),$log);
$db->query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangRESPECT=gangRESPECT+$resp,gangCRIME=0 WHERE gangID={$r['gangID']}");
$db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())");
$i=$db->insert_id();
$qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}");
while($rm=$db->fetch_row($qm))
{
$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");
}
}
else
{
$log=$r['ocSTARTTEXT'].$r['ocFAILTEXT'];
$muny=0;
$log=str_replace(array("{muny}","'"),array($muny,"''"),$log);
$db->query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}");
$db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())");
$i=$db->insert_id();
$qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}");
while($rm=$db->fetch_row($qm))
{
$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");
}
}
}
if(date('G')==17)
{
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) 
WHERE u.job > 0 AND u.jobrank > 0");
$db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0");
}
if($set['validate_period'] == 60 && $set['validate_on'])
{
$db->query("UPDATE users SET verified=0");
}
?>
Link to comment
Share on other sites

none of the above work still not sending a gang even saying failed or success could it be that im putting it in wrong place ?

 

<?php
include "config.php";
global $_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
$db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME >0");
$q=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0");
while($r=$db->fetch_row($q))
{
$suc=rand(0,1);
if($suc) {
$log=$r['ocSTARTTEXT'].$r['ocSUCCTEXT'];
$muny=(int) (rand($r['ocMINMONEY'],$r['ocMAXMONEY']));
$resp=(int) (rand($r['ocMINRESPECT'],$r['ocMAXRESPECT']));
$log=str_replace(array("{muny}","'"),array($muny,"''"),$log);
$db->query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangRESPECT=gangRESPECT+$resp,gangCRIME=0 WHERE gangID={$r['gangID']}");
$db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())");
$i=$db->insert_id();
$qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}");
while($rm=$db->fetch_row($qm))
{
$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");
}
}
else
{
$log=$r['ocSTARTTEXT'].$r['ocFAILTEXT'];
$muny=0;
$log=str_replace(array("{muny}","'"),array($muny,"''"),$log);
$db->query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}");
$db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())");
$i=$db->insert_id();
$qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}");
while($rm=$db->fetch_row($qm))
{
$db->query("INSERT INTO gangevents VALUES('',{$gangdata['gangID']},unix_timestamp(),'Your Gang\'s Organised Crime Succeeded. Go <a href=\'oclog.php?ID=$i\'>here</a> to view the details')");
}
}
}
if(date('G')==17)
{
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) 
WHERE u.job > 0 AND u.jobrank > 0");
$db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0");
}
if($set['validate_period'] == 60 && $set['validate_on'])
{
$db->query("UPDATE users SET verified=0");
}
?>

What happens when you test it?

Do a var_dump() of mysql_error().

I don't see any syntax errors within your SQL queries, so it's most likely an unidentified or miss-referenced column name.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...