wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
You appear to be inserting the variable $webaddress in your query. This variable is not being defined in your code.
-
Where is the variable $tsid defined?
-
$_SESSION variables will not be accessible from the browser so no you won't be able to alter the session values as they are stored on the server. However If you're assigning user input to any session variables it is important you sanitize this input so that is safe to use within your SQL queries.
-
Well first you're not echo'ing the following variables correctly <option value="<?php $black ?>">Black</option> <option value="<?php $white ?>">White</option> <option value="<?php $grey ?>">Gray</option> <option value="<?php $limegreen ?>">Limegreen</option> You need to place echo before each variable otherwise nothing will be outputted and your form will submit blank values. I am assuming you have defined values for those variables too? Secondly make sure you have wrapped your form items within <form action="path/to/proccessing/page.php" method="post"></form> tags and that you have defined a submit button, eg <input type="submit" name="submit" value="Submit" />
-
if(!session_is_registered(username)){ should be if(!isset($_SESSION['username'])){ session_register() or session_is_registered() are deprecated and should no longer be used. When you want to create a session variable use the $_SESSION superglobal variable, eg $_SESSION['myvar'] = 'somevalue'. Just make sure you're calling session_start at the top of each page before using $_SESSION's
-
No need to for an array. The following is more than enough echo '<a href="blah" class="tag'. rand(1,2).'">blahM</a>';
-
Reduce multiple spaces with regex $str = 'h e l l o !'; $new_str = preg_replace('/\s+/', ' ', $str); echo "<pre>$str\n". strlen($str) . "\n\n$new_str\n" . strlen($new_str) . "</pre>";
-
How you have setup your for loop is correct. However it can be cleaned up with a foreach loop function insert($data) { echo "inserting... $data<br />"; } $prev = ''; foreach($part as $data) { if($prev != $data[1]) insert($data[0]); $prev = $data[1]; } What are you planning on doing with the insert() function?
-
You'd use regex. Here is an example $str = '[img=http://...images/smilies/smiley.gif]'; $str = preg_replace('/\[img\](.*)\[\/img\]/i', '<img src="$1" />', $str); echo $str; Use trim
-
To display results in multiple columns have a look at this FAQ.
-
You seem to be generating your query from the build_query() function. Make sure your query is being formatted correctly by echoing out the $query variable..
-
How can I turn off Register_Globals?
wildteen88 replied to Garethp's topic in PHP Installation and Configuration
Check that you don't have any .htaccess files which is enabling register_globals either. -
I believe with XAMPP the username will be root with no password. So leave the password field blank.
-
Loop in two columns, the second starting at row XXX
wildteen88 replied to brady123's topic in PHP Coding Help
This should answer your question http://www.phpfreaks.com/forums/index.php/topic,95426.0.html -
See the following FAQ.
-
Where is this md5 hash (code) generated. You can insert the hash for each row in this loop $ptdbResultsArray = array(); while ($ptdbRow = mssql_fetch_assoc($ptdbResult)) { $ptdbResultsArray[] = array_push($ptdbRow, $YOUR_MD5_HASH_HERE); } Or assign the hash as the key for each row $ptdbResultsArray[$YOUR_MD5_HASH_HERE] = $ptdbRow; To grab the hash from the key use foreach ($ptdbResultsArray as $hash => $row) { echo $hash . ' - ' . implode('|', $row) . "<br />"; }
-
If you can get access to your servers error log that will help to identify why your receiving the error. As you're using mod_rewrite just double check that the mod_rewrite module is enabled.
-
What do you mean by random code. Are you wanting to display the results in a random order?
-
Thorpes code does what you're wanting to do $ptdbResultsArray will be multidimensional array. To get the key from the foreach loop use the following format: foreach ($ptdbResultsArray as $key => $row) {
-
By looks of things you don't need to use mysql_real_escape_string at all as your form is not submitting the actual height (eg 5'9) but the array key corresponding to the height (eg 59) in the $height_arr array. Also you only need to use mysql_real_escape_string when you're inserting data into the database, not when you're grabbing data from the database. $height=mysql_real_escape_string($r["height"]);
-
Why are you using eval. This is a dangerous function to use. It seems your templates only contain HTML/CSS code in which case you do not need to use eval.
-
The simplest way to read a file and grab its contents is with the file_get_contents function. Eg <textarea><?php echo file_get_contents('path/to/file.txt') ?></textarea>