Jump to content

gevensen

Members
  • Posts

    206
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gevensen's Achievements

Member

Member (2/5)

0

Reputation

  1. I have some routines I use over and over Is there a way to put the error section in a file of its own For example I use a routine below <script type="text/javascript"> $('.MYTRIGGER').live('change', function() { var MyData=''; $("#jq_tab").val('0'); var NameData=$(this).attr('name'); var IdData=$(this).attr('id'); MyData=MyData+'CID='+NameData;; MyData=MyData+'&Field='+IdData; MyData=MyData+'&FieldValue='+$(this).val(); $.ajax( { cache:false, timeout:28000, url : 'MyPhp.php', type : 'post', data : MyData, success : function( resp ) { $("#jq_tab").val('1'); return(false); }, error: function(xhr, status, error) { var stat = $("#jq_tab").val(); $("#main_page_div").unmask_div(); if(stat!='1'){ if (xhr.status === 0) { alert('Unable to connect to Network'); } else if (xhr.status == 404) { alert('Requested page not found. [404]'); } else if (xhr.status == 500) { alert('Internal Server Error [500].'); } else if (exception === 'parsererror') { alert('Requested JSON parse failed.'); } else if (exception === 'timeout') { alert('System Timeout (Internet Congestion or server slow)'); } else if (exception === 'abort') { alert('Ajax request aborted.'); } else { alert('Unspecified Error #' + xhr.responseText); } } return false; } // eof error function }); }); </script> Since the below is common error: function(xhr, status, error) { var stat = $("#jq_tab").val(); $("#main_page_div").unmask_div(); if(stat!='1'){ if (xhr.status === 0) { alert('Unable to connect to Network'); } else if (xhr.status == 404) { alert('Requested page not found. [404]'); } else if (xhr.status == 500) { alert('Internal Server Error [500].'); } else if (exception === 'parsererror') { alert('Requested JSON parse failed.'); } else if (exception === 'timeout') { alert('System Timeout (Internet Congestion or server slow)'); } else if (exception === 'abort') { alert('Ajax request aborted.'); } else { alert('Unspecified Error #' + xhr.responseText); } } return false; } // eof error function Is there a way to store the error function in a common file?
  2. Ive been working on this project for a few years its 117 tables per DB and about 10 DBs In development ive made changes to some of the tables The script i created a while back was missing an update here and there or i was forgetting Ive fixed that now I need to check the tables the array_diff was good what i did was compare the arrays from describe in both tables if(count(array_diff($a,$b)>'0') was greater than zero there's some kind of difference I don't care what difference at that point i take a sql dump of table b, rename table b in case of failure to xb, recreate table b from the structure of table a, import the sql dump and if all is well delete xb I had seen array_diff before but didnt think about taking a count of the arrays returned, where if it was greater than zero i had a problem just ran it on wamp and that seems to do the trick thanks mac_gyver for the thought
  3. Is there an easy way to compare the structure ( not data ) to see if 2 tables are identical? Ive used describe but im at the point where i have to loop thru the structure of each table I have a project with mutiple databases and tables and the tables in each db need to be identical I can create identical tables but im having an issue figuring out an easier way to simple compare 2 table structure
  4. try this <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php $debug_message.="START DEBUG<br/>"; $dbuser = "webestat_testdb"; $dbpass = "password"; $dbname = "webestat_testdb"; $server = "localhost"; $conn = mysqli_connect($servername, $dbuser, $dbpass, $dbname) or $debug_message.=mysqli_connect_error($conn)."</br>"; if (!mysqli_error($conn)) { $debug_message.= "Failed to connect to db" . mysqli_error($conn); } else { $sql = "SELECT * FROM 4000Series"; $results = mysqli_query($conn, $sql); while($row = mysqli_fetch_assoc($results)) { $debug_message.= "test"; $debug_message.= $row['gpu']. " " .$row['khs']. " " .$row['usd']; $debug_message.= "<br>"; } mysqli_close($conn); } echo $debug_message; ?> </body> </html>
  5. the server they are leasing as register global on, that was the issue
  6. no i went thru it with a fine tooth comb so to speak I was definately not resetting the session This drove me nuts for about 2 months I finally had the time today to sit down and track it down The crazy thing was not everyone was affected. I shared the desktop of a person in Oklahoma and watched them go thru it a few min ago and it seems to be working perfect now This person was having major issues Go figure....
  7. I just got through a server problem with a variable named $_SESSION['id'] What would happen was when I loaded a mysql request with id in it (usually what i name the main key in a table) it would overwrite the value in the $_SESSION without specifically asking it to ie $_SESSION['id']=$id; This was on an acenet server I have the same thing on a bluehost server and wampserver and never had a problem What I did on acenet was rename $_SESSION['id'] when declaring it to $_SESSION['usernumber'] and all my issues stopped Anyone know why? Is it a acenet problem? My problem is fixed im just wondering if anyone has had a similar issue?????
  8. check this out this something i am working on implementing Using phpmailer. this is all from here 1)Download PHPMailer http://phpmailer.sourceforge.net/ 2) Extract to folder phpmailer 3) Create a file email.php 4) Paste this code and change the values in blue as you need (I modified the sample code given on the PHPMailer homepage) require("phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP IsSMTP(); // send via SMTP $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "username@gmail.com"; // SMTP username $mail->Password = "password"; // SMTP password $webmaster_email = "username@doamin.com"; //Reply to this email ID $email="username@domain.com"; // Recipients email ID $name="name"; // Recipient's name $mail->From = $webmaster_email; $mail->FromName = "Webmaster"; $mail->AddAddress($email,$name); $mail->AddReplyTo($webmaster_email,"Webmaster"); $mail->WordWrap = 50; // set word wrap $mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment $mail->IsHTML(true); // send as HTML $mail->Subject = "This is the subject"; $mail->Body = "Hi, This is the HTML BODY "; //HTML Body $mail->AltBody = "This is the body when user views in plain text format"; //Text Body if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } ?> 5) Open the file class.smtp.php in phpmailer directory 6) Paste this code $host = "ssl://smtp.gmail.com"; $port = 465; before the line 104 #connect to the smtp server Hint: Search for #connect 7) Open this page in browser and it will send the email using GMail. Hint: When you want to email the details from a form, set the variables using the form variables. eg. $mail->Username=$_POST['email']
  9. sorry dumb question i tried it and it works thanks!
  10. ok yesterday i wrapped the decimal values like this, numbers are an example <?php $decimal1=2.50; $decimal2=2.50; if(strval($decimal1)!=strval($decimal2))( blah blah blah } ?> that worked if i am understanding the eplison thing i could also <?php $decimal1=2.50; $decimal2=2.50; $epsilon = 0.00001; if(abs($decimal1-$decimal2) < $epsilon) { echo "true"; } ?> correct??
  11. I am comparing 2 decimal numbers I am pulling from a mysql file for ex $row[0]==$row1[0] every once in a while i get a bad positive when I do if($row[0]==$row1[0]) when they are exactly the same? One query is a SELECT amount FROM table the other is a select SUM(amount) FROM table2 any ideas why? ive tried making them both abs() when I print the out they are =
  12. actually I just noticed when I am in my debug mode and I bring up a jAlert window it is causing this problem, I havent tracked the why down yet though as far as CSS i need to get a little better at it, I am using the numbers via jquery to return a dynamically generated table via ajax with the correct numbers
  13. vary the size of tables to suit a browser window crazy thing is it seems to have stopped misbehaving
  14. I am getting inconsistent results with var SWidth=$(window).width(); var SCheight=$(window).height(); I am running firefox 9 sometimes it will read fine and then go from 1900x1200 to longer, sometimes 3487 anybody run into this? then my browser window changes and I have to close the tab and reopen it to get the correct size again <script type="text/javascript"> $(document).ready(function(){ var SWidth=$(window).width(); var SCheight=$(window).height(); $('#scw').val(SWidth); $('#sch').val(SCheight); var TWidth=SWidth*.95; $('table.ccpaymenttable').attr('width', SWidth); $('td.TDwidth').attr('width', TWidth); }); </script>
  15. I just found Number(MyInc) works fine.. thanks
×
×
  • 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.