wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
What variable are you passing mysql_affected_rows? You should be giving it the $result variable not the $query variable.
-
Undefined index. Could be caused by sessions
wildteen88 replied to AdRock's topic in PHP Coding Help
You should only add the session keys to $session_array not the session values $session_array = array('userid', 'username', 'email', 'user_level', 'encrypted_id', 'encrypted_name', 'encrypted_email', 'encrypted_user'); Then your foreach loop should be foreach($session_array as $key) { if(strcmp($_SESSION[$key], $items[$key]) != 0) { return false; } } -
Getting the host URLs from a list of URLs submitted
wildteen88 replied to paymentstv's topic in Javascript Help
What do you need help with Javascript or PHP? This is a PHP forum for PHP code only. Javascript support is provided in the Javascript forum. -
This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=338907.0
-
Getting the host URLs from a list of URLs submitted
wildteen88 replied to paymentstv's topic in Javascript Help
You're setting a javascript variable and expecting to use it within your PHP code!. You cannot mix Javascript with PHP, they are completely different languages. -
$comnents .= should be $comments .=. I spelt comments wrong when I posted my code.
-
Have a look at this article for tips on writing secure PHP code. Also you might want to check out http://shiflett.org too.
-
To insert the latest post so it at the top you'll need to change the way your script adds the comments to messages.txt. As it is now your appending the latest comment to the file, which means the latest comment will always be added to the end of file. In order to add the latest comment so it at the top of the file you'll first need to get all the comments that is in messages.txt and then prepend the latest comment. Which will be like this: // add the newest comment to the start of the file $comments = "<div id=\"comments_box\"><div id=\"comment_name\"><p>$message <em>Says:</em></div><br />$message2</p></div>"; // this is the new comment to be added $comments .= file_get_contents('messages.txt'); // now we get all the existing comments and append it to the $comments variable. // write all the comments back to the file with the newest comment first $fp = fopen('messages.txt', 'w'); fwrite($fp, $comments); fclose($fp); To add the date look into using the date function.
-
Use mysql_affected_rows when checking to see your query updated any records. mysql_query will return true even though the query did not make any changes to the database.
-
You now have a error in your code. Post the first 20 lines here
-
The sid is being passed as an hidden input field <td><input name="id" type="hidden" id="id" value="<? echo $rows['sid']; ?>"></td> The hidden input field name is called id to get the sid you'd use $sid = $_POST['id'];
-
This is your form input fields. <td><input name="stitle" type="text" id="stitle" value="<? echo $rows['stitle']; ?>" size="15"></td> <td><input name="datepicker" type="text" id="datepicker" value="<? echo $rows['datepicker']; ?>"></td> <td><input name="sbody" type="text" id="sbody" value="<? echo $rows['sbody']; ?>" size="15"></td> <td><input name="ipaddress" type="text" id="ipaddress" value="<? echo $rows['ipaddress']; ?>" size="15"></td> <td><input name="date" type="text" id="date" value="<? echo $rows['date']; ?>" size="15"></td> Each fields value is stored within the $_POST superglobal array when the form is submitted. The form is submitted to update_ac.php. In this file before line 17 you need to extract these values from the $_POST superglobal array. Here is an example of getting the first two values from your form $stitle = $_POST['stitle']; // get the value from the form field named "stitle" $datepicker = $_POST['datepicker']; // get the value from the form field named "datepicker" // etc See if you can work out how to get the remaining values from your form.
-
Learn to use Cascading Style Sheets (CSS)
-
mkdir is failing because the folder(s) already exists. Change mkdir("members/$id", 0755, true); to if(!is_dir("members/$id")) { mkdir("members/$id", 0755, true); } else { echo "the folder members/$id already exits!"; }
-
try mkdir("members/$yourr_var", 0755, true);
-
This topic has been moved to Introductions. http://www.phpfreaks.com/forums/index.php?topic=338877.0
-
Then replace 001 with your actual variable and replace the single quotes with double quotes mkdir("members/$yourr_var");
-
If ($resultPosted="checked") You should be using the comparison operator == not the assignment operator = in the above line
-
First create the members folder and then give it write permissions (0755 or 0777). Then in your PHP script you'd use mkdir('members/001'); to create the 001 folder within the members folder.
-
The variables $stitle, $datepicker, $sbody and $sid are not defined in update_ac.php. Variables need to be defined before you can use them. Line 17 in update_ac.php is where you using these undefined variables $sql="UPDATE $tbl_name SET stitle='$stitle', datepicker='$datepicker', sbody='$sbody' WHERE sid='$sid'"; I suspect these variable are from your form. In which case you need to get them from the $_POST superglobal variable first. Example $stitle = $_POST['stitle']; $datepicker = $_POST['datepicker']; // etc
-
Use number_format or sprintf
-
That SSD is fine, it is one of the best 1st generation SSDs. I have the 64GB version and I have no issues with it. To get the maximum speed make sure you connect it to a SATA 3 6Gb/s port. If you don't have a 6Gb/s port it still work fine on a standard SATA 2 3Gb/s port at reduced speed which you will hardly notice.
-
And is this the following code executed within the while loop? <div id="google_map"> <div align="right" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div> <?php echo'<iframe width="550" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/api/staticmap?center='. $lat .',' . $lon . '&zoom=12&markers=color:red|label:B|' .$lat . ',' . $lon . '&size=550x300&sensor=false">">';?></iframe> <div align="left" style="padding:4px; background-color:#D2F0D3;"><a href="#" onclick="return false" onmousedown="javascript:toggleViewMap('google_map');">close map</a></div> </div> If you place it after the while loop then only last $lat and $lon values will be used.
-
Where are you defining the $lat and $lon variables?