Please help newbie with MySQL installation


I hate to harass you with a completely newbie question, but I've battled with this for several days. Please lend a hand.

I'm following Kevin Yank's book, "Build Your Own DB-Driven Website, Using PHP and MySQL". I installed PHP on my (Windows XP) computer and tested it - worked fine.
Then I installed MySQL 5.0 all went well, including the final window of the installation wizard, which said that the installation was successful.

Problem occurs when I open mysqld.exe. The "command prompt/dos" window opens, but does not accept any input (keystrokes, etc.). After about 15 seconds, it spontaneously closes. I can open it as many times as I like, but it behaves the same.

Now the PHP no longer responds to the date tutorial, which worked previously! Ahhhh!

Since then, I've reinstalled the 5.0 and 4.1 versions - on 2 machines several times (after uninstalling each time), reinstalled windows XP on this machine, read this forum for hours, etc. Please could someone put me on the right path or in touch with someone who could help me

Posted On: Sunday 21st of October 2012 11:01:20 PM Total Views:  127
View Complete with Replies

RELATED TOPICS OF MYSQL PROGRAMMING LANGUAGE




please let me know where i am wrong in this query.

I am new user and also new programmer in my sql I will highly appreciate if someone will help me on follwing query. SELECT id, street_name, concat(ifnull(supplemental_address_1,''), (SUBSTRING( street_name, INSTR( street_name , 'PO BOX' ) ) ) ) As supplemental_address_1 and Replace( street_name, SUBSTRING( street_name, INSTR( street_name , 'PO Box' ) ), ' ' ) FROM passion WHERE INSTR( street_name , 'PO BOX' ) > 2 when I execute this query I get following message. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and Replace( street_name, SUBSTRING( street_name, INSTR( street_name , 'PO B' at line 1 please let me know where I am wrong.
VIEWS ON THIS POST

136

Posted on:

Monday 24th September 2012
View Replies!

Help me please

I have table student grade contain id,name and grade I need to know rank of student in class with sepecific id i use its but can t complete SELECT DISTINCT Grade , ID FROM studentgrade ORDER BY Grade DESC
VIEWS ON THIS POST

70

Posted on:

Thursday 11th October 2012
View Replies!

Can someone please help me with command.php

Hi all, Iam a new to mysql, I am making a game on facebook, and have created a databse using mysql, but now I dont know how to make a command.php file to query the database. I have searched and found nothing that can really help, so if there is anyone that can possibly help me with this common.php file it would be sooo appreciated.
VIEWS ON THIS POST

103

Posted on:

Friday 12th October 2012
View Replies!

HABTM query help please

Code: SELECT `Survey`.`id`, `Survey`.`surveycategory_id` , `Survey`.`campaign_id`, `Survey`.`type_id`, `Survey`.`name`, `Survey`.`description`, `Survey`.`status_id`, `Survey`.`created`, `Survey`.`modified`, `Survey`.`deleted`, `Survey`.`deleted_date`, `SurveysCategory`.`id`,`SurveysCategory`.`name`, `SurveysSegment`.`survey_id`,`SurveysSegment`.`id`,`SurveysSegment`.`segment_id`, `SurveysType`.`id`,`SurveysType`.`name`,`Status`.`id`,`Status`.`name`, `RacesSegmentExclude`.`race_id` FROM `surveys` AS `Survey` LEFT JOIN `surveys_categories` AS `SurveysCategory` ON (`Survey`.`surveycategory_id` = `SurveysCategory`.`id`) LEFT JOIN `surveys_segments` AS `SurveysSegment` ON (`Survey`.`id` = `SurveysSegment`.`survey_id`) LEFT JOIN `surveys_types` AS `SurveysType` ON (`Survey`.`type_id` = `SurveysType`.`id`) LEFT JOIN `statuses` AS `Status` ON (`Survey`.`status_id` = `Status`.`id`) LEFT JOIN `segments` AS `Segment` ON (`Segment`.`id` = `SurveysSegment`.`segment_id`) LEFT JOIN `races_segments_excludes` AS `RacesSegmentExclude` ON (`Segment`.`id` = `RacesSegmentExclude`.`segment_id`) WHERE `RacesSegmentExclude`.`race_id` = 2 Hi I need help with this query. There are two rows in my surveys table and I have a habtm relationship with a few excluding tables. The above query works but when I do this: Code: WHERE `RacesSegmentExclude`.`race_id` != 2 It returns nothing. with Where 1=1 is returns two rows with race_id =2 on the first and race_id = null on the second. Code: WHERE `RacesSegmentExclude`.`race_id` = null also returns nothing Do I need to use subqueries
VIEWS ON THIS POST

100

Posted on:

Friday 12th October 2012
View Replies!

Error in sql, please help

I have folowing sql Code: CREATE TABLE ask_user (id INT AUTO_INCREMENT, nickname VARCHAR(30), first_name VARCHAR(50), last_name VARCHAR(50), created_at DATETIME, PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE ask_relevancy (id BIGINT AUTO_INCREMENT, answer_id BIGINT, user_id BIGINT, score BIGINT, created_at DATETIME, INDEX answer_id_idx (answer_id), PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE ask_question (id INT AUTO_INCREMENT, user_id BIGINT, title VARCHAR(50), body VARCHAR(200), created_at DATETIME, updated_at DATETIME, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE ask_interest (id BIGINT AUTO_INCREMENT, question_id BIGINT, user_id BIGINT, created_at DATETIME, INDEX question_id_idx (question_id), PRIMARY KEY(id)) ENGINE = INNODB; CREATE TABLE ask_answer (id INT AUTO_INCREMENT, question_id BIGINT, user_id BIGINT, body VARCHAR(200), created_at DATETIME, INDEX question_id_idx (question_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB; ALTER TABLE ask_relevancy ADD FOREIGN KEY (answer_id) REFERENCES ask_answer(id); ALTER TABLE ask_question ADD FOREIGN KEY (user_id) REFERENCES ask_user(id); ALTER TABLE ask_interest ADD FOREIGN KEY (question_id) REFERENCES ask_question(id); ALTER TABLE ask_answer ADD FOREIGN KEY (user_id) REFERENCES ask_user(id); ALTER TABLE ask_answer ADD FOREIGN KEY (question_id) REFERENCES ask_question(id); When I run it in phpmyqdmin, I get following error: SQL query: ALTER TABLE ask_relevancy ADD FOREIGN KEY ( answer_id ) REFERENCES ask_answer( id ) ; MySQL said: Documentation #1005 - Can't create table '.\askeet\#sql-15dc_1f9.frm' (errno: 150) Can you please tell me what I am doing wrong here
VIEWS ON THIS POST

117

Posted on:

Friday 12th October 2012
View Replies!

Mysql Query Join help please

hi, I am creating a banner advertising site script... What i need is when a visitor reach my site, find his ip address, find the country, find advertisers banner ordered for same country if they have balance credit, display the banner only if they didnt received banner impression from the same country. Advertisers id aid (advertiser ID) bannerimg bannerurl advcountry totalcredit creditused creditbalance Tracker id aid (advertiser ID) referral ip country PHP Code: $check=mysql_query("SELECTaid,bannerimg,bannerurlFROMadvertiserWHEREadvcountry==$countryANDcreditbalance
VIEWS ON THIS POST

96

Posted on:

Friday 12th October 2012
View Replies!

Help with date calculation please

The task I am trying to accomplish is to calculate a members age and then display it on a page. The member's birthdate is stored correctly within the database, however with the below code it does not calculate correctly and gives the wrong age of the member. I did not right this code it came with the script and I do not understand how to modify it to make it work, any suggestions would be much appreciated.
VIEWS ON THIS POST

94

Posted on:

Friday 12th October 2012
View Replies!

Help w/ sql LIKE condition please

I have a field in a table called Title. I have a record whose Title field contains a value of Ford Mustang. When I run a LIKE on my table such as LIKE 'Mustang' my record does not shop up. I am assuming LIKE is for an exact match. What if I want any record that has EITHER Ford or Mustang in the Title
VIEWS ON THIS POST

102

Posted on:

Friday 12th October 2012
View Replies!

Help with some join statements please

I am in the process of normalizing my database and would appreciate some help with the following. I have a database that has a table called directory. Each row in this table is a record for an auto repair shop. The ID field in this table is referenced in other tables as "shop". I have three other tables I am working with called services, warranties, and affiliations. With the guidance of Rudy I have created three more tables each with two columns. One column of each table holds the value of the shop id, the other column holds the value of service, warranty, or affiliation. So my question is how do I write a select statement to get all services OR warranties OR affiliations from their respective tables based upon the two columned table previously described. Here is my table structure.
VIEWS ON THIS POST

177

Posted on:

Friday 12th October 2012
View Replies!

Still Need help with linking strings to tables please - with diagram!

Gusy i am still struggling with this problem. I have added a diagram now to help ppl see the issue.. THe company holds a string, which i compare against the postcode table to get a match and a zone. hope this help. please help me, i will pay gold to the person who does! i am currently upto this... but its not working... $query_qryPostCodes = "SELECT ZoneID FROM postcodes WHERE PostCode LIKE SUBSTRING(" . $row_qryCompanyDetails['CompanyPostCode'] . ",1,CHAR_LENGTH(PostCode))";
VIEWS ON THIS POST

134

Posted on:

Friday 12th October 2012
View Replies!

mysql help please

Im totally new to php. mysql etc, but eager to learn. I have installed wamp from this site and now I thought I was ready to start learning, but I have a problem. When I open mysql to enter command, its just asking for password, I have just clicked enter and i get a bit of blurb but even when I enter in code to set new password, it doesnt do anything and sometimes the command box just dissapears. I think I may have something missing on installation, or Im entering code in wrong\t can anyone please help\t Im running windows 7
VIEWS ON THIS POST

158

Posted on:

Sunday 21st October 2012
View Replies!

Help with a join query please

Hi Im wondering if its possible to do what I want to do all in one query - Im guessing it is because i dont think its that complicated but its too complicated for me to figure out anytime soon. I've got two tables, equipment and services: Each equipment may have several services, and these services might be past services or upcoming services. There is a column in the services table `upcoming` which if set to 1 tells you that it is an upcoming service and if 0 a past service. I want to select all from equipment, and along with each row select the date of last service and the date of the next upcoming service. Code: table `equipment` `equipmentid`, `name`, `otherdetails` table `services` `serviceid`, `equipmentid`, `date`, `service_description`,`upcoming` Bear in mind though that a certain equipment may not have any past services or it may not have any upcoming services.
VIEWS ON THIS POST

152

Posted on:

Sunday 21st October 2012
View Replies!

Inner join help please

, Wondering if anyone could help me with a inner join query which is confusing me Code: SELECT photographic_schedule.user_id, photographic_users.name, photographic_schedule.appointment_type, photographic_schedule.live, photographic_schedule.the_date, photographic_schedule.event_begin_time, photographic_schedule.event_end_time FROM photographic_schedule INNER JOIN photographic_users ON photographic_schedule.user_id = photographic_users.user_id WHERE photographic_schedule.appointment_type =98 OR photographic_schedule.appointment_type =99 AND photographic_schedule.live =1 AND photographic_schedule.the_date = '2011-03-17' My problem being this part AND photographic_schedule.the_date = '2011-03-17'. Which it seems to ignore If I change this to any date, ie 2011-03-18, 2011-11-21 it still returns all results in my database regardless of the date
VIEWS ON THIS POST

113

Posted on:

Sunday 21st October 2012
View Replies!

query pointer please

I am querying the table of images per gallery. I want to get those of category 'a' but if there are none in that category to get those in cat 'b'. Not sure if I should use a case statement or maybe to join on the table twice looking for a non-match. maybe there is a simpler way that seems inadequate right now, to me. (bit like meself ) Code MySQL: CREATE TABLE image_galleries ( business_id int(11) NOT NULL, gallery_category varchar(64) collate utf8_unicode_ci NOT NULL default 'Main Photographic Gallery', gallery_name varchar(32) collate utf8_unicode_ci NOT NULL default '', image_id int(11) NOT NULL, sequence_number int(11) default NULL, active tinyint(4) NOT NULL default '0', PRIMARY KEY (business_id,gallery_category,gallery_name,image_id), KEY gallery_header_fk (business_id,gallery_name), KEY galerry_images_fk (image_id), KEY business_id (business_id,gallery_category,gallery_name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; sample data: Code: business_id | gallery_cat | gallery_name | image_id | seq_no | active_io | | 170 | secondary | food | 810 | 1 | 1 | | 170 | secondary | food | 812 |NULL | 0 | | 170 | secondary | general | 812 | 1 | 1 | | 170 | secondary | general | 814 | 2 | 1 | so my query is like this right now: Code MySQL: select image_id from image_galleries AS ig where business_id = '170' and gallery_name = 'secondary' and gallery_name = 'food' and active_io = 1 order by seq_no I need to get the food gallery images but if there is none, to get the (default) general images. bazz
VIEWS ON THIS POST

101

Posted on:

Sunday 21st October 2012
View Replies!

query optimisation help please.

, I am querying as shown below. query takes 2.6 seconds and there are +/- half million records in the statistics table and 200 odd in the business_details table indexes are as shown. what need I do to make the query faster, please create statement Code MySQL: CREATE TABLE statistics ( Statistic_ID int(11) unsigned zerofill NOT NULL auto_increment , Session_ID varchar(64) , Browser varchar(256) , Country_of_Connection char(3) , Time_Into_Site datetime NOT NULL default '0000-00-00 00:00:00' , Time_of_view datetime NOT NULL default '0000-00-00 00:00:00' , Site_The_Visitor_Came_From varchar(64) , Referer varchar(128) , Domain_Viewed varchar(64) , Page_Viewed varchar(64) , `Subject` varchar(50) , `File` varchar(32) , Main_Business_ID int(11) , Nearby_Business_ID int(11) , PRIMARY KEY (Statistic_ID) , KEY Domain_Viewed (Domain_Viewed) , KEY Session_ID (Session_ID) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; query Code MySQL: select stat.Domain_Viewed from statistics AS stat inner join business_details AS bd on bd.web_url = stat.Domain_Viewed where bd.business_id = 1 group by stat.Session_ID
VIEWS ON THIS POST

188

Posted on:

Sunday 21st October 2012
View Replies!

geo-spatial query help please.

I have a made a query which as far as I can tell, returns the data that it should. The issue I have is that it is telling me an incorrect distance. This is the join part of the query: Code MySQL: select business_id, sqrt( ( latitude_miles - 54.6665 )^2 + ( longitude_mpd * (longitude - 5.66341 ))^2 ) as distance from address WHERE 1 ORDER BY distance; I can't see anything wrong there so, maybe my statement which inserted the values for latitude_miles and longitude_mpd was wrong Code MySQL: UPDATE address SET latitude_miles = 69.1 * latitude, longitude_mpd = 69.1 * COS(latitude * 3.14159265 / 180) any pointers are welcome. bazz
VIEWS ON THIS POST

122

Posted on:

Sunday 21st October 2012
View Replies!

Help with a query please

I have three tables 1) products w/ productID 2) catprod_rel with categoryID and productID as FKs 3) secprod_rel with secondarycategoryID and productID as FKs I'm looking for specific products that fall under a certain category as well as a subcategory. So how would I join two tables with one in a query when I already know the categoryID and secondarycategoryID
VIEWS ON THIS POST

106

Posted on:

Sunday 21st October 2012
View Replies!

Query help

here's what you should use: Code: select terms.term , translations.language , translations.translation from terms left outer join translations on translations.term_id = terms.term_id order by terms.term , translations.language this will produce a result set that looks like this -- Code: term language translation Thank you French Merci Thank you Spanish Gracias Thank you Italian Grazie to re-arrange the results into the "crosstab" layout you wanted should be accomplished by your front-end application, not by SQL
VIEWS ON THIS POST

242

Posted on:

Sunday 21st October 2012
View Replies!

query help

Hi I have two tables: Table 1 category Fields catid,name Table 2 Ideas Fields id,catid,title I want show all category names but i also want to calculate number ideas per category as well, this i want to do with one query only, any help please
VIEWS ON THIS POST

93

Posted on:

Sunday 21st October 2012
View Replies!

I need some help indexing my tables

I was reading about indexing a little bit and got a few good points but I don't know exactly how to implement them given the way I have set up my database and access my fields. Let's just put the tables on the ...umm... table: Categories Table Code MySQL: CREATE TABLE categories ( id varchar(100) NOT NULL default '', name varchar(100) NOT NULL default '', parent varchar(100) default NULL, original_parent varchar(100) default NULL, visible tinyint(1) NOT NULL default '1', keywords varchar(255) default NULL, image varchar(255) default NULL, thumbnail varchar(255) default NULL, c_name varchar(200) default NULL, description text, c_parent varchar(100) default NULL, c_visible tinyint(1) NOT NULL default '1', PRIMARY KEY (id), KEY parentName (parent,name) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Products Table Code MySQL: CREATE TABLE products ( id varchar(20) NOT NULL default '', name varchar(100) NOT NULL default '', link text NOT NULL, nicename varchar(100) NOT NULL default '', description mediumtext NOT NULL, price decimal(9,2) NOT NULL default '0.00', merchant smallint(6) NOT NULL default '0', category varchar(100) NOT NULL default '', image varchar(255) NOT NULL default '', thumbnail varchar(255) NOT NULL default '', updated datetime NOT NULL default '0000-00-00 00:00:00', featured tinyint(1) NOT NULL default '0', visible tinyint(1) NOT NULL default '1', c_name varchar(100) default NULL, c_description text, c_category varchar(100) default NULL, network tinyint(2) NOT NULL default '0', PRIMARY KEY (id), FULLTEXT KEY product_search (c_name,name,c_description,description) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Both tables have fields that start with "c_". This is a custom field. So, if, for example, products.c_name is not null, I will show products.c_name, otherwise, I will show products.name. I do this using COALESCE in my queries and I use COALESCE a lot. Typical Query: Code: SELECT P.*, COALESCE(P.c_name, P.name) AS product_name, COALESCE(P.c_category, P.category) AS category, COALESCE(P.c_description, P.description) AS product_description FROM products AS P LEFT OUTER JOIN categories AS C ON COALESCE(P.c_category, P.category) = COALESCE(C.id, C.id) WHERE 1=1 AND COALESCE(C.c_visible, C.visible) = 1 More Info: I need to be able to search c_name,name,c_description,description in the products table in that order.products.category AND products.c_category both act as foreign keys to the categories table.categories.parent AND categories.c_parent are the parent ID's of the category. So, here are my indexing questions: I read (by longneck) that anytime you join a column, make sure both columns in the tables are indexed. Given the unique situation of using COALESCE a lot, how should I index those columns (not sure if I said that right...)Should I be creating multiple indexes for different results of the COALESCE Like one index for c_parent, parent Actually I don't have too many questions because I'm a bit lost on where to start... Eric
VIEWS ON THIS POST

178

Posted on:

Sunday 21st October 2012
View Replies!