Jump to content

Stefano

Members
  • Content Count

    21
  • Joined

  • Last visited

Everything posted by Stefano

  1. Sincerilly I don't whether phpmyadmin give you such a possibility to do that interactively, like access do. I usually manage differently:1) Just create a signle table, why not?2) Manage with triggers through by SQL rather then phpmyadminIf you think triggers can solve I'll replay and give you prices tips.
  2. Stefano

    Asp Or Php

    Consider also other things you're going to chose beside the server side language. As an example PHP can be insalled in both windws and linux, IIS and Apache, ASP only on Bill's stuff!!!
  3. Two problems php and SQL: .........if (isset( $_POST["name"])){ $sql="INSERT INTO comments (name, comment) VALUES ('$name', '$comment')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } }.......mysql_query(DELETE FROM comments WHERE name = ""); is supposed to be mysql_query(DELETE FROM comments WHERE name is null);note: "" != null If you fix PHP you can omit the delete statment, and in any case such a statement should be an "after insert" trigger on DBMS side.hope it helps
  4. You are right, but in case like that I have to try and debug by myself to understand what's wrong. The links you show up are interpreted first by php then mysql and finally by php again. Are sure the problem is on MySQL side? Have you tried such a query directly in MySQL monitor? Actually you can show up many links but that will be of no help!
  5. Stefano

    Usage Of Sql

    don't worry, is very long time I left England, and it's very long time I don't use the noble language, so really, I was sure code was an uncountable noun and I was really surprised when I read "codes", not too an ironic comment That's right!!!
  6. Stefano

    Usage Of Sql

    Actually mysql_query() is a "PHP" function, there's no way to use it outside PHP.better answer:mysql_query() is the mean through which instructions are passed to MYSQL.regards
  7. Stefano

    Usage Of Sql

    codes?! I didn't know "code" was a countable word, therefore I improve my english, be patient with my english please!In that page there is not any SQL code!!!you will find SQL codes in the next page nested inside PHP code.All functions starting with suffix mysql_ are still PHP function oriented to initialize the connection between PHP and MySQL. By doing that SQL codes can be passed, since then on, to MySQL server through by php string.if (mysql_query("CREATE DATABASE my_db",$con))if (mysql_query(" : this is PHPCREATE DATABASE my_db : this is SQL nested but "CREATE DATABASE my_db" (quoted) is
  8. Stefano

    Usage Of Sql

    whenever you need to retrive or manipulate data stored in a database.Concerning on service based on server scripting (php), client scripting (js) and Db (MySQL, postgresql, Oracle,...) sql can code can be implemented in all of those parts.in javascript (very riskful for haking attack) to be passed to an asyncronus service;in the DB as stored procedure or trigger;in PHP to perorm operation on database according to request activity.Actually sql has not (usually) its own dedicated file, usually is inserted in the php code and passed as text string i.e. <?php$dbhost = 'host';$dbusername = 'root
  9. update table set col=concat( substr(col,1,instr(col,' is ')-1), ' is not ', substr(col,instr(col,' is ')+4, length(col)-(instr(col,' is ')+3)) )where col like '% is %'and col not like '% is not %' (very important, otherwise you will get things like "is not not" whether you do PHP o SQL) I didn't tested, & since it's manipulation query test it on a copy a part first, or better, try the same expression with a select statment.there are good reasons, like performance, safety, control, code and work saving, code reuse for different servic
  10. the conversion is lossy because the mapping is not one-to-one in both directionsHave a look herehttp://dev.mysql.com/doc/refman/5.1/en/dat..._unix-timestamp& let me know
  11. May be becouse it's a "group by" expression therefore returned values which are repeted are aggregated in one row!!!omit "group by week" or add "count(*)", in the "select" side.regardsstefano de boni
  12. select ahno, apc, bhno, bpcfrom( select a.hno as ahno, a.pc as apc, b.hno as bhno, b.pc as bpc from ( select rowno, hno, pc from yourtable) as a, ( select rowno, hno, pc from yourtable) as b where a.rowno mod 2 = 0 and b.rown mod 2 = 1 and (a.rowno-1)=b.rowno) I haven't debuged it let me know if helpsregardsStefano De Boni
  13. select ahno, apc, bhno, bpcfrom( select a.hno as ahno, a.pc as apc, b.hno as bhno, b.pc as bpc from ( select rowno, hno, pc from yourtable) as a, ( select rowno, hno, pc from yourtable) as b where a.rowno mod 2 = 0 and b.rown mod 2 = 1 and (a.rowno-1)=b.rowno) I haven't debuged it let me know if helpsregardsStefano De Boni
  14. Stefano

    Sql Sum Problem

    select id, game_id, datum, aantalfrom imagesorder by datum desclimit 10 I don't know whether I've understood your request, is this the solution?regardsstefano De Boni
  15. As for me is not a count issue!!!The following works with mysql, if you use oracle use "decode" function in stead of "if()" function, anything else let me knowSELECT sum( num )FROM (SELECT if( TOAC LIKE '01%', +1, -1 ) AS numFROM TELCO_CALLS) AS aname regardsstefano De Boni
  16. Stefano

    Count()

    It looks like there is some row that don't match among tables. Try with outer joins. By the way, I can't get the sense of the "order by clause" at the end of "group by query"...regardsStefano De Boni
  17. Actually (supposing you're using bill's o.s) what you need is an IDE. Do you have any skill on programming like java, delphi, visual basic or any thing else? I don't know weather you can find something around msaccess like to manage with MySQL to make a simple user interface... More over you are supposed to manage with odbc, jdbc or dao interface.From my point of view is a long story, giving that you don't mention about what you have at "home" beside MySQL. What you wonna do, a client server service, a desktop standalone application?regardsStefano De Boni
  18. i haven't anylized properly the issue (actualy too long and life too short) but when you write "..table is not updated properly" may be something is wrong at that point. Why shoudn't a table be updated properly, I can't help but think the program that manage that table doesn't work fine, or may be you need to add some trigger in mysql side.regardsstefano de boni
  19. It's up to how the view is built up. As an example a join query view, as well as view not including obligatory fields won't be updateble. Straight view over a table are supposed to be updateble. you'd better take a look to the dbms reference you're using, i guess there are differences omong different DB.regards
  20. Stefano

    Won't update

    u have to pass the 'id' in order to get it back in where clause. u can pass it, tipically, through by an hidden input included in the update formyour form should look like <form method='POST'> <input name='comment' type='text' value='".$row['comment']."'></input> <input name='id' type='hidden' value='".$row['id']."'></input> <button type='submit' name='submit'>Submit</button> </form> thus if (isset($_POST['submit'])){mysql_query("UPDATE aSET comment='".$_POST['comment']."'WHERE id='".$_POST['id']."'"); also you forgot to quote the '
  21. hi, i'm anyone... Nesting them two by two could be the answer $sql = " SELECT b.jid, b.sid, b.aid, b.time, b.title from(SELECT a.jid, a.sid, a.aid, a.time, a.title from( SELECT jid, sid, aid, time, title FROM iafm_journal where status = 'yes' UNION SELECT jid, sid, aid, time, title FROM iafm_stories) aUNION SELECT jid, sid, aid, time, title FROM iafm_comments) b order by b.time DESC LIMIT 0, 7"; consider two table as one in order derive a single virtual table, the dervived table must be aliased as MySQL wants.the most external nesting is just to allow order by and limit of the wholeregards
×
×
  • Create New...