Jump to content

Dtonlinegames

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Dtonlinegames's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Try <?php session_start(); include 'config.php'; include 'opendb.php'; $gameID= $_REQUEST['gameID']; $gameRNG= $_REQUEST['gameRNG']; $insert = mysql_query("INSERT INTO gameinstance (gameID, gameRNGResult, gameDateTime) VALUES ('$gameID', '$gameRNG', now())"); if(!$insert){ echo <?xml version="1.0"?>'; echo '<dataxml>'; die("There's little problem: ".mysql_error()); $MyError = "An error occured while saving data. Please try again later." + mysql_error(); echo "<sqlError>".$MyError."</sqlError>"; echo '</dataxml>'; } else { $gameInstanceNo = $insert; mysql_query("UPDATE gameInstance SET gameInstance_No='$gameInstanceNo' WHERE USN_Gameinstance='$gameInstanceNo'"); echo '<?xml version="1.0"?>'; echo '<dataxml>'; $success = mysql_insert_id(); echo "<success>".$success."</success>"; echo '</dataxml>'; } ?>
  2. You're table rows are dissapearing because you have you're table structure inside the while loop. While checks for a value and displays only where theres something to return, hence no table fields <?php // Connects to your Database mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); Print "<tr>"; Print "<td>Vegetable:</td><td>Seeds sown:</td><td>Harvested:</td></tr>"; $data = mysql_query("SELECT * FROM growing") or die(mysql_error()); Print "<table border cellpadding=3>"; $row=''; while($info = mysql_fetch_array( $data )) { $info['veg']=(empty($info['veg'])) ? 'None' : $info['veg']; $info['sow']=(empty($info['sow'])) ? 'None' : $info['sow']; $info['harvest']=(empty($info['harvest'])) ? 'None' : $info['harvest']; $row.="<tr><td>".$info['veg'] . "</td><td>".$info['sow'] . "</td><td>".$info['harvest'] . "</td></tr>"; } $row.="</table>"; ?> What I did was put some ternary operators in there (small if statements) that will give you're results a value even if they arent set Its not tested but should be ok hit up www.php.net and check out bits and bobs on there its the PHP dictionary
  3. Looks to me like $genno is set outside of a loop, so its set once and the number will always be more than 0 as you check here and therefore never actually changes while ($checkgenids > 0) { $genno=rand(1,50000000000000); } So you might want to put something at the end of you're code either $genno=''; Or doing a do{}while() like do{ $genno=rand(1,50000000000000); // Run some security checks for duplicate ids $genids=mysql_query("SELECT gen FROM info WHERE gen='$genno' "); $checkgenids=mysql_num_rows($genids); while ($checkgenids > 0) { $genno=rand(1,50000000000000); } // End the check $nameids=mysql_query("SELECT name FROM info WHERE name='$name' "); $checknameids=mysql_num_rows($nameids); if ($checknameids > 0) { die('<p><b><center><font color=red>Product name "'.$name.'" already exists!<hr></font></center></b></p>'); } mysql_query("INSERT INTO $maintab ($nametab, $linktab, $comptab) VALUES('$name', '$link', '$comp')") or die(mysql_error()); mysql_query("INSERT into $gcodetab ($codetab) VALUES ('$finalshuffle')") or die(mysql_error()); mysql_query("UPDATE $gcodetab SET gen='$genno' WHERE gen='0'") or die(mysql_error()); mysql_query("INSERT into download (id, gen) VALUES ('$genno', '$genno')") or die(mysql_error()); mysql_query("UPDATE $maintab SET gen='$genno' WHERE gen='fill'") or die(mysql_error()); mysql_free_result(); } while($genno!==$genno); mysql_close; That will loop that entire function as long as Genno DOESNT equal its last value I havent tested this but it seemed the only option, I had a similar problem once. Many moons ago
  4. Ah that sucks, I'll just have to reorder the variables so there in order of most used then. Thanks for the quick response! If I come up with any other resolution or idea's I'll be sure to post them up here!
  5. Hi guys, I was wondering about setting function variables. I built an SQL class and obviously I have variables to pass to it like table names and stuff. I was wondering for instance I have a function like this static function select($table,$column='',$where='',$limit='',$limitto='',$groupby='',$orderby=''){ could I try and set the group variable without setting the column,where,limit,limit to etc variables first? Like this? Database::select('table',$group='group by `row`); Or is there a specific way of doing this?
  6. I just thought how it would be so much easier, I can save my PHP files without the <?php ?> wrappers so the server doesnt execute it and give me the output I can scan the files all I want that way using preg_match_all then If anyone has any better ways of doing this then great!
  7. hey guys, Is there anyway I can read a local PHP scripts source or can I only read its output? as in this file in public_html>index.php can read public_html>example.php's source code? I'm trying to build a plug and play system for my admin application at work so I dont have to go round integrating everything with constructors all the time. Cheers in advance guys
  8. <?php $name =explode(' ', $name_field); $firstname =$name[0]; $lastname=$name[1]; ?>
  9. If its a local thing and theres a mail client missing it wouldnt say sent (I'm assuming you have suppressed errors!) try adding an extra header to your email line for From: mail($to,$subject,$content,"From: Test <test@test.com>");
  10. I've used file_get_contents and preg_match_all seemed to give me what I needed just a lot of syntax errors with the wild cards in the preg matches! confusing. its getting there I'll post a link when its done
  11. 'm not sure if fopen has the functionality I need it to have but I've never had a reason to use Curl so its a bit like argh! But basically I want to open the supplied URL check it has certain elements and how many of each and give a score at the end of it. I wouldnt really want to store the users data cos of protection etc but I guess I'm going to need a copy of it somewhere to referance and read would probably be faster and sue less bandwidth too. Dunno fopen? or curl? lol
  12. Hey guys I was wondering how youd do something like the W3C checker, like user supplied url and the script checks elements on the page. I dont know where to start with this to be honest. cheers!
  13. $mGinNo = $_POST['mGinNo']; I cant find the value for that is. echo it and see if it has a value also if (@mysql_query($sql)) {... Take the @ out. There expensive for loading and hides things that are wrong.
  14. I'll have a look, thanks for the speedy reply! I'll let you know. I was looking at FPDF but it seems a tad complex just to break a file of 3 character numbers up into text. I was just thinking it might be easier to file_get_contents and preg_replace (or str replace I'll benchmark it) and remove all the numbers (print instructions) and write a HTML file. what does everyone else think?
  15. Hi guys, I'm aware that reading a PDF is basically impossible being literally just print instructions. But I need to develope an application that can read it either by converting it to HTML/XML first or not so I can extract data to import into my tables. Does anyone know where to point me? and if your going to post third party scripts, this product is planned to go to market so I dont want sueing so can you make sure there ok to resell as part of my software Thanks guys
×
×
  • 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.