Jump to content

Sld

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Sld's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Been advised to use Innodb and transactions. Think it will solve my problem, thanks for your answer anyway
  2. Hi there guys, My doubt is related to PHP and MySQL usage, and it's related to check if performed queries are performed with success, since we know that: Each time we perform an sql query, we can check if it was performed with success like this: $result = mysql_query('sql query string'); if (!$result) echo mysql_error(); If it fails, it will display the succeeded error. Now that I gave an example, here are my doubts: 1. Should this procedure be done every time a query is done, or, should we assume that 'SELECT' queries are always done with success if sql syntax is correct? 2. If we have a lot of queries that depend on each other (See the next example), imagine that query1 and query2 are made with success, but query3 fails, I will have inconsistent data since, the update is made on query2, but no delete will be made on query3 since it fails. How can we avoid this? $result1 = mysql_query('SELECT ...'); if (!$result1) { echo mysql_error(); exit(0); } $result2 = mysql_query('UPDATE ... with data supplied from $result1'); if (!$result2) { echo mysql_error(); exit(0); } $result3 = mysql_query('INSERT / UPDATE / DELETE ... with data supplied from $result1'); if (!$result3) { echo mysql_error(); exit(0); } Hope you guys can understand my examples, if not, I'll try to explain in a better way. Thanks for your attention and spent time on reading this.
  3. Problem solved, $header .= "Cookie: ".$cookie."\r\n"; Something like that will save the data obtained on 1st part Thanks anyway.
  4. Hi there guys, I need some ideias on this problem, it looks like this: * I need to have a script that logs in hi5 with a given username/password [This one is already working] * Then uploads pictures to the given username profile [??] My doubt is, how can I keep the 2nd part of the script logged in so I can upload my picture? I need to do this with sockets, not using curl functions. Any help on this one will be much appreciated, thanks in advance.
  5. Tks dwd, sorry for the double post! The not in will only be available in 4.1 version. Anyway you\'re right, do you have any ideia how can i make this in another way?
  6. Hi there dwd\'s (SELECT poll.id,topico,count(*) as votos,unix_timestamp(inicio) as i, unix_timestamp(fim) as f FROM poll_votes,poll WHERE poll_votes.pollid = poll.id and \'$datactual\'>inicio and \'$datactual\'>fim GROUP BY poll_votes.pollid) UNION (SELECT poll.id,topico,0,unix_timestamp(inicio) as i, unix_timestamp(fim) as f FROM poll WHERE \'$datactual\'>inicio and \'$datactual\'>fim and id NOT IN (SELECT poll.id FROM poll,poll_votes WHERE poll_votes.pollid=poll.id and \'$datactual\'>inicio and \'$datactual\'>fim)) LIMIT $pagstart, $max I\'ve got this query and it works fine, in a beta version of mysql in standart nop since it doesnt support NOT IN syntax, can anyone helpme with this? Any other ideias? Tks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.