wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
use ucwords $word = 'UNITED STATES'; echo ucwords($word); // United States
-
Change this line: if($i = $numrows){ to: if($i == $numrows){
-
Just use highlight_string/highlight_file for a good example of syntax highlighting.
-
Maybe: <style> #div1, #div2 { width: 200px; float: left; } </style> <?php $max_loops = 10; $half_way = $max_loops/2; echo '<div id="div1">'; for($i = 1; $i <= $max_loops; $i++) { echo $i . '<br />'; if($i == ceil($half_way)) echo '</div><div id="div2">'; } echo '</div>'; ?>
-
How do you mean by half done. What are you trying to do?
-
Functions cannot use variables outside of their scope. functions have there own scope. if you want to use variables that are out side of the functions scope you'll need to set them as global within the function eg: function error_field($error, $field) { global $oldvalue, $newvalue; You have to list each individual variable to be global for every function that uses them.
-
pocobueno1388 the websites you posted do not actually decrypted an md5 hash/string. All them sites have a database which stores md5 hashes for commonly used words, such as the word 'the'. If you enter the md5 hash for the word 'the' you'll notice it return the word 'the'. But if you hased the word '7h3' (7 for t and 3 for e inreplacement) you may find that it wont return the original word. There is no way to easily decrypt an md5 hash except to use brute force.
-
Jusy noticed you are using an in-line if/else statement using the ternary operators. I guess this code runs before and after the form is submitted. The post variable will only be populated when the form is submitted. So if you are using this code: $_POST[$DateVar] ? date('D. M d, Y', strtotime($_POST[$DateVar])) : date('D. M d, Y', strtotime($DateStart)); PHP is expecting that the index (ccDateStart (stored in $DateVar)) exists within the post variable. If it is doesn't PHP will report a notice that its undefined (doesn't exist). What you'll want to do is use isset to see whether the variable/index exists first before using it: $Date = (isset($_POST[$DateVar]) && !empty($_POST[$DateVar])) ? date('D. M d, Y', strtotime($_POST[$DateVar])) : date('D. M d, Y', strtotime($DateStart)); Try the above code for line 259. The Undefined index notice message should now disappear.
-
That has nothing to do with PHP. PHP ignores all text between /* and */ or after // or # . However it does have something to do with third apps such as phpDoc which can process comments to create documentation for a specific function/class or block of code within a script.
-
I have changed your format of the days variable. Notice I have changed it so the price is not an array within the days variable, as you are only storing 1 piece of information for each food item. Make sure you are using the days variable in my code within your code. Sorry I forgot to mention that earlier.
-
You are using single quotes around your variables on line 259. PHP will not parse variables within single quotes, pHP will treat them as-is (normal text). Remove the single quotes around $DateVar: 259 $Date = $_POST[$DateVar] ? date('D. M d, Y', strtotime($_POST[$DateVar])) : date('D. M d, Y', strtotime($DateStart));
-
undefined indexes are to do with arrays, not when assigning a variable a string. You sure you got the right line?
-
What version of PHP are you using. If its PHP5.2.x then ignore that line instead refer to the other line beneath it (Loaded Configuration File). That line should show the full path to php.ini file PHP is using. If you don't see a Loaded Configuration File line or it is set to None then PHP is unable to find your php.ini. PHP cannot access its containing folder (C:/php). PHP only searches for the php.ini in C:/Windows or C:/Windows/system32, the registery via PHPRC or the Windows Path. The best method is to add the php folder to the Windows Path. That way PHP can read all files/folders within C:/php. If you have Apache2 as the server you can add PHPIniDir "C:/php" to the httpd.conf too, this basically tells PHP where the php.ini file can be found.
-
Your header error is caused by the first error, which is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\chris1\My Documents\xampp\htdocs\elp\modify_information.php on line 88 When you get the above type of error it basically means that you have error in your query. Id change these lines: $RSStudent=$RSStudent_query=@mysql_query(("update OCStudents set StudentName = '" .$_POST["Name"]."', StudentEmailAddress = '" .$_POST["EmailAddress"]."', StudentPassword = '" .$_POST["Password"]."' where StudentID = " .$_SESSION['StudentID']),$conn); $RSStudent=mysql_fetch_array($RSStudent_query); header("Location: "."student_menu.php");} Into: $RSStudent_query = "UPDATE OCStudents SET StudentName = '" . $_POST['Name'] . "', StudentEmailAddress = '" . $_POST["EmailAddress"] . "', StudentPassword = '" . $_POST["Password"] . "' WHERE StudentID = " . $_SESSION['StudentID']; $RSStudent_result = mysql_query($RSStudent_query, $conn) or die('SQL Error:<br />' . $RSStudent_query . '<br />' . mysql_error($conn)); $RSStudent = mysql_fetch_array($RSStudent_result); header("Location: student_menu.php"); } Re run you code. If there is an error with your query an error message will appear showing the query being ran and the reason for the error. Also I notice you are using POST data in your query. I strongly advise you to validate any user input (GET, POST, COOKIE) etc before using it within a query. Look into SQL Injection.
-
Example: <?php $days = array( 'Monday' => array( 'Chicken Burger' => 5.00, 'Veal Schnitzel' => 7.50, 'Onion Rings' => 3.00, 'Hot Potato' => 4.00 ), 'Tuesday' => array( 'Steak Sandwich' => 10.00, 'Chicken Pasta' => 4.50, 'Pork Chop' => 6.50, 'Taco' => 1.50, ), 'Wednesday' => array( 'Chicken and Chips' => 5.00, 'Beef Casserole' => 6.50, 'Sausage' => 1.50, 'Lasagne' => 3.50 ), 'Thursday' => array( 'Fish and Chips' => 5.00, 'Tuna Pattie' => 2.50, 'Chicko Roll' => 2.80, 'Hot Dog' => 3.00 ), 'Friday' => array( 'Nachos' => 5.50, 'Salad Sandwich' => 4.00, 'Macaroni Cheese' => 3.50, 'Bacon and Eggs' => 7.50 ) ); if(isset($_GET['day']) && array_key_exists($_GET['day'], $days)) { echo '<h3>Please select your meal for ' . $_GET['day'] . ':</h3>'; $day = $_GET['day']; $dayMenu = $days[$day]; foreach ($dayMenu as $item => $price) { $price = number_format($price, 2); echo '<input type="radio" name="meal" value="' . $item . '">' . $item . ' ($' . $price . ")<br />\n "; } } else { echo '<h1>Please select day:</h1> <form action="#" action="get"> '; foreach($days as $day => $menu) { echo '<input type="radio" name="day" value="' . $day . '"> ' . $day . "<br />\n "; } echo '<input type="submit" value="Submit"> </form>'; } ?>
-
Create a form, make it submit to itself (the current page) and use the get as the method. Create a text field called loop and a submit button. Then in your PHP code check to make sure $_GET['loop] exists and that is of a numerical value, using isset and is_numeric within an if statement. If $_GET['loop] variable exists and is of a numerical value use it in your for loop. it really is straight forward. From reading the above you should be able to accomplish what you are trying to do.
-
There has been a new release for SMF which fixes the captcha. Perhaps we should consider upgrading to latest version of SMF.
-
Check Apaches error logs there may be clue there. How do you have Apache setup? Could be a configuration issue or an incompatibility with vista. Never experienced that error, only when I accidentally use infinity loops due to a coding issue.
-
How can other people see my site?
wildteen88 replied to ssjcory's topic in PHP Installation and Configuration
If you are behind a router you'll need to setup port forwarding. There are many guides on the net for setting up port forwarding. You'll want to forward port 80 (this the default port Apache listens to for tcp/ip requests). You'll have to make sure your ISP provides a static ip address and not a dynamic ip address. -
I think the last one should be given to Barand! 11K posts and counting. Only joking.
-
Mysql extension not working after upgrade
wildteen88 replied to mhodgson's topic in PHP Installation and Configuration
To upgrade PHP it is simple. Just download the latest version of PHP (making sure you download the zipped binaries package and not the installer) and just extract the contents of zip to where PHP is currently installed making sure you overwrite existing files/folders. Thats it PHP is now upgraded. make sure you don't any files such as libmysql.dll or php_mysql.dll stored in other places on your hard drive. Make sure these files are only available in PHP's installation folder and MySQL's installation folder. Do a file search for these files. -
that settings shouldn't affect MySQL form loading. short_open_tag allows you to use <? ?> or <?= ?> instead of <?php or <?php echo ?> Oh, forgot to mention your httpd.conf and php.ini configuration is fine. So I don't know what the problem is. I noticed you have a few extensions enabled. Try commenting out all extensions. Then enable each extension one by one until come about the problem you are having.
-
it is damn true... it will take me 13 years.. :(.... Will PHP live that long ??? I'm worried.... What's so good about getting the genius rank! The rank has no reflection on how good are at PHP.
-
Use the modulus (%) operator: if ( $schedule_rs->Fields("team1")%2 ) { echo "odd"; } else { echo "even"; }
-
You cannot run your php files, like you can with html files. You have to run your php scripts through the server (XAMPP). You must place them in the htdocs folder. Then ensure XAMPP is running and go to http://localhost/script.php change script.php to name of the script you want to run. And yes you can place as many folders in side the htdocs folder.