Page 1 of 1
nothing wrong yet we are dying :(
Posted: Tue Aug 18, 2009 8:49 am
by Torniquet
Code: Select all
$itemQuery = mysql_query("SELECT * FROM stardrome_store WHERE planet='$planet' AND colony='$colony' AND type='Healing' ORDER BY RAND() LIMIT 1");
//
while($row = mysql_fetch_array($itemQuery)){
$name = $row['name'];
$stats = $row['stats'];
$statAdd = $row['stat_add'];
$price = $row['price'];
$randid = rand(1000,999999999);
$type = $row['type'];
$leveluse = $row['use_level'];
$slot = $row['slot'];
}
$countQuery = mysql_query("SELECT * FROM inventory WHERE name='$name' AND id='$id'");
$query2 = mysql_num_rows($countQuery) or die("crap");
while($row = mysql_fetch_array($query)){
$pqty = $row['qty'];
$pname = $row['name'];
}
the part which is failing on me is the 'mysql_num_rows'....
yet there is nothing wrong with the code 0.o
ir is there and i am missing it?
Re: nothing wrong yet we are dying :(
Posted: Tue Aug 18, 2009 1:27 pm
by hallsofvallhalla
the actual error would be nice
try that
Code: Select all
$query2 = mysql_num_rows('$countQuery') or die("crap");
Re: nothing wrong yet we are dying :(
Posted: Tue Aug 18, 2009 4:30 pm
by Torniquet
the accual error is that it is dying and displaying "crap"
Re: nothing wrong yet we are dying :(
Posted: Tue Aug 18, 2009 4:50 pm
by hallsofvallhalla
and adding in the ' 's didnt help?
where is $id defined?
Re: nothing wrong yet we are dying :(
Posted: Tue Aug 18, 2009 5:36 pm
by Torniquet
no. adding the quote marks didnt work
and id is defined at the start of the script from the $_session variable.
I seem to have got round that by using the following now.
Code: Select all
$countQuery = mysql_query("SELECT * FROM inventory WHERE name='$name' AND id='$id'");
//$query2 = mysql_num_rows('$countQuery') or die("crap");
//$countRow = mysql_query("SELECT COUNT(*) FROM inventory WHERE name='$name' AND id='$id'");
//$countRow = mysql_fetch_array($countRow);
//return $countRow;
//$counted = $countRow;
while($row = mysql_fetch_array($countQuery)){
$pqty = $row['qty'];
$pname = $row['name'];
}
if($name != $pname){
$sql = "INSERT INTO inventory (id, name, qty, stats, stat_add, price, rand_id, type, slot, use_level)
VALUES ('$id', '$name', '1', '$stats', '$statAdd', '$price', '$randid', '$type', '$slot', '$leveluse')";
mysql_query($sql) or die("no");
}else{
$qty = $pqty + 1;
mysql_query("UPDATE inventory SET qty='$qty', rand_id='$randid' WHERE id='$id' AND name='$name'");
}
would be nice to know why the other mesthod isnt working tho :s
it worked on another script lol.
meh welll lol. this seems to be working ok. Thanks your ya helps
stay tuned for my next problem :p
Re: nothing wrong yet we are dying :(
Posted: Tue Sep 01, 2009 7:59 pm
by Falken
Torniquet wrote:the accual error is that it is dying and displaying "crap"
Not a good idea to just show crap while looking for errors. Instead use:
to get a nice error message instead

Re: nothing wrong yet we are dying :(
Posted: Wed Sep 02, 2009 1:07 am
by Torniquet
lol i did try tht... but nothing came up

no idea why ¬¬
for some reason i still havent got the method of
$result = mysql_num_rows($query);
working....
but i have got
if(mysql_num_rows($query) > x)
working lol.
weird little thing ¬¬ lol
Re: nothing wrong yet we are dying :(
Posted: Wed Sep 02, 2009 1:45 am
by hallsofvallhalla
that is strange my friend
Re: nothing wrong yet we are dying :(
Posted: Wed Sep 02, 2009 3:21 pm
by Torniquet
tis an annoyance lol.
BUT
aslong as it works... i dont give a rats ass tbh lol.
Re: nothing wrong yet we are dying :(
Posted: Wed Sep 02, 2009 3:44 pm
by hallsofvallhalla
amen