Page 1 of 1
Solved lock/delete me
Posted: Fri Aug 08, 2003 9:42 pm
by Bad HAL 9000
Problem updating a record. It doesnt seem to update.... Here is the code that I have so far
Code: Select all
<?php
$reqlevel = 0;
include("membersonly.inc.php");
mysql_query("UPDATE admins SET csname=$csname, auth=$auth, paypal=$paypal, email=$email, password=$password, access=$access, datepurchase=$datepurchase, dateend=$dateend, status=$status WHERE id='$uid'");
printf ("Updated records: %d\n", mysql_affected_rows());
mysql_query("COMMIT");
echo '<br>' . $csname;
echo '<br>' . $auth;
echo '<br>' . $paypal;
echo '<br>' . $email;
echo '<br>' . $password;
echo '<br>' . $access;
echo '<br>' . $datepurchase;
echo '<br>' . $dateend;
echo '<br>' . $status;
echo '<br>' . $id;
?>
But its not updating. Its telling me "Updated records: -1" but i know thats not right, it shouldnt be. and my DB doesnt change
Posted: Fri Aug 08, 2003 10:16 pm
by Drachlen
Code: Select all
<?php
mysql_query("UPDATE admins SET csname='$csname', auth='$auth', paypal='$paypal', email='$email', password='$password', access='$access', datepurchase='$datepurchase', dateend='$dateend', status='$status' WHERE id='$uid'") or die(mysql_error());
?>
Try this, you need some single quotes around variables

Posted: Fri Aug 08, 2003 11:24 pm
by Bad HAL 9000
Ok, im not getting the -1 updates but now im getting 0 updates.... arg
Posted: Sat Aug 09, 2003 12:25 am
by Drachlen
try echoing $uid, are you positive thats the variable name, and is it returning a value?
Posted: Sat Aug 09, 2003 1:53 am
by Bad HAL 9000
lol I remember i changed the vars name and I forgot to change the rest of the script to reflect that change thanks a bunch its workin now!

Posted: Sat Aug 09, 2003 3:45 pm
by Bad HAL 9000
Ok, new problem, Im stupid so bear with me
Code: Select all
<td><select name="gserver">
<option value="EP1" <?php if ($gserv = "EP1") { echo "selected"; } ?>>Eddie's Playground 1</option>
<option value="EP2" <?php if ($gserv = "EP2") { echo "selected"; } ?>>Eddie's Playground 2</option>
<option value="Both" <?php if ($gserv = "Both") { echo "selected"; } ?>>EP1 and EP2</option>
</select></td>
Its not workin it selects Both no matter what, and $gserv is returning the correct value.. im stumped
Posted: Sat Aug 09, 2003 4:37 pm
by JAM
Bad HAL 9000 wrote:Ok, new problem, Im stupid so bear with me ;)
;)
Try changing the = to ==
Code: Select all
<?php
<td><select name="gserver">
<option value="EP1" <?php if ($gserv == "EP1") { echo "selected"; } ?>>Eddie's Playground 1</option>
<option value="EP2" <?php if ($gserv == "EP2") { echo "selected"; } ?>>Eddie's Playground 2</option>
<option value="Both" <?php if ($gserv == "Both") { echo "selected"; } ?>>EP1 and EP2</option>
</select></td>
?>
...as you allrady know, one = sets the variable to 'Both'...
Posted: Sat Aug 09, 2003 8:12 pm
by Bad HAL 9000
hahah boy do I feel stupid

. I guess im think VB instead of C syntax I had no idea i could say somthing that dumb

Posted: Sat Aug 09, 2003 9:40 pm
by JAM
Yup, been coding VB/VBA, pascal and JML at work for about ½-year, so I know how that feels...
Sidenote (to everyone watching)...
Did you change the topic of this post and added "SOLVED" to it?
In that case good! Everyone should do that upon their request/problem is solved, because beginners can see the topic and also know that inside there is a solution to it. Advanced users that scout the board helping out, do not need to tend to such topic, as it's obviously allready handled.
Some info similiar to this should get sticky!
And perhaps a function in the board's backend could make the posts closed if such topic is found... Just my 2cents...
Posted: Sat Aug 09, 2003 9:52 pm
by Bad HAL 9000
Yea, I did that. When asking for help I dont want people helping me with somthing thats already done ya know? So yea, changed the title I did
