wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
This is most probably because MySQL is trying to install/start an existing service that may be running. This problem can be caused from not properly shutting down mysql before uninstalling. Whenever I uninstall MySQL I always perform a backup of any databases I wish to keep followed by stopping the mysql service (via services.msc). You should then proceed to uninstall MySQL. The only files the uninstaller will leave behind is the data directory (this is where your databases are stored) and my.ini If the service has stopped the uninstaller should also remove the service too. When installing a new MySQL version it should start up fine. If you are having issues with the service not starting then go back a few steps to where you setup the root password. On the same step there should be an option to use a different name as the mysql service, default is usually mysql. Try changing it to mysql5.
-
To get to sales for each model you can use function getTopSale(&$saleDates) { $key = array_search(max($saleDates), $saleDates); return array($key, $saleDates[$key]); } foreach($sales as $model => $saleDates) { list($date, $sold) = getTopSale($saleDates); echo '<h2>'.$model.'</h2>'. '<p>Sold '.$sold.' on '.$date.'</p>'; }
-
There is no need to pass an md5 hash to your safe() function, as md5() only returns a string with letters a-z and numbers 0-9.
-
MySQL_fetch_array returns both a numerical and associative array.
-
You need to post the code you use when you a user signs up.
-
Not all disto will come with all the codec packs, due to copyright laws. However most distro's do allow you to download/install codec packs separately via the supplied package manager. As for updating most disto's dont require you to reinstall everything every 6months. Using your distro's package manager you can choose which updates to install. When a new release is available it will prompt you to upgrade, it will keep all your current settings.
-
You'd use $row['videoid'] echo 'http://img.youtube.com/vi/'.$row['videoid'].'/default.jpg';
-
No you cant decrypt an md5 hash. You will have to provide a place for your users to reset their passwords if they forget it.
-
Not understanding you properly. You should explain what you are trying to do and tell use the error(s) you're getting here in full. You should also post the code that you having trouble with
-
Umm, you put your code in then wrong order. Your while loop needs be placed after this line $sql = mysql_query("SELECT * FROM gg_video "); If you only want your query to return 5 results then use the LIMIT clause in your query $sql = mysql_query("SELECT * FROM gg_video LIMIT 5");
-
Looks like you're not calling session_start in your login script. session_start() should be called at the start if your script whenever you are assigning or using your $_SESSION variables.
-
@Rochtus: Please use code tags ( ) when posting any code.
-
You need to change session_register("myusername"); session_register("mypassword"); to $_SESSION['myusername'] = $myusername; $_SESSION['mypassword'] = $mypassword;
-
One way could be $data = '2009-06-01:X1 2009-06-02:X1 2009-06-02:X1 2009-06-02:X1 2009-06-03:M55 2009-06-09:X1 2009-06-10:X1 2009-06-10:X1 2009-06-12:M55 2009-06-19:X1 2009-06-12:M55 2009-06-12:M55 2009-06-12:M55 2009-06-12:M55'; $rows = explode("\r\n", $data); foreach($rows as $sale) { list($date, $model) = explode(':', $sale); isset($sales[$model][$date]) ? $sales[$model][$date] += 1 : $sales[$model][$date] = 1; } echo '<pre>' . print_r($sales, true) . '</pre>';
-
You don't decrypt the md5'd password instead you md5 the password the user provides upon login and then compare that to the md5 password in your database that corresponds to the username they used. Example code if(isset($_POST['username'], $_POST['password'])) { $user = mysql_real_escape_string($_POST['username']); $pass = md5($_POST['password']); $sql = "SELECT * FROM members WHERE username='$user' AND password='$pass'"; $result = mysql_result($sql); if(mysql_num_rows($result) == 1) { // user passes login } else { // user fails login } }
-
If you have wamp installed you need to be saving all your files to C:\wamp\www Make sure wamp is running and go to http://localhost/filename.php to run your scripts.
-
You need debug your file path. What is returned when you echo out your file path? echo $pictureAlbumsRoot.'/'.$name.'/thumbs/'.$value;
-
[SOLVED] php is killing session variables
wildteen88 replied to shadiadiph's topic in PHP Installation and Configuration
You're not using sessions properly. Global variables do not get passed to other pages. You need to use the $_SESSION superglobal to assign/use session variables. In test.php you'd use <?php session_start(); $username = $_POST['username']; $password = $_POST['password']; // assign username/password to session $_SESSION['username'] = $username; $_SESSION['password'] = $password; print $username; print $password; ?> Now to retrieve your session variables in test2.php you'd use <?php session_start(); echo $_SESSION['username']; echo $_SESSION['password']; ?> -
[SOLVED] php is killing session variables
wildteen88 replied to shadiadiph's topic in PHP Installation and Configuration
You need to post your code to identify the issue. Post the parts where you define/use your session variables. However I have a feeling it is because your code is relying on depreciated settings which are now disabled by default on new installations. -
mod_rewrite does not rewrite the links within your pages for you. You have to update your links manually. You should be going to http://localhost/index.html
-
[SOLVED] mod rewrite help with $_get tags
wildteen88 replied to chmpdog's topic in Apache HTTP Server
If you only have one rewriteRule you can remove the L flag. This flag should only be used when you have more than one rewriteRule. -
Using PHP to switch different style sheets.
wildteen88 replied to iconicCreator's topic in PHP Coding Help
You can accomplish this with some simple code. What I'd do is create a new PHP script called style.php. When linking your stylesheet you'd do use sstyle.php as the stylesheet <link rel="stylesheet" type="text/css" href="styles.php"> Now in styles.php you serve up the requested stylesheet <?php header('Content-type: text/css'); // list all available styles in an array $stylesheets = array('zoom', 'normal'); // check that a request to change the style sheet has been made, and that it is a valid style sheet if(isset($_GET['style']) && in_array($_GET['style'], $stylesheets)) { $stylesheet = $_GET['style']; // set a cookie to remember new style setcookie('style', $stylesheet, time()+3600); } // check to see if a cookie is set elseif(isset($_COOKIE['style'])) { $stylesheet = $_COOKIE['style']; } // no request or cookie set default stylesheet as normal. else $stylesheet = 'normal'; // now all the hard work has been done load the requested stylesheet include $stylesheet . '.css'; ?> Now to change style on any page you just need to use the following url yoursite.com/somepage.php?style=zoom or yoursite.com/somepage.php?style=normal -
How to enable mod_rewrite without using httpd.conf file
wildteen88 replied to sunil_23413's topic in PHP Coding Help
If you dont have access to the httpd.conf you wont be able to enable mod_rewrite. The only way is to ask your host to enable mod_rewrite -
How to make this modification?
wildteen88 replied to AtomicRax's topic in PHP Installation and Configuration
Looks like you need to enable the mod_rewrite module within Apaches configuration. Open Apaches httpd.conf and find then following line #LoadModule rewrite_module modules/mod_rewrite.so Remove the # from the start of the line. Save the httpd.conf and restart Apache.