Jump to content

Tazerenix

Members
  • Posts

    232
  • Joined

  • Last visited

    Never

Everything posted by Tazerenix

  1. then just use the second half of that script, ignore the $createtbl part. You'll still need both arrays tho
  2. // create table with first array $createtbl = "CREATE TABLE **tablename** ( "; foreach($array1 as $header) { if ($header == "PID") $createtbl .= "`" . $header . "` AUTO_INCREMENT NOT NULL,"; else $createtbl .= "`" . $header . "`,"; } $createtbl .= "PRIMARY KEY(`PID`) )"; if (!mysql_query($createtbl, $conn)) { echo mysql_error(); } // insert data with second array $insertdata = "INSERT INTO **tablename** ("; foreach($array1 as $columns) { if ($columns == "PID") break; // Dont need to insert the first value else $insertdata .= "`" . $columns . "`,"; } $insertdata .=") VALUES ("; foreach($array2 as $count => $data) { if ($count == 0) break; // dont insert id else $insertdata .= "`" . $data . "`,"; } $insertdata ,= ")"; if (!mysql_query($insertdata, $conn)) { echo mysql_error(); } // Everything should have worked if no mysql errors were shown If that doesnt work just echo $createtbl and $insertdata and edit them with notepad then enter query manually The code above will probably fail tho, i havent tested it
  3. well if you want to run a decent OS your gonna need more than 1gb. To run vista you'll need at least 2 and same for windows 7. Otherwise it just runs terrible
  4. yea you should have at least 4gb RAM. Try Compaq, there great
  5. use javascript: function ie() { if (navigator.appName == "Microsoft Internet Explorer") { document.write("<a href=\"javascript:void(0)\" onclick=\"window.open(\'select_ok.php?produto='.$id.'&acao=Excluir\',\'\',\'width=100,height=100\')\"><img src=\"images/delete_bt.png\" border="0" /></a>"); } else { document.write('<form action="#" method="post"> <input name="produto" value="'.$this->dados[$i]['codigo'].'" type="hidden" > <input TYPE="image" SRC="images/delete_bt.png" BORDER="0" name="acao" value="Excluir" > </form>'); } } then call it with <script type="text/javascript">ie()</script> And that should work.
  6. i have used header('location') after my header has been sent many times. Seems to work fine for me
  7. Thats ok if your headers havent been sent, othwise youll need javascript: function redirect( $url ){ if (! headers_sent( ) ){ header( "Location: ".$url ); exit( 0 ); } echo "<script language=Javascript>document.location.href='".$url."';</script>"; exit( 0 ); } redirect('http://www.yoursite.com/'); //redirect to any url actually your wrong. Location can be called even after the headers have been sent
  8. you should only use an object in your code where you need an object in your code. For example, dont make a class called misc and put all your functions in it. As that is not needed and can slow down your code. But, depending on what you want in your cms, say if you wanted a database system that parses data before execution or something, you could create a database class for that. But dont just make classes for everything.
  9. how are you entering it into the database
  10. <html> <?php include("lib.php"); define("PAGENAME", "Resting"); $player = check_user($secret_key, $db); ?> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript"> function updateTable() { $("#resting").load('enhp.php'); alert("You healed 1HP and 1Energy point!"); } </script> </head> <body> <?php echo '<center>'; if ($player->hp == $player->maxhp && $player->energy == $player->maxenergy) { echo "<i>You have full HP and Energy.</i>\n"; exit; } else { if ($_GET['act'] == "rest") { echo '<div id="resting"></div>'; echo '<script type="text/javascript">setInterval("updateTable()",12000);</script>'; echo 'You are now resting. You will gain 1hp and 1energy point every 5 seconds. To unrest type "unrest"'; } } echo '</center>'; ?> </body> </html> That should work. Your problem was that the .load jQuery function requires a selector to load into. I've created the div resting. If enhp.php outputs any text it will be loaded into #resting. But as enhp is just getting database querys (isnt it?) it shouldnt do anything. But that should work.
  11. check php.net for it, or w3schools, they have great function references for things like this
  12. if($_POST['submit']{ $comname = $_POST['comname']; $fname = $_POST['fname']; $lname = $_POST['lname']; $phone = $_POST['phone']; $email = $_POST['email']; $add = $_POST['add']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $stuf = $_POST['stuf']; $conn = mysql_connect("localhost","user","pass") or die('Error: ' . mysql_error()); mysql_select_db("database", $conn) or dir(mysql_error()); $sql = "INSERT INTO `table` (`ID`, `comname`, `fname`, `lname`, `phone`, `email`, `add`, `city`, ` state`, `zip`, `stuf`)VALUES (NULL, '$comname', '$fname', '$lname', '$phone ', '$email', '$add', '$city', '$state', '$zip', '$stuf');"; mysql_query($sql) or die('Error: ' . mysql_error()); echo "Info submited: ".$comname." ".$fname." ".$lname." ".$phone." ".$email." ".$add." ".$city." ".$state." ".$zip." ".$stuf. mysql_close(); } else{ die("form was not filled out right"); } } ?> should work
  13. unless the server needs to be acting on the data all the time you dont really need to. But i suppose if you really needed too, something like a search engine that updates its searches or something
  14. regardless. If no1 is viewing the site they dont need to be updated every ten seconds. Just set it so on pageload it loads the php page with the queries so it will update when a user goes on the site, or every 10 seconds
  15. of course it is. jQuery ajax will allow you to load a php page into a division of your page. Inside that php page just put your queries and the layout of your table
  16. no. AJAX uses XMLHttpRequests so it would only reload the Table. Not the whole page
  17. only if your typeing in a textarea Also: PHP doesnt actually have forms. Try htmlfreaks.com
  18. you could use jQuery AJAX to load a page with the relevant information into the table every ten seconds.
×
×
  • 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.