Jump to content

mrt003003

Members
  • Posts

    174
  • Joined

  • Last visited

    Never

Everything posted by mrt003003

  1. Hi im using dream weaver and ive created a form that can be updated: if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE ships SET FleetName=%s, HealthA=%s, HealthB=%s WHERE ShipID=%s", GetSQLValueString($_POST['select'], "text"), GetSQLValueString($_POST['textfield'], "int"), GetSQLValueString($_POST['textfield2'], "int"), GetSQLValueString($_POST['hiddenField'], "int")); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($updateSQL, $swb) or die(mysql_error()); $updateGoTo = "fleet.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } I want to parse a parameter after its updated and directed to another page but i cant seem to get it to work: $updateGoTo = "fleet.php?recordID=$row_Ship['FleetName']"; Someone mentioned a http build query would help here: $qs = $_GET; // copy everything from the URL $qs["recordID"] = $row_Ship["FleetName"]; header("Location: fleet.php?" . http_build_query($qs)); exit; // important! Thing is im new to php and am not sure how to integrate this query with the exisitng code.. Any help would be greatly appreciated. Thank You
  2. Hi there, thanks for the reply. Would this replace part of the existing above code?? If so how does it fit together please?? Sorry im fairly new to this. Thank You
  3. Hi there, im trying to echo a hyperlink and parse a url parameter. Its not quite working as iam getting T-string error. If someone with fresh eyes could quickly glance for me that would be ace. <?php if ($row_ship['PlayerName'] == '$_SESSION['MM_Username']'){ echo '<a href="ship_edit.php?recordID='.$row_Ship['ShipID'].'">Edit</a>';} ?> Thank You
  4. Hi there im using dream weaver and ive created a form that can be updated: if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE ships SET FleetName=%s, HealthA=%s, HealthB=%s WHERE ShipID=%s", GetSQLValueString($_POST['select'], "text"), GetSQLValueString($_POST['textfield'], "int"), GetSQLValueString($_POST['textfield2'], "int"), GetSQLValueString($_POST['hiddenField'], "int")); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($updateSQL, $swb) or die(mysql_error()); $updateGoTo = "fleet.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } I want to parse a parameter after its updated and directed to another page but i cant seem to get it to work: $updateGoTo = "fleet.php?recordID=$row_Ship['FleetName']"; Please help Thanks
  5. thats cool it is working! Its some else that isnt. Thanks Joe
  6. Thanks Joe ill check coda out.. Ive been using dream weaver for far too long now. I tried the modified bit and its still not working undefined variable $row_Detect heres the dream weaver created code for the session: if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } Thanks
  7. Yeah i see your point Joe, ill update on a single page afterall... Can i ask you some thinkg quickly on a different matter please?? Im using dream weaver and i search a tables playername to match a session variable MM_Username (which is set to a playername) mysql_select_db($database_swb, $swb); $query_Detect = sprintf("SELECT * FROM fleet WHERE PlayerName = %s", GetSQLValueString($colname_Detect, "text")); $Detect = mysql_query($query_Detect, $swb) or die(mysql_error()); $row_Detect = mysql_fetch_assoc($Detect); $totalRows_Detect = mysql_num_rows($Detect); All i want to do i select all records that are NOT equal to the session variable and i add the ! $query_Detect = sprintf("SELECT * FROM fleet WHERE PlayerName != %s", GetSQLValueString($colname_Detect, "text")); The trouble is it doesnt work.. Any ideas? Thank you
  8. Hi JKG is see what you mean here. I was hoping it would work so that when a user edited anything to do fleets they would do it in the fleet page, ships in the ship page and so on. I can only visualise that being done indivually with a form and update on each page. So how would the data be parsed from each of the fleet, ships etc pages to the updateform that updates them all at the same time. Sorry I probably sound really stupid :| Thanks
  9. thanks for the reply. Im not quite sure i understand the concept. Would each page have its own form where the data is parsed to an update page? Thanks
  10. Hi there, Im fairly new at php and mysql but nevertheless im trying to build a web based campaign game for starwars minatures boardgame. Its fairly straightforward and going well.. However ive been thinking about how it will work and have stumbled across a possible problem (because of my limited craft at programming). I want to have a single form that updates all records in the tables, this would simulate an "end of turn" button. Im sure i can do this if doing stuff in the game (e.g. move, create , modify, delete, fleets/ships and auto increment ships hulls simulating repair) if it was done on the same page. However i wanted to to initiate some of these adjustments in their respective pages (fleet.php, planets.php, ships.php etc) and then once the user is happy to click the end turn button somewhere which would update all of these things at the same time.. Is this possible at all??? If anybody could help that would be brilliant. Thank you p.s. if anybody wants a copy of the finished product when its complete, your most welcome.
  11. Ive done it... sorry i was being really stupid. Thanks for your help
  12. Hi there, thaks for the reply thats geat! It doesnt quite work for me though although it does show the link when highlighted: http://localhost/swb/planet.php?recordID=Mon Calamari/ but doesnt parse the id to the query on the other page... the url also only says: http://localhost/swb/planet.php.... without the parsed record id. Could it be because of the / at the end of the Mon Calamari??? If so how do i adjust it, i find it confusing when done in an echo. Thanks
  13. Hi there im trying to parse a url parameter in a hyperlink, i cant seem to get it to work, im sure its a problem with the braces. This is the original code: echo '<a href="http://localhost/swb/planet.php/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>'; and i tried to modify it to parse the record id... echo '<a href="http://localhost/swb/planet.php?recordID= '$row_cats['CatName'];/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>'; If you could help me that would be ace. Thank you
  14. Incase i seem a bit vague im echoing the variable: $moncalimari = "Mon Calimari 1-1-2-6"; echo '<p class="moncalimari">' . $moncalimari . '</p>';} When the text is diplayed on screen it looks like: Mon Calimari 1-1-2-6 Thanks
  15. Hi there i think im having trouble with my css.. .moncalimari { position: absolute; visibility: visible; left: 1560px; top: 352px; color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } When i enter the text "Mon Calimari" the Calimari bit is entered on a new line... I want it to stay together on the same line "Mon Calimari" Is there something missing from my css??? Thanks
  16. Yes thats it exactly! I was beginning to think it would have had to be in a div. Im sorry if i seemed a bit vague Thank you very much for your help.
  17. Hi there and thanks for the reply. Thats fixed the error but the class="somecssclass" is simply echoed after the text variable and is not actually formating the text. Thanks
  18. Hi there i just need to assign a class to my echoed vairable. echo $test class="somecssclass"; Im sure im missing some braces here or something but i cant seem to find it out. Heres the error: Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' Please help Thanks
  19. Oopps, i realise i left out the brackets if ($_SESSION['MM_Username'] == 'Empire'){ echo'<img src="Images/empicon.jpg" width="20" height="20" class="moncalimari"/>' ; } ?>
  20. Hi there can anybody help me please? my if statement isnt working?? All i am trying to do is display an image if the session variable is == entered varialble "Empire" I get the error message "Parse error: syntax error, unexpected T_VARIABLE, expecting " if $_SESSION['MM_Username'] == 'Empire'{ echo'<img src="Images/empicon.jpg" width="20" height="20" class="moncalimari"/>' ; } ?> I have checked and the session does == Empire Please help Thank you.
  21. Hey thats brilliant, Did the trick! Thank You very much Tom
  22. Hi, i was wondering if any body could help me. im receiving this error when trying to delete a record on my DB Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\Jobs Database\job_delete.php:1) in C:\wamp\www\Jobs Database\job_delete.php on line 36 This is the code for my page: <title>Delete Job</title><?php ob_start(); require_once('Connections/job_db.php');?> <?php if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) {   $deleteSQL = "DELETE FROM jobs WHERE `Job ID`=" . $_GET['recordID'];   mysql_select_db($database_job_db, $job_db);   $Result1 = mysql_query($deleteSQL, $job_db) or die(mysql_error());   switch($_GET['retpage']){   case "complete";   $deleteGoTo = "job_by_complete.php"; break;   case "username";   $deleteGoTo = "job_by_username.php"; break;     case "date";   $deleteGoTo = "job_by_date.php"; break;     case "incomplete";   $deleteGoTo = "job_by_uncomplete.php"; break;   case "id";   $deleteGoTo = "job_by_id.php"; break;   default:   $deleteGoTo = "job_by_id.php";   }     header(sprintf("Location: %s", $deleteGoTo)); } ob_flush(); ?> If any body could help that would be great. Thank You very much  :)
×
×
  • 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.