wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] First time connecting to mysql database: PHP error
wildteen88 replied to NovaArgon's topic in PHP Coding Help
Whats in connect.php looks like you havn't connected to MySQL properly. Is e0120590 your mysql username? PHP is trying to connect to mysql using e0120590 as the username with no password. -
[SOLVED] debugging 1st php script - getting key of array
wildteen88 replied to kate_rose's topic in PHP Coding Help
The problem is you're starting a variable name with a number. Variable names can only begin with a letter or an underscore. You can use numbers afterwards. $1key = key ($picmysql); // load the location or key of the current link or jpeg name into $1key Change $1key to $key1 or $_1key EDIT: Beaten to it. -
Only place quotes around values, not field/table names. mysql_query("INSERT INTO `users` (username, `password`, activated, online, email, status, tut, activecode) VALUES ('$reg_username', '$randompassword', '0', '0', '$email', 'Alive', '0', '$code')"); if (mysql_affected_rows() != 1) die ('Query failed: '.mysql_error());
-
[SOLVED] First time connecting to mysql database: PHP error
wildteen88 replied to NovaArgon's topic in PHP Coding Help
You're not passing the query to mysql_query function. You have it commented out //mysql_query($sql); // Uncomment when your ready for the real deal Remove the // at the start of the line and your query will execute. Just echo'ing $sql will not perform the query. Also any reason why you didn't use my code suggestion earlier? -
[SOLVED] First time connecting to mysql database: PHP error
wildteen88 replied to NovaArgon's topic in PHP Coding Help
Change //then create a SQL statement variable $i=0; $sql = "INSERT INTO tablename (genus) VALUES ($genus[$i])"; //then make you a while loop that will loop through your Insert into query code 114 times while($i<=114) { mysql_query($sql,$con); $i++; } to foreach($genus as $value) { $sql = "INSERT INTO tablename (genus) VALUES ($value)"; mysql_query($sql, $con); } Also make sure you have connected to your mysql server/database too before running the code. -
You can use mod_rewrite to perform dynamic redirects, example RewriteEngine On RewriteRule oldpage.php/(.+) newpage.php/$1 [NC,R=301]
-
[SOLVED] WAMP on windows Server 2003
wildteen88 replied to jkkenzie's topic in PHP Installation and Configuration
You cannot have both IIS and WAMP running at the same time. as both ofthem use port 80, listening for tcp/ip requests. Ports can only be used by one service at a time. I'd recommend you to modify WAMP so it listens on a different port instead, eg port 8080 To do so find WAMP's httpd.conf file and find the following line Listen 80 Change that line to Listen 8080 Save the httpd.conf and restart WAMP. Now use http://localhost:8080/ to connect your WAMP server. http://localhost/ on its own will connect to your IIS server. -
Errors will only display if display_errors is enabled and the error_reporting level is set higher enough.
-
[SOLVED] Directive Help-- httpd.conf or apache2.conf??
wildteen88 replied to Taorluath's topic in Apache HTTP Server
Make sure you have restarted Apache after making the changes. As for why your httpd.conf is called apache.conf it is most probably do with how your linux distro installs/sets up Apache. Any directives you apply in httpd.conf will override those set in apache.conf -
If you keep being redirected back to the login form after you have submitted the form then it seem like the sessions vars are not being set correctly. The following code here in login_success.php if(!isset($_SESSION['username'])) { header("location: login.php"); } will redirect the user back to login.php if the $_SESSION['username'] variables does not exist.
-
[SOLVED] First time connecting to mysql database: PHP error
wildteen88 replied to NovaArgon's topic in PHP Coding Help
That would suggest there is an error with your query. Add or die(mysql_error()) after your mysql_query calls, eg mysql_query('your query') or die(mysql_error()) ; -
I presume you want the user to be redirected after the email has been sent? If so add it after you call mail function.
-
What do want to happen on the sent page? To redirect a user use header: header('Location: page_to_be_redirect_to.php'):
-
Just calling $_SESSION['username'] will not do anything. Change if(!session_is_registered(username)){ header("location:login.php"); } $_SESSION['username']; to if(!isset($_SESSION['username'])) { header("location: login.php"); } $username = $_SESSION['username']; Avoid using session_register or session_is_registered functions these are depreciated.
-
You need wrap quotes around the words defined in ENUM. ALTER TABLE `bugs` ADD `network` ENUM( 'myspace', 'facebook', 'hi5', 'friendster', 'homepage', 'bebo' ) NOT NULL , ADD `debugInfo` TEXT NOT NULL
-
PHP does not compile scripts. How are you getting the following error: '..' is not recognized as an internal or external command, operable program or batch file This is not an error from PHP itself but a Windows command error. Which suggests to me that you are not actually passing the code to the PHP interpreter.
-
Fenway gave you the answer. Its for use with Prepared Statements. You'll find the answer under the What are server-side prepared statements? heading.
-
I'd recommend you to change for($i=0;$i<mysql_num_rows($res);$i++) { $row=mysql_fetch_assoc($res); $selected = @$_GET['cat'] == $row['cat'] ? "selected" : ""; echo"<option value=".$row['cat']." $selected>".$row['cat']."</option>"; } to while($row = mysql_fetch_assoc($res)) { $selected = ((isset($_GET['cat']) && $_GET['cat'] == $row['cat']) ? ' selected="selected"' : null; echo '<option value="'.$row['cat'].'"' . $selected .'>'.$row['cat']."</option>\n"; }
-
Set session.use_trans_sid to 0, eg: session.use_trans_sid = 0 and make sure session.use_only_cookies is set to true. You may have to remove the semi-colon in front of the above lines in order for PHP read the changes. Add index.php to the DirectoryIndex directive within your httpd.conf file (if you have access it). Or for .htaccess then use DirectoryIndex +index.php Make sure you restart Apache after making changes to the httpd.conf or php.ini
-
Just use a condition in your where clause eg: SELECT * FROM your_table WHERE some_field !='d'
-
Yes. To go two levels use ../../myfile.txt three levels ../../../myfile.txt You see the patten yet?
-
[SOLVED] wampserver php help
wildteen88 replied to kate_rose's topic in PHP Installation and Configuration
Could you describe what you're getting instead of the welcome page? Maybe you have to go to http://localhost/wamp/ perhaps. I have not used WAMP in a long time. -
http://www.url.domain/blah.php?id=3&blah.htm - HOW?
wildteen88 replied to Perry|'s topic in PHP Coding Help
Always check to make sure the file you are including exists. I'd do: if(isset($_GET['page'])) { $requested_page = $_SERVER['DOCUMENT_ROOT'] . '/' . $_GET['page']; if(file_exists($requested_page)) { include $requested_page; } } To tighten security even more I'd setup an array of files which can be requested from the user. I'd then check to see if the requested file is in that array. If its in the array then include the requested file, otherwise display an error. Example $safe_files = array( 'home.php', 'about.php', 'products.php', 'contact.php'): if(isset($_GET['page'])) { $requested_page = $_SERVER['DOCUMENT_ROOT'] . '/' . $_GET['page']; if(in_array($_GET['page'], $safe_files) { include $requested_page; } else { die('Error: Requested file is invalid!'); } } -
Can you post what operating system you are using (eg Win XP, Ubuntu Linux etc) and what HTTP Server you have installed (eg Apache, IIS etc). Also can you provide details on how you installed PHP and MySQL. By default MySQL support is not enabled when PHP is installed. You have to enable the mysql extension(s) (php_mysql.dll and/or php_mysqli.dll) within the php.ini in order to use any of the mysql_* or mysqli_* functions Another thing before making any changes to the php.ini make sure PHP is actually reading the php.ini you are editing. You can check this by creating a simple script, call this info.php and place following code in it: <?php phpinfo(); ?> Save info.php to where your server servers your websites files. Open your browser and go to your http://your_site.com/info.php Scroll down and look for the line that starts with Loaded Configuration File. To the right of that, should be the full PATH to the php.ini PHP is reading. Make sure that path stated is the same as the php.ini you're editing.
-
[SOLVED] wampserver php help
wildteen88 replied to kate_rose's topic in PHP Installation and Configuration
What happens when you go to http://localhost There is a shortcut in the WAMP Control Panel for opening up localhost