nickelus Posted July 16, 2009 Share Posted July 16, 2009 I'm going kooky trying to run this simple query it works manually in mysql but not through the php script sorry if this should be in php here's the code (by the way i'm getting the initial vars echo'd on the form from another sheet that this file is included on & they are posting) /* if(isset($_POST['pusite'])&&($_POST['pusite']=="bill")){ $b_client_id=$_POST['bill_client_id']; $b_company=$_POST['bill_company']; $b_address1=$_POST['bill_address1']; $b_address2=$_POST['bill_address2']; $b_city=$_POST['bill_city']; $b_state=$_POST['bill_state']; $b_zip=$_POST['bill_zip']; include "mydbconfig.php"; mysql_select_db($database);$billSQL=print_r("INSERT INTO client_pu_site (`client_id`, `company`, `address1`, `address2`, `city`, `state`, `zip`) VALUES ('$b_client_id', '$b_company', '$b_address1', '$b_address2', '$b_city', '$b_state', '$b_zip')");mysql_query($billSQL)or die("Blah!"); //i did this to make sure the vars were posting & they were echo $b_client_id.$b_company.$b_address1.$b_address2.$b_city.$b_state.$b_zip;} ?> <form action="<?php $_SERVER['PHP_SELF'];?>" method="POST" > <table> <input type="hidden" name="bill_company" value="<?php echo $company;?>" size="32" /> <input type="hidden" name="bill_contact_name" value="<?php echo $contact_name;?>" size="32" /> <input type="hidden" name="bill_address1" value="<?php echo $address1;?>" size="32" /> <input type="hidden" name="bill_address2" value="<?php echo $address2;?>" size="32" /> <input type="hidden" name="bill_city" value="<?php echo $city;?>" size="32" /> <input type="hidden" name="bill_state" value="<?php echo $state;?>" size="32" /> <input type="hidden" name="bill_zip" value="<?php echo $zip;?>" size="32" /> <input type="hidden" name="bill_client_id" value="<?php echo $id;?>" size="32" /> <input type="hidden" name="bill_phone" value="<?php echo $phone;?>" size="32" /> <input type="hidden" name="pusite" value="bill"/> <tr valign="baseline"> <td><input type="submit" value="Same As Billing" /></td> </tr> </table> </form> */ Link to comment https://forums.phpfreaks.com/topic/166136-solved-insert-into-not-working/ Share on other sites More sharing options...
nickelus Posted July 16, 2009 Author Share Posted July 16, 2009 ok had to addslashes() I'm learning Link to comment https://forums.phpfreaks.com/topic/166136-solved-insert-into-not-working/#findComment-876171 Share on other sites More sharing options...
Ken2k7 Posted July 16, 2009 Share Posted July 16, 2009 uh... take out your printr function. Link to comment https://forums.phpfreaks.com/topic/166136-solved-insert-into-not-working/#findComment-876275 Share on other sites More sharing options...
aschk Posted July 16, 2009 Share Posted July 16, 2009 Indeed, print_r() outputs to screen unless you supply a boolean 2nd parameter (true). Link to comment https://forums.phpfreaks.com/topic/166136-solved-insert-into-not-working/#findComment-876387 Share on other sites More sharing options...
nickelus Posted July 16, 2009 Author Share Posted July 16, 2009 the print_r was for troubleshooting and is removed now. that's actually what revealed the apostrophes being output. thanks for the good eyes though i may have forgotten to remove it Link to comment https://forums.phpfreaks.com/topic/166136-solved-insert-into-not-working/#findComment-876433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.