
wisewood
Members-
Posts
226 -
Joined
-
Last visited
Never
Everything posted by wisewood
-
exactly. Still dont understand how you've got max connections on if you're not letting anyone use the script except yourself and you're not using pconnect though. Is this a local install or is it on an ISP installation? Have you used this before for other projects?
-
I can only suggest finding out what the current max connections is set to, and how many connections you have running. In phpmyadmin you can find out what connections there are by doing the following; From the main page choose "show processes" This will display all active connections. At present mine shows two connections, and we have 7 users currently online, each with an automatic query running every 60 seconds.
-
**solved**What are these wierd numbers and what do they mean ?
wisewood replied to pmzq's topic in PHP Coding Help
No. lol, in a word. "UPDATE my_table SET my_field1=1" This will set the field in the table to 1. "UPDATE my_table SET my_field1=1000" This will now mean that my_field1 is 1000. It will not equal 1001, or 999. It doesnt perform any mathos on what you give it, it just UPDATEs the content of the field you specified with the value you gave it. No addition, no subtraction, it just overwrites what was there with the new data you're giving it. -
**solved**What are these wierd numbers and what do they mean ?
wisewood replied to pmzq's topic in PHP Coding Help
the mysql UPDATE doesnt perform a mathematical calculation, it just changes the value of the field to whatever you specify. If it is resetting the field to 0 when you run the 0xFE code on it, then 0xFE in terms of your script is equal to 0. Ignore the hex code translation of it... 254 is what FE is in hex. This means that if you were to convert the hex color code #FEFEFE from hex to RGB value, it would translate to R:254 G:254 B:254. In otherwords... it would be a very pale grey... almost white. But ignore that... in your case its setting the table entry to 0, so 0xFE=0. -
I cant remember where it is now, but there is a mysql ini file with a setting for max concurrent connections, simply increase that to the maximum connections you might require. However, if you're not having many users online at once at the moment (less than 20 for example) and you're not using mysql_pconnect i see no reason why this should be max'ing your connections.
-
Do you have a lot of users using the mysql database / your site at the same time?
-
Change "$x%2" to show a number for how many columns you want to be displayed. eg. $x%2 1 2 3 4 5 6 $x%3 1 2 3 4 5 6 $x%4 1 2 3 4 5 6 [code] <?php $query= "SELECT * FROM your_table"; $result = MYSQL_QUERY($query); $num = mysql_Numrows($result); if ($num==0) { echo "No Results Found !"; } else if ($num>0) { $x=0; ?> <table class="content" align="center"> <? while ($x<$num) { if (($x%2)==0) { $row="</tr><tr><td class=report>"; } else { $row="<td>"; } $whatever_variable = mysql_result($result,$x,"whatever_field"); ?> <? echo $row ?> <td class="report"> <?=$whatever_variable?> </td> <? $x++; } // end while } // end if numberall > 0 ?> [/code]
-
**solved**What are these wierd numbers and what do they mean ?
wisewood replied to pmzq's topic in PHP Coding Help
yeah, just swap it. although you should check to make sure your table contains the right character and not that code... otherwise switching to use a number instead could mess with your query results. -
**solved**What are these wierd numbers and what do they mean ?
wisewood replied to pmzq's topic in PHP Coding Help
0xFE is a hexidecimal numeric character code... I think Some info on this can be found [a href=\"http://www.delorie.com/gnu/docs/fontutils/fontu_16.html\" target=\"_blank\"]>> HERE <<[/a] and [a href=\"http://www.w3.org/International/questions/qa-escapes\" target=\"_blank\"]>> HERE <<[/a] -
[code]"SELECT * FROM notes_table WHERE client_id = $_GET[id]"[/code]
-
you have reached the maximum number of concurrent connections to your mysql database. Are you using mysql_pconnect() or mysql_connect() ? I was using pconnect for a long time, and couldnt figure out the reason why it kept maxing out. Turned out every database conection stayed open and kept adding new connections on top.
-
in your mysql query you have used variables instead of field names. instead of "WHERE $variable = $variable && $another_variable = $something_else" you should have "WHERE field_1 = $variable && field_2 = $another_variable" Hope this helps.
-
that seems to be a very odd way of going about it. could you not just assign each group a unique number, and then SELECT * FROM table WHERE unique_number = $variable. $images_in_group = mysql_num_rows($query);
-
I just modified a script that i found on the php.net documentation pages. I've just kinda thrown my own bits of code at it, so its not very tidy, but it works. Run that script, and enter a domain (ie phpfreaks.com) or IP address into the text box and hit submit. If its active, it returns the time taken... if not, it returns Not Online. PS. I have tested this with IP and domains i know are both active and inactive. It does work. [code] <?php session_start(); if(!$_POST[address]) { echo "<form method=post action=$PHP_SELF>Address: <input type=text name=address><input type=submit value=Submit></form>";} else { // Checksum calculation function function icmpChecksum($data) { if (strlen($data)%2) $data .= "\x00"; $bit = unpack('n*', $data); $sum = array_sum($bit); while ($sum >> 16) $sum = ($sum >> 16) + ($sum & 0xffff); return pack('n*', ~$sum); } // Making the package $type= "\x08"; $code= "\x00"; $checksum= "\x00\x00"; $identifier = "\x00\x00"; $seqNumber = "\x00\x00"; $data= "Scarface"; $package = $type.$code.$checksum.$identifier.$seqNumber.$data; $checksum = icmpChecksum($package); // Calculate the checksum $package = $type.$code.$checksum.$identifier.$seqNumber.$data; // And off to the sockets $socket = socket_create(AF_INET, SOCK_RAW, 1); if(!@socket_connect($socket, "$_POST[address]", null)){echo "<b>wisewood says: Not Online.</b>";} // If you're using below PHP 5, see the manual for the microtime_float // function. Instead of just using the m // icrotime() function. $startTime = microtime(true); @socket_send($socket, $package, strLen($package), 0); if (@socket_read($socket, 255)) { echo round(microtime(true) - $startTime, 4) .' seconds'; } socket_close($socket); } ?> [/code]
-
Your $_POST[variable_name] variables should have the same variable name as the name of the form field they're being sent from... so if you had; <SELECT NAME="cheesey_cheesey_cheddar"> <OPTION VALUE="Cheese"> <OPTION VALUE="Cheddar"> </OPTION> Your $_POST variable would be $_POST[cheesey_cheesey_cheddar] [code] $accommID = $_POST["accommID"]; $type = $_POST["select_type"]; $sleeps = $_POST["select_sleeps"]; $board = $_POST["select_board"]; $description = $_POST["description"]; $pets_allowed = $_POST["select_pets"]; [/code]
-
you could do it all with the one file if you really wanted to... just incorporate the html into the php file.
-
[code] function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } [/code]
-
Can you paste a copy of the code relating to that section of the page?
-
TRY THIS: <html> <head> <title><?php echo "Accommodation" ?></title> <link rel="stylesheet" type="text/css" href="template2.css"> <script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script> </head> <body> <?php require_once("config.php"); $connection = @mysql_connect($db_host, $db_user, $db_password) or die("oops! error connecting"); mysql_select_db($db_name, $connection); $self = $_SERVER['PHP_SELF']; $accommID = $_POST ["accommID"]; $len = strlen($accommID); if ($len > 0) { $accommID = $_POST["accommID"]; $type = $_POST["select_type"]; $sleeps = $_POST["select_sleeps"]; $board = $_POST["select_board"]; $description = $_POST["description"]; $pets_allowed = $_POST["pets_allowed"]; $query = "INSERT INTO accommodation (accommID, type, sleeps, board, description, pets_allowed) VALUES ('$accommID', '$type', '$sleeps', '$board', '$description', '$pets_allowed')"; mysql_query($query, $connection) or die (mysql_error()); } ?> <table border="1" width="100%" height="226"> <tr> <td width="22%" height="91" bgcolor="#0099FF"> <img alt ="[Company Logo]" src="file:///C:/Documents%20and%20Settings/Puja/My%20Documents/My%20Pictures/puj2.gif" width="100" height="100"> <p> </td> <td width="78%" height="91" bgcolor="#66CCFF" ALIGN=CENTER> <H1> Accommodation </H1> </td> </tr> <td width="22%" height="123" bgcolor="#6699FF"> <div class="buttonscontainer"> <div class="buttons"> <a href="manage_accomm.php">Manage Accommodation</a> <a href="ownerhomepage.php">Owner Homepage</a> <a href="logout.php">Logout</a> </div> </div> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </td> <td width="78%" height="123" bgcolor="#99CCFF" ALIGN=CENTER> <center> <form name="add_accomm.php" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST"> <font face="arial" size ="1"> Accommodation ID: <input type="text" name ="accommID"> Type: <select name="select_type"> <option value='Villa'>Villa</option> <option value='Caravan'>Caravan</option> <option value='Lodge'>Lodge</option> </select> Sleeps: <select name="select_sleeps"> <option value='2'>Up to 2</option> <option value='4'>Up to 4</option> <option value='6'>Up to 6</option> <option value='8'>Up to 8</option> <option value='10'>Up to 10</option> </select> <br> <br> Board: <select name="select_board"> <option value='Full Board'>Full Board</option> <option value='Half Board'>Half Board</option> <option value='B & B'>B & B</option> <option value='Self-Catering'>Self-Catering</option> </select> Pets Allowed: <select name="select_pets"> <option value='Y'>Yes</option> <option value='N'>No</option> </select> <br> <br> Description:<br> <textarea style ="width: 75%" rows="10" name="description" cols="20"></textarea> <br> <br> <center> <input type="submit" value="Add"></center> </font> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </form> </center> </td> <script language="JavaScript" type="text/javascript"> var frmvalidator = new Validator("add_accomm.php"); frmvalidator.addValidation("description","req","Please enter a Description"); </script> </table> </body> </html>
-
what currently happens when you submit the form? does it update the database?
-
I'm not sure that PHP would do what it is that you're after to be honest. ActiveX maybe? Would love to know if this is do-able though.
-
just put it straight on... copy/paste. It might be long, but at least we'll see everything relating to what you have a problem with.
-
[a href=\"http://www.freewebmasterhelp.com/tutorials/phpmysql/5\" target=\"_blank\"]http://www.freewebmasterhelp.com/tutorials/phpmysql/5[/a]
-
how to let users print there messages with php
wisewood replied to redarrow's topic in PHP Coding Help
For example... <?php $strSQL = "SELECT * FROM messages"; if ($result = mysql_query($strSQL) or die ("The Query is broken")) { $num = mysql_num_rows($result); for($i=0;$i<$num;$i++){ $message = mysql_result($result,$i,"message"); echo "$message<br>"; echo "<a href=# onClick="window.print();">Print this page</a>"; ?>