Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Everything posted by kenrbnsn

  1. There's no such method as "link" in a <form> tag. It's either "get" or "post" I would change <?php echo "<form action=\"editevent.php?eventid=".$row['eventid']."\" method=\"link\"><INPUT TYPE=\"submit\" VALUE=\"Edit\"></form>\n"; echo "</td><td>"; echo "<form action=\"delete_ac.php?eventid=".$row['eventid']."\" method=\"link\"><INPUT TYPE=\"submit\" VALUE=\"Delete\"></form>\n"; ?> to <?php echo "<form action='editevent.php?eventid={$row['eventid']}' method='get'><INPUT TYPE='submit' VALUE='Edit'></form>\n"; echo "</td><td>"; echo "<form action='delete_ac.php?eventid={$row['eventid']}' method='get'><INPUT TYPE='submit' VALUE='Delete'></form>\n"; ?> If this isn't what you want, please explain what you want better. Ken
  2. You code is not being interpreted by the PHP processor. Replace the "<?" with "<?php", since short tags may be disabled. Ken
  3. Please post your code between tags. Ken
  4. Try <?php $stringData = $newcolumn . " = \$info['newcolumn']"; ?> If that doesn't work, please tell us exactly what needs to be written to the file. Ken
  5. Try this: <?php $stringData = "\$newcolumn = {$info['newcolumn']}"; ?> Ken
  6. Please post your current code. Ken
  7. If this is what is really in your code: <?php $amount = mysql_query('SELECT COUNT(`car_id`) AS num FROM `tbl_cars` WHERE car_cat = '".$cat."'') or die(mysql_error()); ?> you have a quote problem. It should be <?php $amount = mysql_query("SELECT COUNT(`car_id`) AS num FROM `tbl_cars` WHERE car_cat = '$cat'") or die(mysql_error()); ?> Ken
  8. Please show us your attempt and the error message you got. When posting code, please put it between tags. Ken
  9. Look at your code. On line 112 you close the mysql connection and then try to use it again. Remove the mysql_close(). You don't really need it since the mysql connection is closed when the script exits. Also, this whole section of code <?php $price = 250; $total = $money-$price; $update= $username; mysql_select_db("my_db", $con); mysql_query("UPDATE Game SET Money = '$total'WHERE user = '$update'"); mysql_close($con); $attack2 = $attack + 25; $defence2 = $defence + 25; $Yes = $S + 10; $q = "update Game set Attack = '$attack2', Defence = '$defence2', S = '$Yes', R3 = '2' where user = '$update'"; $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); echo $update; ?> can be replaced with <?php $q = "update Game set Money = Money - 250, Attack = Attack + 25, Defence = Defence + 25, S = S + 10, R3 = 2 where user = '$username'"; $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); echo $username; ?> Ken
  10. Not without seeing your code. Please post it between tags. Ken
  11. This chunk of code is wrong: <?php mysql_select_db("my_db", $con); mysql_query("UPDATE Game SET Attack = '$attack2'WHERE user = '$update'"); mysql_close($con); mysql_select_db("my_db", $con); mysql_query("UPDATE Game SET Defence = '$defence2'WHERE user = '$update'"); mysql_close($con); mysql_select_db("my_db", $con); mysql_query("UPDATE Game SET S = '$Yes'WHERE user = '$update'"); mysql_close($con); mysql_select_db("my_db", $con); mysql_query("UPDATE Weapons SET R3 = '2' WHERE user = '$update'"); mysql_close($con); ?> You shouldn't be selecting the db & closing the connection after every query and all those queries can be performed in one query: <?php $q = "update Game set Attack = '$attack2', Defence = '$defence2', S = '$Yes', R3 = '2' where user = '$update'"; $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); ?> Also, the "session_start()" needs to be moved to the start of the code right after the opening "<?php". Ken
  12. You can also use curly brackets to surround the array reference: <?php $file = "https://www.cdlvis.com/lookup/getxml?username=***********&mode=test&key=*********&vrm={$_POST['veh_reg']}"; ?> Ken
  13. Do you have a record in your database with the an id of 7? Ken
  14. If you look at the code just above the query, the variables are set from the array $row. Where is that array populated? I don't see that in the code you posted. Ken
  15. Change <?php $sql = mysql_query("UPDATE Registration SET event='$event', startdate='$startdate', enddate='$enddate', description='$description', subevent1='$subevent1', subevent2='$subevent2', subevent3='$subevent3', subevent4=$subevent4', subevent5='$subevent5', subevent6='$subevent6', subevent7='$subevent7', subevent8='$subevent8', title1='$title1', title2='$title2', title3='$title3', title4='$title4', title5='$title5', title6='$title6', title7='$title7', title8='$title8', price1='$price1', price2='$price2', price3='$price3', price4='$price4', price5='$price5', price6='$price6', price7='$price7', price8='$price8', id='$id'") or die (mysql_error()); ?> to <?php $q = "UPDATE Registration SET event='$event', startdate='$startdate', enddate='$enddate', description='$description', subevent1='$subevent1', subevent2='$subevent2', subevent3='$subevent3', subevent4=$subevent4', subevent5='$subevent5', subevent6='$subevent6', subevent7='$subevent7', subevent8='$subevent8', title1='$title1', title2='$title2', title3='$title3', title4='$title4', title5='$title5', title6='$title6', title7='$title7', title8='$title8', price1='$price1', price2='$price2', price3='$price3', price4='$price4', price5='$price5', price6='$price6', price7='$price7', price8='$price8', id='$id'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . myslq_error()); ?> and post what is displayed. BTW, this query as it stands will update ALL the events in your DB with theses values, since you don't have a "where" clause to tell mysql which record to update. Ken
  16. I don't get any syntax errors with your posted code, but I do see a logic error: You do: <?php $username = $_POST[username]; $password = $_POST[password]; $enroll = $_POST[enroll]; $email = $_POST[email]; $actype = $_POST[actype]; $firstname = $_POST[firstname]; $lastname = $_POST[lastname]; $connect = mysql_connect($host,$account,$password) or die("Couldn't connect to the database"); ?> Which says to me that you're using the $password that's been sent in the form. I don't think you want to do that. Move the mysql_connect to above that block of code. Ken
  17. You're not making any sense. Please post your code. Ken
  18. Please post all of the script between tags. Ken
  19. What's the name of the file that contains the code. If it doesn't end in ".php", the php processor won't be invoked (in most cases). Ken
  20. Please post your code between tags. Ken
  21. Posting code without an explanation of what it's supposed to do & what it's doing is not going to get you many answers. Also, when posting code on this forum, please surround the code with tags. Ken
  22. If you're only expecting one row to be returned from the query, you don't need the while loop. You should also check if you got a result from the query, if you didn't that would explain the results, since $last_time wouldn't be set. <?php $result = mysql_query("SELECT Last_User_Time FROM ATS_MAIN WHERE Id = '$id'"); if (mysql_numrows($result) > 0) { $row=mysql_fetch_assoc($result); $last_time = $row['Last_User_Time']; echo $last_time . '<br>'; // just checking $new_last_time = date('D M j H:i:s \G\M\TO Y',strtotime($last_time) + 30); echo $new_last_time; } else { echo "No data returned from the query"; } ?> Ken
  23. I had a typo in the first code I posted. Post the code you used. Ken
  24. <?php $last_time = 'Thu Mar 10 18:33:48 GMT-0300 2011'; $new_last_time = date('D M j H:i:s \G\M\TO Y',strtotime($last_time) + 30); echo $new_last_time; ?> Ken
×
×
  • 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.