wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
PHP wont be able to display data wait a bit and then display more. You'll probably want to use javascript. When you use sleep this just tells PHP to stop processing for X a mount of time.
-
use floats instead: <div align=center style="float:left; width:50%;">No Comments</div> <div align=center style="float:left; width:50%;"><img src="galcoms.gif" style="border-style:none;"></div> Note after those two divs you'll need to clear the float, by adding clear:both to an element after those two divs.
-
no as any input the user submits for the password field will get encoded into a md5 hash. There will be no threat for SQL injection.
-
I'd use the third method: if(isset($var) && $var){ // If the var exists and evaluates true } For use with variables set from the client, eg _GET, _POST and _COOKIE.
-
[SOLVED] Undefined offset - solutions?
wildteen88 replied to bronzemonkey's topic in PHP Coding Help
There are many ways for looping through arrays. I just used one of the methods. -
Just as a side note if you want to check against multiple words a good way would be to do this: $lines = file('file.txt'); // list bad words in array $bad_words = array('test', 'ben'); foreach($lines as $line => $line_value) { $line_value = trim($line_value); // use in_array to check if the word on the current line is a bad word. // if it is we wont display it. if(!in_array($line_value, $bad_words)) { echo $line_value . '<br />'; } }
-
[SOLVED] Undefined offset - solutions?
wildteen88 replied to bronzemonkey's topic in PHP Coding Help
bronzemonkey's pic array starts at 1. Thats why I start the loop at 1. Calling count each time wont have much of a difference either (parsing time wise). However I get what you mean though. -
[SOLVED] Undefined offset - solutions?
wildteen88 replied to bronzemonkey's topic in PHP Coding Help
Change this line: for($i = 1; $i < count($pic); $i++) to: for($i = 1; $i <= count($pic); $i++) -
isset does not check variables values. isset only checks whether a variable exists or not.
-
oops, sorry I did a typo. It should be: $lines = file('file.txt'); foreach($lines as $line => $line_value) { if(trim($line_value) != 'test') { echo $line_value . '<br />'; } }
-
Try using: echo "<td>" . $_SESSION['Posted_values']['myvalue'][$i] . "</td>"; instead of echo "<td>" . $_SESSION['Posted_values']['myvalue'] . "</td>"; $_SESSION['Posted_values']['myvalue'] contains an array.
-
How to pass all GET variables using PHP_SELF?
wildteen88 replied to hatrickpatrick's topic in PHP Coding Help
You'll probably want to look at $_SERVER['QUERY_STRING']. This variable holds all the query strings being passed to the page: echo $_SERVER['PHP_SELF'] . '? ' . $_SERVER['QUERY_STRING'] ; -
Yes that is correct. However if you inserting text submitted from a form into a database don't use nl2br in that sense. Only use nl2br when you get the content out of the database. If you use nl2br when you insert text into a database you may find PHP will duplicate the newlines.
-
[SOLVED] Undefined offset - solutions?
wildteen88 replied to bronzemonkey's topic in PHP Coding Help
Change this code: <li><?php echo $pic[1]; ?></li> <li><?php echo $pic[2]; ?></li> <li><?php echo $pic[3]; ?></li> <li><?php echo $pic[4]; ?></li> <li><?php echo $pic[5]; ?></li> <li><?php echo $pic[6]; ?></li> <li><?php echo $pic[7]; ?></li> <li><?php echo $pic[8]; ?></li> into a loop: for($i = 1; $i < count($pic); $i++) { echo '<li>' . $pic[$i] . "</li>\n "; } -
You'd just use an if statment that will check to see if the current lines value does not equal to test then print the line, eg: $lines = file(file.ext); foreach($lines as $line => $line_value) { if($line_value != 'test') { echo $line; } } If the lines contains more than one word then you might have to use eregi or strpos which will check to see if the word test is used within the line.
-
Yes PHP can connect to remote databases. You'd do this: $conn = mysql_connect('siteTwo.co.uk', 'username', 'password'); mysql_select_db('database'); Just make sure the database on siteTwo.co.uk allows for remote connections from siteOne.co.uk.
-
In the following code: <?php $_SESSION['Posted_values'] = array(); foreach($_POST as $fld => $val) $_SESSION['Posted_values'][$fld] = $val; echo '<pre>' . print_r($_SESSION,true) . '</pre>'; ?> PHP is looping through the $_POST array variable which it then stores all _POST data into the Posted_values session variable. In your second block of code where does $myvalue come from? Looks like you are pulling data out of the database then you seem to pop $myvalue into that block of code from no where. If you want to use the myvalue from the Posted_values session you should use $_SESSION['Posted_values']['myvalue'] instead.
-
This is because you have a setting called: allow_url_include disabled within the php.ini This prevents you from using urls within include paths. By default PHP has this setting disabled.
-
You don't. You should keep them where they are. Never move files out of or move files around the php installation folder. Keep all files as they are. What you should do is configure extension_dir in the php.ini to point to PHP's extension folder, eg: extension_dir = "C:/php/extension" (change C:/php to PHPs installation path) And add the php folder, eg C:/php (just the path to PHP installation path) to the Windows Path as I mentioned in my post earlier. Note: When you add PHP to the path you must restart Windows.
-
If you mean when you echo something all output its all one line when you view source. This is becuase PHP does not place end of line characters automatically after echo or print statement. PHP will only return what is actually defined between the the quotes. In order for your code to output newlines you will need to use \n in your echo statement eg: echo "line1\n"; echo "line2\n"; The result when your view the source code from the browser it'll be like this: line1 line2 Note: whitespace characters, such as: \n, \r, \t etc. Will only work within double quotes and not single quotes. If you use single quotes PHP will treat the whitespace characters as text
-
I prefer to place opening and closing braces on separate lines, eg: if(bla) { if(blah bla) { more codee } code here } That will make sure code more readable, cleaner and easier to match braces. Some editors have built in brace matching, which means when you're in a code block (code between { and }) it'll highlight the matching braces for that code block. I'm sure Notepad++ has this feature.
-
If you are using MS Word to create web pages the I advise you strongly to not use MS Word for creating webpages. Instead look into getting a proper HTML editor. There are loads around. or the better option is to code your pages yourself.
-
[SOLVED] loadmodule will not load to server
wildteen88 replied to syngod's topic in PHP Installation and Configuration
I guess you was using short tags (<? ?>). Short tags is disabled by default within the php.ini. I do recommend you to always use the full tags (<?php ?>). When you use the full tags it will allow for your code to be more compatible through different PHP setups. -
php_curl.dll requires two other libraries (ibeay32.dll and ssleay32.dll) which should be located in the root of PHP installation folder. You should keep all extension files (php_*.dll) in the extension folder, you'll want to configure the extension_dir directive in the php.ini to point to the extension folder located in PHP's installation folder. Also It is a good idea to add PHP to the Windows Path.
-
the id in the gang table and members table will be unique as they are populated using auto_increment. We setup a gang_id in the members table to link the member to gang the member is part of. This is how it is how it is basically done. If you do not understand I would recommend you to read up on database normalization.