Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. then it's also clear that mysql_num_rows isn't being parsed as expected, what does doing a print_r(mysql_num_rows($res)) actualy produce?
  2. please please please You can't name two different elements with the same name if plan on using them individualy. Also, don't use PHP_SELF, just set the action to "#". You will need to rename one of your select elements and then build conditional checks against the pair of them. Look into arrays, for this many checks they would make the most sense.
  3. hows about posting your code?
  4. Both PHP and MySQL have fairly detailed changelogs available at their respective sites, however I would recomend taking the oportunity to revise the code anyway. I suggest you only SELECT a single relevent field and run a verification against the result V's user confirmation (ie to a security question), don't use "or die(mysql_error())" in a production enviroment, end users don't care about SQL errors, and you are opening up vulnrabilities for all to see.
  5. I have established it's not a timeout issue on the query either (forced a different query to timeout and got the "Server did not respond within 30 seconds" message. This really has me stumped, even if there isn't a work around I would still like to know what the actual problem is. It looks like it's firing the query and then not waiting for the result set to be generated...
  6. OK, I have been having issues with this query for some time now, I (finaly) have the query working absoloutly fine when run directly in the database, however, when I try and run it through a PHP page I just get a completly empty result set back. I have done a print_r($row) and there is nothing, absoloutly nothing. I have ran the SQL that comes from print_r($sql) in the database and it's completly fine as well. I was getting an error previously because I had missed the "IS" out before NOT NULL for the PadPrefix, so it is parsing the SQL to some level (I now have no errors showing either). I am wondering if there is something I am missing that is needed for when the SQL is creating cached tables and/or using a counter? Here's the code, any and all suggestions welcome, Cheers <?php @SESSION_START(); require_once 'connect.php'; $bp = $_SESSION['bp']; if ($_SESSION['id'] < 99){ $tbl_top = '<table><tr><th>SheetID</th></tr>'; $WHERE = " = '$bp'"; } else{ $tbl_top = '<table><tr><th>SheetID</th><th>Prefix</th></tr>'; $WHERE = "IS NOT NULL"; } $sql = "DECLARE @badSheets TABLE (ID int, batchMax int) ". "DECLARE @list TABLE (maxsheet int, lastsheet int) ". "DECLARE @sheet int ". "DECLARE @batch int ". "DECLARE @endBatch int ". "declare @batchIndex int ". "INSERT INTO @list (maxsheet, lastsheet) ". "SELECT sheetList.maxsheet, padlist.lastSheet ". " FROM( ". " SELECT sheet.padID, MAX(sheet.SheetID) as maxsheet FROM jim.dbo.sheet as sheet ". " INNER JOIN jim.dbo.files as files on sheet.sheetID = files.sheetid ". " where sheet.sheetid > 100000 ". " group by sheet.padID) ". "AS sheetList ". "INNER JOIN( ". "SELECT pads.padID, pads.padID+(count(pads.padID)-1) as lastSheet ". "From jim.dbo.sheet as pads ". "Group By pads.PadID) ". "AS padList ". "ON (sheetList.padID = padList.padID) ". "WHERE maxsheet != lastSheet ". "DECLARE bad_batch CURSOR FOR ". "SELECT DISTINCT maxsheet FROM @list ORDER BY MaxSheet ". "OPEN bad_batch ". "FETCH NEXT FROM bad_batch ". "INTO @batchIndex ". "WHILE @@FETCH_STATUS = 0 ". "BEGIN ". "SELECT @batch = lastSheet FROM @List where maxsheet= @batchIndex ". "SELECT @sheet = maxSheet FROM @List where maxsheet= @batchIndex ". "WHILE (@sheet <= @batch) ". "BEGIN ". "INSERT INTO @badsheets(ID, batchMax) VALUES (@sheet, @batch) ". "SET @sheet = (@sheet + 1) ". "END ". "Fetch Next FROM bad_batch INTO @batchIndex ". "END ". "close bad_batch ". "deallocate bad_batch ". "SELECT sheetID, padprefix ". "FROM JIM.dbo.sheet AS sheet LEFT OUTER JOIN jim.dbo.pad AS pads ". "ON sheet.padID = pads.padID ". "WHERE ( ". "(padprefix $WHERE) ". "AND (sheet.sheetID > 100000) ". "AND (sheet.SheetID NOT IN (SELECT SheetID FROM jim.dbo.files)) ". "AND (sheet.sheetID NOT IN (SELECT ID FROM @badSheets)) ". ")"; $result = sqlsrv_query($sqlConnect, $sql) or die("error running : $sql <br><br>".print_r( sqlsrv_errors(), true)); echo "<table border=\"1\">"; echo $tbl_top; WHILE ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)){ if ($_SESSION['id'] < 99){ $tbl_content = "<tr><td>{$row['sheetID']}</td></tr>"; echo $tbl_content; } else{ $tbl_content = "<tr><td>{$row['sheetID']}</td><td>{$row['padPrefix']}</td></tr>"; echo $tbl_content; } echo $tbl_content; } echo "</table>"; ?>
  7. couple of things - 1 this screams of "homework assignment" and -2 a table isn't a textbox, so what are you supposed to be using?
  8. easiest way would be to populate the obgect on the same page, but you can create it using the GET or POST variables to populate it from the php, same as populating the card localy: <object type="text/html" data="http://domain/page.php?id=<?php echo $id; ?>" width="xxx" height="xxx" > <param name="flight_card" value="http://domain/page.php?id=<?php echo $id; ?>"> alt text </object>[code]
  9. close, but by using ='NULL' you are saying "where the field contains a thext string 'NULL' what you need is delete from testdb.products where id IS NULL;
  10. no problem, was just concerned in case someone had posed that syntax in a guide some place.
  11. OK, have found <object> code that works and validates. The problem was that everywhere was saying that the object type should be application/shockwave-x, which when used does validate, but shows nothing on the page. I played about with the type expression and found this one to do the job without needing any additional plugins for firefox: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>video test</title> </head> <body> <div id="youtube"> <object type="video/webm" data="http://www.youtube.com/embed/l3MHt5vHLSU" width="200" height="200"> <param name="filename" value ="http://www.youtube.com/embed/l3MHt5vHLSU" /> </object> </div> </body> </html>
  12. looking at that you should be able to just call an object that points to that php page: <object type="text/html" data="http://domain/page.php?id=xxx width="xxx" height="xxx" > <param name="flight_card" value="http://domain/page.php?id=xx> alt text </object>[code]
  13. Where did you get that code? UPDATE products SET pricerange= 1 WHERE WHERE id = 1
  14. then your going to need to have either a counter in the database, or better, a timestamp filed that you can use to call the most recent comment on.
  15. instead of WHERE parent_id = use WHERE parent_id IN
  16. does post_type = wp_posts.ID ?
  17. why can't you just query each database in turn - one at a time?
  18. count each column individualy: SELECT COUNT(col1) as col1_total, COUNT(col2) as col2_total, COUNT(col3) as col3_total
  19. depends on how youre programing the div for display, can we see your results page code?
  20. looks like your html refference isn't bringing in relevent information when looking for the anchors. Why don't you just add an ID hash to your backlink and grab the details by using that?
  21. intrestingly, I have never had to work out the -log or log of anything when working with date variance. Also, I don't think that you are calculating the interest properly. Interest on lones and debts are a variable percentage on the outstanding amout based on an anual percentage rate of payment, not taken against the overall outstanding amount at time of borrowing - at least in the UK it is.
  22. You have completly missed out the part where you assign your variables from $_POST[] is that the complete code you are working with?
  23. that's not the best coding, also, do you have your targets sign off on the fact that you will be ripping all the link information from their page just to check if your link is there properly? what do you get if you return and print_r($links) from ExtractAnchorText()? is it populated properly?
  24. That formula makes absoloutly no sense to me, neither does using (65, 30) right enough.
  25. I have to ask, if you inherited the DB, why can't you now change it? It's becoming evident that the original design had no consideration for the current requirements.
×
×
  • 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.