
mrt003003
Members-
Posts
174 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
mrt003003's Achievements

Regular Member (3/5)
0
Reputation
-
Hi there I have a parent window that if certain php conditions are met it echos a child window. if ...... php condition.....{ echo "<script type='text/javascript'>"; echo " window.open('http://localhost/swb/events.php','new_window1','status=1,scrollbars=1,resizable=0,menu=no,width=1000,height=800');"; echo "</script>"; } After the child window is created the user then uses that window on various different pages within it. I want to make it that when the child window closes the parent page is then refreshed (And if again the php conditions have been meet the child window will be echoed again). The trouble is that the user navagates over various pages within the child window. Can you help me please because im quite stuck. Thank you
-
Hi there i have a parent window that on a php event will open a new child window. This child window is used over various pages and then navigates back to the original page in the child window and thats the problem. Ive got it working so that indeed the parent window does refresh but everytime i use the child window to navigate to another page. I need to be able to do the stuff on the pages in the child window and then go back to the same start page in the child window and close and refersh. Im probably not making much sense.. Thanks
-
Yay its fixed DELETE fleet.* FROM Fleet LEFT JOIN Ships ON fleet.FleetID = ships.FleetID WHERE ships.FleetID IS NULL Thank you
-
The error is: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'f LEFT JOIN Ships s ON (f.FleetID = s.FleetID) WHERE s.FleetID IS NULL' at line 2 Thanks
-
Hi there, Im trying to delete a record from one table where the id of that table is not used in the 2nd table. I can get it to work fine with a select but not as a delete: SELECT * FROM Fleet f LEFT JOIN Ships s ON (f.FleetID = s.FleetID) WHERE s.FleetID IS NULL This works fine but if i try to delete DELETE * FROM Fleet f LEFT JOIN Ships s ON (f.FleetID = s.FleetID) WHERE s.FleetID IS NULL It gives me a mysql error?? Any ideas?? Thanks
-
Hi there, I was wonderin if its possible to create a select query from one table thats Where clause is determinded from another table. For example my 2 tables are: Structures and Planetstructures. Structures holds the structure details and Planetstructures holds the planet details and the structure detals etc.. When there are 3 of any planetstructure records of the same type, i want to select the data in the structures table leaving out the structure that coresponds to the planetstructure with more than 3 records of the same type. SELECT s.StructureName, s.Maintenance, g.PlanetStructureID, g.ConstructionTime, g.PlanetID FROM structures s LEFT JOIN planetstructures g ON (s.StructureID = g.StructureID) WHERE p.PlanetID = %s[b] AND Totalrows of any one type < 3 I hope ive made sense. Any ideas on how i can achieve this please?? Thanks
-
Thank you! I was up far to late tryingf to fix this last night and was obviously too tired!
-
Hi there im going a little bit mad now.... i spent a while trying to work out why my form didnt update or redirect... After head scratching i remade a test form... That also doesnt update or redirect?? I must be missing something here?? So basically when the user clicks submit nothing happens, why?? <?php require_once('Connections/swb.php'); ?> <?php session_start(); 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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE player SET `Day`=%s WHERE PlayerName=%s", GetSQLValueString($_POST['days'], "int"), GetSQLValueString($_POST['playername'], "text")); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($updateSQL, $swb) or die(mysql_error()); $updateGoTo = "logout.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST"> <input type="button" value="End Turn" /> <input name="days" type="hidden" id="days" value="1"/> <input name="playername" type="hidden" id="playername" value="<?php echo $_SESSION['MM_Username']; ?>"> <input type="hidden" name="MM_update" value="form1"> </form> </body> </html> Thanks
-
Hi there, Ive never used AJAX before and was hoping for a point in the right direction. Im have a psp/mysql site. I have a drop down menu in a form that is populated from a table - Names. I need it so that when a name is selected by the user a hidden field in the form is updated with a value. So that both fields would be updated in the database at the same time on submitting the form. Any ideas on where i can find a tutorial or guide to achieve this please??? Thanks
-
Hi there i have some delete link and processing code here: <?php planet.php page echo'<a href="http://localhost/swb/cancelship.php?recordID='.$row_Ships['ShipID'].'" class="arialred" style="color: #FF0000">Cancel</a>'; cancelship.php page if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) { $deleteSQL = sprintf("DELETE FROM ships WHERE ShipID=%s", GetSQLValueString($_GET['recordID'], "int")); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($deleteSQL, $swb) or die(mysql_error()); $deleteGoTo = "planet.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); }?> The trouble is that the page the delete links on is determined by an ID from a different table. After i delete the record i wish to remain on the original page but parse the PlanetID. At the moment it just loads the original page again but because it doesnt parse the PlanetID so the page doesnt work. Original page that has the delete link has PlanetID key. From that you are given a list of these delete links with their own key ShipID, which is used to delete those records. So how can i parse the PlanetID back???? Thanks
-
php Insert not inserting with echoed form elements
mrt003003 replied to mrt003003's topic in PHP Coding Help
Yeah thats it! Thank you very much, its all working -
php Insert not inserting with echoed form elements
mrt003003 replied to mrt003003's topic in PHP Coding Help
Its now inserting and redirecting...!!! I had some form elements set as text and not int... Its still not quite working right though as it only ever inserts the first record, even if im clicking submit on the second record??? Am i missing something here? Is there a problem with using echoed form elements in a loop?? For example, i have records that are outputted and with each row is a form with submit button and hidden fields.. Its only ever inserting the first row in the database regardless of submiting a different row??? THanks -
php Insert not inserting with echoed form elements
mrt003003 replied to mrt003003's topic in PHP Coding Help
Hi there thanks for replying, yes i see i missed that out, so ive added it and moved the end of the </form> tag within the do loop. echo "<input type='hidden' name='MM_insert' value='form1'>"; echo'</form>'; It still doesnt instert anything or redirect page tho? Thanks -
php Insert not inserting with echoed form elements
mrt003003 replied to mrt003003's topic in PHP Coding Help
I did just not the action bit in the form is empty and modified it to: [cdoe]echo'<form id="form1" name="form1" method="post" action="'.$editformaction.'">'; Its still not inserting or redirecting tho?? :| -
Hi there im having trouble with my code and was hoping someone may be able to help me? I think the trouble i am having is because i am echoing the form elements (form, hidden) and the value in those elements. This part is fine i think: $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")){ $insertSQL = sprintf("INSERT INTO ships (ShipName, FleetID, PlayerName, Image1, Image2, Credits, HealthA, HealthB, MaxHealthA, MaxHealthB, Class, Hyperspace, PlanetID, Building, Maintenance) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['shipname1'], "text"), GetSQLValueString($_POST['fleetid1'], "int"), GetSQLValueString($_POST['playername1'], "text"), GetSQLValueString($_POST['image11'], "text"), GetSQLValueString($_POST['image21'], "text"), GetSQLValueString($_POST['credits1'], "int"), GetSQLValueString($_POST['healtha1'], "int"), GetSQLValueString($_POST['healthb1'], "int"), GetSQLValueString($_POST['maxhealtha1'], "int"), GetSQLValueString($_POST['maxhealthb1'], "int"), GetSQLValueString($_POST['class1'], "int"), GetSQLValueString($_POST['hyperspace1'], "int"), GetSQLValueString($_POST['planetid1'], "int"), GetSQLValueString($_POST['building1'], "int"), GetSQLValueString($_POST['maintenance1'], "int")); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($insertSQL, $swb) or die(mysql_error()); $insertGoTo = "planet.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } The problem may lay here: <?php echo'<form id="form1" name="form1" method="post" action="">';echo'<table width="400" border="0" align="top">'; do { echo '<tr> <td width="200" align="center">'; echo '<span class="arial12">'; echo "<img src=".$row_Ships["Image1"]." height =\"250\" width=\"400\">"; echo'| Maintenance: '; echo $row_Ships['Maintenance'];echo ' | '; echo'<input type="submit" name="Submit" value="Build" />'; echo' | Construction Time: '; echo $row_Ships['Building']; echo' | ';echo '</td></tr>'; echo" <input name='fleetid1' type='hidden' id='fleetid1' value='".$totalRows_Fleet." + '1''/>"; echo" <input name='fleetname1' type='hidden' id='fleetname1' value='Fleet ".$totalRows_Fleet." + '1''/>"; echo" <input name='shipname1' type='hidden' id='shipname1' value='".$row_Ships['ShipName']."'/>"; echo" <input name='playername1' type='hidden' id='playername1' value='".$_SESSION['MM_Username']."'/>"; echo" <input name='credits1' type='hidden' id='credits1' value='".$row_Ships['Credits']."'/>"; echo" <input name='image11' type='hidden' id='image11' value='".$row_Ships['Image1']."'/>"; echo" <input name='image21' type='hidden' id='image21' value='".$row_Ships['Image2']."'/>"; echo" <input name='healtha1' type='hidden' id='healtha1' value='".$row_Ships['HealthA']."'/>"; echo" <input name='healthb1' type='hidden' id='healthb1' value='".$row_Ships['HealthB']."'/>"; echo" <input name='maxhealtha1' type='hidden' id='maxhealtha1' value='".$row_Ships['MaxHealthA']."'/>"; echo" <input name='maxhealthb1' type='hidden' id='maxhealthb1' value='".$row_Ships['MaxHealthB']."'/>"; echo" <input name='class1' type='hidden' id='class1' value='".$row_Ships['Class']."'/>"; echo" <input name='hyperspace1' type='hidden' id='hyperspace1' value='".$row_Ships['Hyperspace']."'/>"; echo" <input name='maintenance1' type='hidden' id='maintenance1' value='".$row_Ships['Maintenance']."'/>"; echo" <input name='Planetid1' type='hidden' id='planetid1' value='".$row_Credits['PlanetID']."'/>"; echo" <input name='building1' type='hidden' id='building1' value='".$row_Ships['Building']."'/>"; } while ($row_Ships = mysql_fetch_assoc($Ships)); echo '</table></form>';?> No records are insterted at all?? The page redirection after insert is not happening either. If anybody coould help that would be brilliant... Thank You