Jump to content

[Coyot3]

Members
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

0 Neutral

About [Coyot3]

  • Rank
    Newbie
  • Birthday 02/24/1985

Contact Methods

  • Website URL
    http://www.pauloasilva.com
  • ICQ
    0

Profile Information

  • Location
    Portugal
  1. [Coyot3]

    MySQL Triggers

    Finally I found the problem.For those who have the same problem I recommend to read Section D.1, “Restrictions on Stored Routines, Triggers, and Events” at MySQL website.Triggers and other Stored Routines are under some restrictions. In this case the problem are the lines where i perform SELECT operations because they return a result set.These operations must be done using user defined variables with SELECT ... INTO ... instruction and the final trigger will look like CREATE TRIGGER generatePin AFTER INSERT ON sbauctions_members FOR EACH ROW BEGIN SET @pin = SHA(NOW()); SET @pinLength = 8; SET @start = FLOOR(1+RAND()*((LENGTH(@pin)-@pinLength)-1)); SET @statusName; /* get name of status where bids are forbidden and expose allowed */ SELECT name INTO @statusName FROM sbauctions_status WHERE bid=1 AND expose=0; /* insert activation member status */ INSERT INTO sbauctions_members_status (memberID,statusID,pin) VALUES (NEW.id,@statusName,@pin); END; POST FULL EDITED
  2. [Coyot3]

    MySQL Triggers

    Hi all,everytime I need to create a trigger I get in troubles.This time I have the code above CREATE TRIGGER generatePin AFTER INSERT ON sbauctions_members FOR EACH ROW BEGIN SET @pin = SHA(NOW()); SET @pinLength = 8; SET @start = FLOOR(1+RAND()*((LENGTH(@pin)-@pinLength)-1)); SET @statusName; /* get name of status where bids are forbidden and expose allowed */ SELECT @statusName:=name FROM sbauctions_status WHERE bid=1 AND expose=0; /* insert activation member status */ INSERT INTO sbauctions_members_status (memberID,statusID,pin) VALUES (LAST_INSERT_ID(),@statusName,@pin); END; that when executed returns syntax error at line 3.I'm using MySQL 5.0.41. Can you find any problem?Thanks in advance.
  3. [Coyot3]

    query prob

    Try this$Rsql = mysql_query("INSERT INTO post (name, time) VALUES ('$name',NOW())") or die (mysql_errno() .": ". mysql_error()); and tell us the message you got!
  4. [Coyot3]

    MySQL Transactions

    Hi all,I'm trying to execute the following query from PHP SET AUTOCOMMIT=0;START TRANSACTION; INSERT INTO `viagens` (origem, destino, matricula, dataPartida, dataChegada, descricao, iva, preco) VALUES (1, 2, '123456', DATE_FORMAT('2008/02/24 10:40','%Y/%m/%d %H:%i'), DATE_FORMAT('2008/02/28 12:00','%Y/%m/%d %H:%i'), 'excelente viagem :)', 21, 16); SELECT @last:=max(idViagem) FROM viagens;INSERT INTO `viagensLocaisTuristicos` (idViagem, codigoLocal, dataPassagem) VALUES (@last,2,DATE_FORMAT('2008/02/26 15:15','%Y/%m/%d %H:%i')); INSERT INTO `viagensLocaisTuristicos` (idViagem, codigoLocal, dataPassagem) VALUES (@last,1,DATE_FORMAT('2008/02/24 13:00','%Y/%m/%d %H:%i'));COMMIT; and I'm always receiving the error 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 ';START TRANSACTION; INSERT INTO `viagens` (origem, destino, matricula, dataPar' at line 1 I'm not sure if I can execute all query at the same time or if I must execute each instruction separatly: something like mysql_query("SET AUTOCOMMIT=0;", $Rcon);mysql_qeury("START TRANSACTION;", $Rcon);//insert operationsmysql_query("COMMIT;", $Rcon); This way seems stupid because I will need a loop to execute all insert operations when I could send one query with all script.Thanks in advance.
  5. [Coyot3]

    What else can I do?

    Start playing with sockets!
  6. [Coyot3]

    Foreign Keys

    @Reg Edit: You're right !Thanks a bunch
  7. [Coyot3]

    Foreign Keys

    @justsomeguy: thanks for your answer.Your suggestion is to create a schema like categories(id,name,description)catCat(parent,id) where parent will be foreign key from categories (like id) and both will form the primary key of catCat.You suggestion make sense if we think about transitive closure: if A is B's mother and B is C's mother then A is C's mother.Which solution you think is better?@Reg Edit: Allow nulls in mother column is only possible if the attribute is not FOREIGN KEY (neither PRIMARY).I'm not sure that this is the best solution. I'm thinking to create other table to store relations. What you think about it?Thanks all of you
  8. [Coyot3]

    Foreign Keys

    Hi all,think about the case you want to describe a table like: CREATE TABLE categories( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, description VARCHAR(255) NULL, mother INT NOT NULL DEFAULT 0, PRIMARY KEY (id), FOREIGN KEY (mother) REFERENCES categories(id)) ENGINE=INNODB; the goal is to get support to a leveled menu likecars BMW FORDmotos KAWASAKIThe problem I got, when trying to insert the first (and least) record, was #1452 - Cannot add or update a child row: a foreign key constraint fails (`bookmarks/categories`, CONSTRAINT `categories_ibfk_1` FOREIGN KEY (`mother`) REFERENCES `categories` (`id`)) just because I have a circular (or auto reference) foreign key: categories.mother REFERENCES categories.id!When I thought the problem it seemed the best solution to solve the problem.I can take out the foreign key and that will become a regular attribute but I will lose the referential integrity.I'm sure it's a problem with a simple solution but I'm not being able to get it. Any idea!?Thanks in advance.
  9. [Coyot3]

    url problems

    Are you running your script on your localhost or webserver?Check if in your php.ini REGISTER GLOBALS are 'On'!Which erro message you get?
  10. in my browser (Safari) your footer is on bottom.i supose that you want a white space between your three middle bars. to do this you just have to define a footer margin like #footer {border: 1px solid #ccc;margin: 20px 0 0 0;padding: 4px;background-color: #000000;font-size: 16px; color: #FFFFFF;} if you want to put your footer in the bottom of the page set position to absolute and bottom to 0.
  11. [Coyot3]

    float left

    maybe your problem is here: h1.floatleft{float: left;padding: 5px 0px 5px 5px; width: 99%;} if your h1.floatleft has 99% of page with the object that will appear on the right of h1.floatleft only can have 1% of page width (or other object with).Reduce h1.floatleft width and i supose you will get your problem solved.enjoyPaulo A. Silva
  12. the problem is the <embed> that is not standard.
  13. take a time to read this article.
  14. I'm sorry but here i only can check with Safari and FireFox. I'm a OS X user I'm thinking about your problem i got other. your left side height is less than your content space, so you will get your text around your menu.Writting your content box on the left you can use float: left without problems.I will check a way to solve this and i will say you later. Sorry.OK, i supose that i got want you want: <!-- HTML PAGE--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link href="main.css" media="all" type="text/css" /><title>Untitled Document</title></head><body> <div id="header"> <h1>your header</h1> </div> <div id="leftSide"> <ul> <li>link1</li> <li>link2</li> <li>link3</li> </ul> </div> <div id="mainArea"> <p>your contentsasdasdasdasdaaaaaaaaaaaaaaaaaaaaaaa</p> <p>more content</p> <p>other lines...</p> <p>more</p> <p>mores</p> <p>more</p> </div></body></html> /*CSS file*/#header{ border: 1px solid #0000BB;}#leftSide{ border: 1px solid #33FF66; width: 200px; position: relative; float: left;}#mainArea{ border: 1px solid #CC00CC; position: absolute; float: right; left: 210px;} I recommend you to read this article.Paulo A. Silva
  15. to take out all space around the text do this: h1{ margin: 0; padding: 0;} to check if everything is OK you can set borders like this: h1{ border: 1px solid red;} now you know how are yours h1's. than set border to 0.Paulo A. Silva
×
×
  • Create New...