Jump to content

[Coyot3]

Members
  • Content Count

    29
  • Joined

  • Last visited

Everything posted by [Coyot3]

  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
  16. can you give us a link to test?I could not understant you real problem. sorry!Paulo A. Silva
  17. you will only see personalized scrollbars under IE. The rest of the browsers will show up them like they are.curiously under safari is not possible to configure buttons and other objects.Paulo A. Silva
  18. Do you know that all this code scrollbar-3dlight-color:#000000; scrollbar-arrow-color:#FFFFFF; scrollbar-base-color:#000033; scrollbar-darkshadow-color:#000000; scrollbar-face-color:#000066;scrollbar-track-color:#000099; scrollbar-shadow-color:#000033 is not standard and will only work under Internet Explorer?You will get in trouble to validade the code Paulo A. Silva
  19. maybe with JavaScript you can write a function that prints the menu and than you only have to call this function. function drawMenu(){ document.write("<a hre=\"page1.html\" target=\"_self\" title=\"go to page1\">page1</a>"); document.write("<a hre=\"page2.html\" target=\"_self\" title=\"go to page2\">page2</a>");} in every page include this at <head> section put this: <script src="xxx.js"></script> (I supose that you named your file xxx.js)Later, where you want to draw the menu you only have to do: <script type="text/javascript"> drawMenu();</script> By this way to will not need server side languages like PHP.Paulo A. Silva
  20. [Coyot3]

    Help me please

    In your index are missing some meta tags.Read about here:How to Use HTML Meta Tagsand than test how good are them here:Meta Tags Analyser
  21. if you are developing some kind of "application" to distribute online will be better with a backoffice.Imagine that a kid wants use your poll but he doesn't know nothing about html/php. will be easier with a page to configure the poll options.don't worry about security. make online a page to setup de database values for poll options.
  22. Hi, i supose that you are getting a common problem and the origin is the diferent box model between IE and FF.You can check here how it works.The page box is a special kind of box that is described in detail here.A lot of times you will have to use what we call "hack" to get (almost) the same result with (almost) all browsers.Take a look here to try to solve your problem.Paulo A. Silva
  23. [Coyot3]

    flash button

    if you want open a new page inside an iframe, you have to set de iframe name in getURL instruction like that: //supose that your iframe name is "my_iframe"on(release){ getURL("my_page.html", "my_iframe");} documentation herePaulo A. Silva
  24. what you want is possible to do with CSS but imagine that you have a paragraph with 3 line.The first 2 lines are full and the last one finish before the others. Here you will get the same problem.you can create a span element and set the background color. Than you get something like this<p><span class="highlight">bla bla bla bla</span></p> <html><head><style type="text/css">span.highlight{background-color:yellow}</style></head><body><p><span class="highlight">This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text.This is a text.</span></p><p><span class="highlight">hahaha</span></p></body></html> See if like in example you get your problem solved.Paulo A. Silva
  25. you have a lot of ways.the easy one is to draw some pictures and save them with names like 1.jpg, 2.jpg. than you register one by one on your database (or a file) with the respective combination. at last generate a number between 1 and the major name image you have and load than and the information placed into the file.other way is play with GDlib (my favourite ). Draw a runtime picture with what you want (numbers, letters etc).First you have to generate the string and save it (a variable is enought). Print the image on the screen with a form. Get the typed value and compare with the variable value.Paulo A. Silva
×
×
  • Create New...