probably a bad WAMP setup
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: probably a bad WAMP setup

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    281

    probably a bad WAMP setup

    Hi,

    I wouldn't know much about coding with php, but I sort of understand it very basically and I think I have some issue with my WAMP online server because I can connect to the mysql database through an extension program in smartfox but I can't pass variables using it "normally".

    I mean, I have a script to connect to mysql database that i used to be able to run from the broswer and now I can't. I've noticed that if I hardcode the variable values instead, it will work though.

    Here's the script I use actually:

    <?php

    /* $db_host = "localhost";
    $db_username = "root";
    $db_pass = "*********";
    $db_name = "test_database"; */

    @mysql_connect("localhost", "root", "********") or die ("could not connect!");
    mysql_select_db("test_database") or die ("No database!");

    print "Succesful connection";
    ?>

    if it were my WAMP settings, does anyone know what could have caused this? I would have a hard time describing my settings, but, as the last time, I simply let WAMP install by default. Perhaps, the time before that, when it had worked, I had installed IIS and stopped it in order to be able to use port 80. I can't remember... is it possible I need any other windows features I might have missed on restoring my computer?

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    110
    Hi there,
    Unfortunately there is not much to reply too as many items once need to know are missing!
    I just only yesterday was checking up on new versions on WAMP which I have now used for a few years myself. I found that 2.1 can't be updated with 2.2 etc. without removing it 2.1 first! IF that is not the problem start removing the WAMP setup completely and RE-Install and do not worry about port 80 or else as it would / should do all and everything on it's own!

    I find the only problem is I'm having when the DB itself ( like test_database ) is not created on the WAMP / MySQL.

    Here is a very simple setup which should work for you for Log-In:

    Code:
    <?php
    
    	// customerLogIn.php
    
    	define( "DATABASE_SERVER", "localhost" );
    	define( "DATABASE_USERNAME", "root" );
    	define( "DATABASE_PASSWORD", "" );
    	define( "DATABASE_NAME", "test_database" );
    
    	$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());
    
    	mysql_select_db( DATABASE_NAME );
    	
    	// Assign the Data passed from Flex to Variables.
    	$userName = mysql_real_escape_string($_POST["userName"]);
    	$password = mysql_real_escape_string($_POST["password"]);
    
    	$tableName = mysql_real_escape_string($_POST["tableName"]);
    
    	//Query Database to see if the given userName/password combination is valid.
    	$query = "SELECT userName, password FROM " . $tableName . " 
    					WHERE userName = '$userName' 
    						AND password = '$password'";
    
    	$result = mysql_fetch_array(mysql_query($query));
    	
    	// START: Output in XML.
    	$output = "<loginsuccess>";
    	
    	// Query returned 'True" ? = <loginsuccess> YES </loginsuccess> 
    	// Query returned 'False" ? = <loginsuccess> NO </loginsuccess>
    	if(!$result) {
    		$output .= "no";		
    	}
    		else
    	{
    		$output .= "yes";	
    	}
    		$output .= "</loginsuccess>";
    
    	// END: Output in XML.
    	print ($output);
    
    ?>

    Here is a very simple setup which should work for you for Create (3 files) Names are included on top:
    This is using also a BAK DB - BackUp set up and it writes the table name to a text file for Re-Use ....etc.
    Code:
    <?php 
    
    // ini.php
    	
    		// Include: Require the db.inc file for Global ONE time use.
    		require 'db.inc.php';
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    		// This includes also a ERROR function through the db.inc file. 
    		// A Combination of: ERROR function - ( mysql_errno() & mysql_error() ) Etc.
    		if (!($con = @ mysql_connect("$mysql_host", "$mysql_user", "$mysql_pass")))
    			showerrorCon();
    
    		return $con;
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    ?>


    Code:
    <?php 
    
    // db.inc.php
    
    /* ------------------------------------------------------------------------------------------------------ */
    
       	$mysql_host = "localhost";
       	$mysql_user = "root";
       	$mysql_pass = "";
    
       	function showerrorCon() {
          	exit("Error: " . mysql_errno() . " : " . mysql_error());
       	}
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    ?>


    Code:
    <?php 
    
    // createCartDB.php
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    		// INCLUDE SCRIPT CONNECTING TO 'MySQL' SERVER.
    
    		// MySQL DataBase Server Connection through the ini.php file!
    		require_once("init.php");
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    		// ERROR FUNCTION.
    
    		// Called Function.
    		function showerrorGen() {
          		exit("Error: " . mysql_errno() . " : " . mysql_error());
       		}
    
    /* ------------------------------------------------------------------------------------------------------ */
    
    		// VARIABLE FOR THE DATABSE NAME AND THE TABLE NAME.
    
    		// MySQL DataBase Name Variable.
    		$db = "test_database";
    
    		// Assign the Data passed from Flex to Variables to Create a Table with 
    		// the Customer name, and a BackUp Table as well.
    		$userNameCopy = mysql_real_escape_string($_POST["userNameCopy"]);
    		$userNameCopyBak = mysql_real_escape_string($_POST["userNameCopyBak"]);
    
    /* ------------------------------------------------------------------------------------------------------------------ */
    
    		// SELECT DATABSE.
    
    		// Selecting and Activating the Database.
    		if (! @ mysql_select_db($db, $con))
    			 showerrorGen();
    
    /* ------------------------------------------------------------------------------------------------------------------ */
    
    		// CREATE TABLE IF NOT EXISTS.
    
    		// Create the Table with the Customers 'User Name Copy'.
    		$sql = "CREATE TABLE IF NOT EXISTS $userNameCopy (
    			custcartinfoID int (10) NOT NULL AUTO_INCREMENT,
    				title varchar (10) NULL,
    					firstName varchar (45) NULL,			
    						middleName varchar (45) NULL,
    							lastName varchar (45) NULL,
    								fullName varchar (145) NULL,
    									no int (10) NULL,
    										street1 varchar (45) NULL,			
    											street2 varchar (45) NULL,
    												zip int (15) NULL,
    													suburb varchar (45) NULL,
    												city varchar (45) NULL,
    											state varchar (45) NULL,
    										country varchar (45) NULL,
    									email varchar (45) NULL,
    								userName varchar (45) NULL,						
    							password varchar (45) NULL,
    						now datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    
    							artistsDAName varchar (45) NULL,
    							imgPrintID varchar (45) NULL,
    							imgPrintName varchar (145) NULL,
    							imgPrintCategory varchar (45) NULL,
    
    								imgPrintTypeBase varchar (45) NULL,
    								imgPrintQtyBase int (10) NULL,
    								imgTotalAmountBase DECIMAL (10,2) NULL,
    								metHorzSizeBase varchar (45) NULL,
    								metHorzStdPriceBase DECIMAL (10,2) NULL,
    								metHorzExtrasBase DECIMAL (10,2) NULL,
    
    							imgPrintTypeExtra varchar (45) NULL,
    							imgPrintQtyExtra int (10) NULL,
    							imgTotalAmountExtra DECIMAL (10,2) NULL, 
    							metHorzSizeExtra varchar (45) NULL,
    							metHorzStdPriceExtra DECIMAL (10,2) NULL,
    							metHorzExtrasExtra DECIMAL (10,2) NULL,
    
    								metVertSize varchar (45) NULL,
    								metVertStdPrice DECIMAL (10,2) NULL,
    								metVertExtras DECIMAL (10,2) NULL,
    							metSqSize varchar (45) NULL,
    							metSqStdPrice DECIMAL (10,2) NULL,
    							metSqExtras DECIMAL (10,2) NULL,
    								impHorzSize varchar (45) NULL,
    								impHorzStdPrice DECIMAL (10,2) NULL,
    								impHorzExtras DECIMAL (10,2) NULL,
    							impVertSize varchar (45) NULL,
    							impVertStdPrice DECIMAL (10,2) NULL,
    							impVertExtras DECIMAL (10,2) NULL,
    								impSqSize varchar (45) NULL,
    								impSqStdPrice DECIMAL (10,2) NULL,
    								impSqExtras DECIMAL (10,2) NULL,
    						PRIMARY KEY (custcartinfoID)
    						) ENGINE = MyISAM 
    						CHARACTER SET = latin1 
    						AUTO_INCREMENT = 1 ";
    
    
    		// Perform Query.
    		$result = @ mysql_query($sql, $con);
    
    		// Check result of the above Query.
    		if (!$result) {
    			$message  = 'Invalid query: ' . @ mysql_errno() . " : " . @ mysql_error() . "\n";
    			$message .= 'Whole query: ' . $sql;
    			exit($message);
    		}
    
    /* ------------------------------------------------------------------------------------------------------------------ */
    
    		// CREATE 'BACKUP COPY' OF TABLE ABOVE.
    
    		// Create a backup copy of the Table with the Customers Full Name.
    		$sql_1 = "CREATE TABLE IF NOT EXISTS $userNameCopyBak (
    			custcartinfoID int (10) NOT NULL AUTO_INCREMENT,
    				title varchar (10) NULL,
    					firstName varchar (45) NULL,			
    						middleName varchar (45) NULL,
    							lastName varchar (45) NULL,
    								fullName varchar (145) NULL,
    									no int (10) NULL,
    										street1 varchar (45) NULL,			
    											street2 varchar (45) NULL,
    												zip int (15) NULL,
    													suburb varchar (45) NULL,
    												city varchar (45) NULL,
    											state varchar (45) NULL,
    										country varchar (45) NULL,
    									email varchar (45) NULL,
    								userName varchar (45) NULL,						
    							password varchar (45) NULL,
    						now datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    
    							artistsDAName varchar (45) NULL,
    							imgPrintID varchar (45) NULL,
    							imgPrintName varchar (145) NULL,
    							imgPrintCategory varchar (45) NULL,
    
    								imgPrintTypeBase varchar (45) NULL,
    								imgPrintQtyBase int (10) NULL,
    								imgTotalAmountBase DECIMAL (10,2) NULL,
    								metHorzSizeBase varchar (45) NULL,
    								metHorzStdPriceBase DECIMAL (10,2) NULL,
    								metHorzExtrasBase DECIMAL (10,2) NULL,
    
    							imgPrintTypeExtra varchar (45) NULL,
    							imgPrintQtyExtra int (10) NULL,
    							imgTotalAmountExtra DECIMAL (10,2) NULL, 
    							metHorzSizeExtra varchar (45) NULL,
    							metHorzStdPriceExtra DECIMAL (10,2) NULL,
    							metHorzExtrasExtra DECIMAL (10,2) NULL,
    
    								metVertSize varchar (45) NULL,
    								metVertStdPrice DECIMAL (10,2) NULL,
    								metVertExtras DECIMAL (10,2) NULL,
    							metSqSize varchar (45) NULL,
    							metSqStdPrice DECIMAL (10,2) NULL,
    							metSqExtras DECIMAL (10,2) NULL,
    								impHorzSize varchar (45) NULL,
    								impHorzStdPrice DECIMAL (10,2) NULL,
    								impHorzExtras DECIMAL (10,2) NULL,
    							impVertSize varchar (45) NULL,
    							impVertStdPrice DECIMAL (10,2) NULL,
    							impVertExtras DECIMAL (10,2) NULL,
    								impSqSize varchar (45) NULL,
    								impSqStdPrice DECIMAL (10,2) NULL,
    								impSqExtras DECIMAL (10,2) NULL,
    						PRIMARY KEY (custcartinfoID)
    						) ENGINE = MyISAM 
    						CHARACTER SET = latin1 
    						AUTO_INCREMENT = 1 ";
    
    
    		// Perform Query.
    		$result_1 = @ mysql_query($sql_1, $con);
    
    		// Check result of the above Query.
    		if (!$result_1) {
    			$message  = 'Invalid query: ' . @ mysql_errno() . " : " . @ mysql_error() . "\n";
    			$message .= 'Whole query: ' . $sql_1;
    			exit($message);
    		}
    
    /* ------------------------------------------------------------------------------------------------------------------ */
    
    		// CLOSE DATABSE.
    
    		// Close DataBase Server Connection!
    		@ mysql_close($con);
    
    /* ------------------------------------------------------------------------------------------------------------------ */
    
    ?>

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    281
    Hi, Aktell and thank you so much for the reply, I sort of feel ashamed of having posted seeing your coding. I never kept trying to solve that and I am running my database as is. I am using too many different languages at a time and I don't know much about any of them... I suppose things are going to keep changing at a very difficult speed too hard to follow if one doesn't have a good learning base which is my case, but thanks so much again. A happy new year to you from Barcelona.

  4. #4
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    110
    Hola Amigo,
    Do not worry I started of the very same when it came to all these things which I wanted to do & the things which I could do so I just played it by ear one day after the other! Well, I studied with MS in the end, and ended up to be an Engineer & DB SQL Admin. So if you do need a helping hand let me know! It needed me quiet some time to be happy with my own code, but this is all from way back so not always 100% in layout, BUT all works 110%! so enjoy! regards aktell from New Zealand

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    281
    Hello again,

    thanks anyway though. Really. I like this a lot, but I guess I've awoken too late to learn from a good start. 56 and the last 20 seem to have gone by in one. Here's my site's adress [URL="http://webs.ono.com/jpdurba[/URL]. I'm an out of work ex-limo driver offering my fiesta model car trying to go solo and if you happen to come over here for vacation holidays sometime, don't you hesitate letting me know. The first service or couple of beers would be on me. I will, of course accept any comments or suggestions on my page.

  6. #6
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    110
    Hi again,

    Well, first up thanks again for the reply! I have 6 years on you !!! because I'm 62 and only started with computers in 2000 but professionally in 2004/05 so it is not the age but the Attitude which counts & of course you are in. I was born in Germany but live in NZ since around 35 years now I have three full trades and still now I'm UN-Employed for the last three years at least so what is there to do - a lot as I work 10 to 14 hours everyday with my own stuff on computers writing new software mostly these days in AS3 and FLEX & doing Free global promotional services for hundreds of Artists, Designer, Models, Photographers, Stylists and businesses etc. from over 60 countries by now & in over 247 countries worldwide! INCLUDING several Spain & Portugal!

    I had a look at your site and I'm very pleased you do use Flash / FLASH as a carrier! as said before I do Flash / FLEX which was the ADOBE web & Desktop Application developing suite! I like the site because I like the Image galleries great type I have not seen as yet!

    OK, you ask for comments on your site: I have written & answered about SEO on here just this weekend as well - please view IF Interested in that.
    Your site itself is YES & NO if it comes to the usefulness as in effective visibility - as I'm not sure if your are able to have excess to the code of the Html page as especially the Header section ???
    And of course I do not know to what extent you are even Interested in been or getting worldwide visibility or even just within your country or area you in, but then these days everything is or goes Globally! Anyway, your Header section code is AS IS OF NO VALUE if you would wanted it to be of any promotional value or even search related value - Sorry to say! just by far to much missing in that section I would say about 40 to 60 code lines of very basic code specific set out to you and / or the Interest you pursue.

    I any way to help out is NO problem yet I would IF requested to know what your after and what excess you have or could have ??? If there is no excess available i still can help out as I have written software which makes it possible without any changes to a wen site or blog to address this very effectively and have you within no time known out there! etc.

    If you like you can contact me on my main E-mail address - WebFlashArtistry@gmail.com - and we can talk about that in more detail as well if you do look for some more Involvement out there I mite be able to give you ideas about that as well as I'm Interested in people in Europe as I'm very strong with my work in the Eastern European countries etc.

    Anyway, a lot to read regards Roland E W Mucke alias aktell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com