PHP - Data Extraction From Databse Issue
My db table has columns "id" (int-11), "date(varchar-50)", "author name(varchar-100)", "text (varchar-100000)"...
I am storing images + text in text field of database. Everything is going fine while i am using ckeditor to insert data into the database for that particular text field. Now when i am retrieving data from database... i am able to extract id, date, autorname successfully (i have check it while the issue came)..but when i am trying to retrieve text field which have image, that jumps to page not found error... what could be the issue... am i having problem with database or editor that i am using???? Similar TutorialsHi all I am describing my problem below can any body please look into this I have two databases DB1:datain1 DB2:datain2 having the below structure database, table, fields datain1 , student , id,name datain2 , student , id,name the two databases having same structure My query is i want copy all data from datain1 to datain2 on daily process through php script(script will be executed manually on daily) i don't want any duplicate or repeated data in datain2 give me some script to do this kindly help me to solve this its so urgent I am in the process of teaching myself PHP/MySQL. I have taught myself other programming languages in the past so its not that i can't learn. but as i'm new and trying to learn both at the same time, i'm needing some help with php / mysql to datamine either of the following sites. www.findchips.com www.eciaauthorized.com WHat i want to do is after putting in the part number, for each distributor that returns data i want to extract the following data for each distributor Quantity Break Resale at quantity break Current Stock I want to write the data into a field in the database that holds the p/n's and my company's resale. I'm wanting to do this as an exercise so that i can dynamically benchmark my resales against that of my competitors. To get a feel of the data that is returned, please use the following p/n. 1n4001-e3/54 any and all help would be greatly appreciated Hey, I have a script that is meant to grab links of a specific type. Code: [Select] <?php //need to some how extract all links from this text $link = '[quote]http://www.domain.com/?d=03WO6WPC random text, http://www.domain.com/?d=0334fWPChttp://www.domain.com/?d=03WV4SPC[/quote]'; ?> The urls are always the same character length, but there is no telling how the user types them out so im looking for a way to extract the 3 urls based on domain.com. The end result should be to create an array of 3 urls which belong to domain.com . I tried explode but some one may type it without spaces so explode fails.. any ideas? OK, I just want to extract the agency name, complete address, and phone number from this mess : {"facilities": [ { "fclt_name":"BEACH & O'NEILL IN", "fclt_addr":"7520 GREENBACK LN", "fclt_city":"CITRUS HEIGHTS", "fclt_state":"CA", "fclt_zip":"95610", "tel_no":"916.676.0844", "fax_no":"916.676.0860", "fclt_url":"null", "fclt_lattd":"38.6781788", "fclt_longtd":"-121.289615", "fclt_ctgy_cd":"2", "fclt_distance":"3.26341268894218446122718887944106659512" }, { "fclt_name":"AMERICAN AIM AUTO", "fclt_addr":"5341 SAN JUAN AVE", "fclt_city":"FAIR OAKS", "fclt_state":"CA", "fclt_zip":"95628", "tel_no":"916.962.0401", "fax_no":"916.962.0414", "fclt_url":"null", "fclt_lattd":"38.6625015", "fclt_longtd":"-121.2922782", "fclt_ctgy_cd":"2", "fclt_distance":"3.50675708898608342216618250068171298694" }, { "fclt_name":"INSZONE INSURANCE", "fclt_addr":"7200 FAIR OAKS BLVD STE 210", "fclt_city":"CARMICHAEL", "fclt_state":"CA", "fclt_zip":"95608", "tel_no":"916.503.8784", "fax_no":"916.486.4335", "fclt_url":"null", "fclt_lattd":"38.631717", "fclt_longtd":"-121.327626", "fclt_ctgy_cd":"2", "fclt_distance":"4.01207784800582596431030369642981690151" }, { "fclt_name":"PARK FAMILY INS &", "fclt_addr":"801 RIVERSIDE AVE STE 100", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95678", "tel_no":"888.723.7275", "fax_no":"866.772.2912", "fclt_url":"null", "fclt_lattd":"38.732289", "fclt_longtd":"-121.289295", "fclt_ctgy_cd":"2", "fclt_distance":"4.47210016333570016664044149856001806252" }, { "fclt_name":"RK JACOBS INSURANC", "fclt_addr":"4777 SUNRISE BLVD STE B", "fclt_city":"FAIR OAKS", "fclt_state":"CA", "fclt_zip":"95628", "tel_no":"916.966.3733", "fax_no":"916.966.0177", "fclt_url":"null", "fclt_lattd":"38.6525671", "fclt_longtd":"-121.2728244", "fclt_ctgy_cd":"2", "fclt_distance":"4.75887214653382230652493164121477832758" }, { "fclt_name":"BERTOLINO INSURANC", "fclt_addr":"2985 FULTON AVE", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95821", "tel_no":"916.384.9621", "fax_no":"877.553.0066", "fclt_url":"null", "fclt_lattd":"38.6190831", "fclt_longtd":"-121.4015452", "fclt_ctgy_cd":"2", "fclt_distance":"5.50381610176691043722708919483708216851" }, { "fclt_name":"THE PEXA GROUP", "fclt_addr":"1221 PLEASANT GROVE BLVD", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95678", "tel_no":"916.788.4200", "fax_no":"916.788.4204", "fclt_url":"null", "fclt_lattd":"38.772237", "fclt_longtd":"-121.308503", "fclt_ctgy_cd":"2", "fclt_distance":"6.25871993199859278950600593840623920844" }, { "fclt_name":"PARAMOUNT EQUITY I", "fclt_addr":"8781 SIERRA COLLEGE BLVD", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"877.284.2424", "fax_no":"888.811.2910", "fclt_url":"null", "fclt_lattd":"38.7424319", "fclt_longtd":"-121.2511908", "fclt_ctgy_cd":"2", "fclt_distance":"6.50250135161509994547872070619122902873" }, { "fclt_name":"PETERSON & GRANTHA", "fclt_addr":"1508 EUREKA RD STE 175", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"916.431.0400", "fax_no":"916.431.0221", "fclt_url":"null", "fclt_lattd":"38.749593", "fclt_longtd":"-121.250556", "fclt_ctgy_cd":"2", "fclt_distance":"6.83036958706746253088617532680453999753" }, { "fclt_name":"INDEPENDENT SOL UN", "fclt_addr":"2723 ZINFANDEL DR", "fclt_city":"RANCHO CORDOVA", "fclt_state":"CA", "fclt_zip":"95670", "tel_no":"916.635.6760", "fax_no":"916.635.9804", "fclt_url":"null", "fclt_lattd":"38.5967846", "fclt_longtd":"-121.2894781", "fclt_ctgy_cd":"2", "fclt_distance":"7.03267554456276560054938083160853750814" }, { "fclt_name":"MORE CHOICES INS A", "fclt_addr":"1474 STONE POINT DR # 131", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"916.899.6600", "fax_no":"916.647.0522", "fclt_url":"null", "fclt_lattd":"38.755322", "fclt_longtd":"-121.249216", "fclt_ctgy_cd":"2", "fclt_distance":"7.14043819089449986827741629585808532375" }, { "fclt_name":"ALBANO DALE DUNN &", "fclt_addr":"9197 GREENBACK LN", "fclt_city":"ORANGEVALE", "fclt_state":"CA", "fclt_zip":"95662", "tel_no":"916.988.0214", "fax_no":"916.989.4719", "fclt_url":"null", "fclt_lattd":"38.678737", "fclt_longtd":"-121.212147", "fclt_ctgy_cd":"2", "fclt_distance":"7.40385556560869808878938590652772224486" }, { "fclt_name":"MCGEE & THIELEN IN", "fclt_addr":"3780 ROSIN CT STE 120", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95834", "tel_no":"916.646.1919", "fax_no":"916.646.0995", "fclt_url":"null", "fclt_lattd":"38.636195", "fclt_longtd":"-121.473132", "fclt_ctgy_cd":"2", "fclt_distance":"7.57412262483417036891911065525086823482" }, { "fclt_name":"AGENTS RESOURCES I", "fclt_addr":"11190 SUN CENTER DR", "fclt_city":"RANCHO CORDOVA", "fclt_state":"CA", "fclt_zip":"95670", "tel_no":"916.443.4221", "fax_no":"916.443.5559", "fclt_url":"null", "fclt_lattd":"38.597237", "fclt_longtd":"-121.267659", "fclt_ctgy_cd":"2", "fclt_distance":"7.61684981655654181229982085243856553867" }, { "fclt_name":"STEVE C LUTH INS", "fclt_addr":"9480 MADISON AVE STE 1", "fclt_city":"ORANGEVALE", "fclt_state":"CA", "fclt_zip":"95662", "tel_no":"888.597.8383", "fax_no":"916.989.9102", "fclt_url":"null", "fclt_lattd":"38.6735726", "fclt_longtd":"-121.2007054", "fclt_ctgy_cd":"2", "fclt_distance":"8.053760009460164598304836725423812559" }, { "fclt_name":"MCDOWALL & KEENEY", "fclt_addr":"865 HOWE AVE STE 200", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95825", "tel_no":"916.567.3233", "fax_no":"916.567.3155", "fclt_url":"null", "fclt_lattd":"38.581372", "fclt_longtd":"-121.41588", "fclt_ctgy_cd":"2", "fclt_distance":"8.16424077949136484737583499892043887019" }, { "fclt_name":"SIERRA OAK INS SER", "fclt_addr":"9700 BUSINESS PARK DR STE 105", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95827", "tel_no":"916.364.7380", "fax_no":"916.364.7381", "fclt_url":"null", "fclt_lattd":"38.568104", "fclt_longtd":"-121.334623", "fclt_ctgy_cd":"2", "fclt_distance":"8.27507991633456734395325050580063137134" }, { "fclt_name":"RICHARD CHRISTOPHE", "fclt_addr":"5842 LONETREE BLVD", "fclt_city":"ROCKLIN", "fclt_state":"CA", "fclt_zip":"95765", "tel_no":"916.626.3305", "fax_no":"916.471.0311", "fclt_url":"null", "fclt_lattd":"38.8065456", "fclt_longtd":"-121.293125", "fclt_ctgy_cd":"2", "fclt_distance":"8.76951297025304552186130788422901665504" }, { "fclt_name":"ADEPT INSURANCE SE", "fclt_addr":"101 PARKSHORE DR STE 30061", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.944.2192", "fax_no":"866.529.5303", "fclt_url":"null", "fclt_lattd":"38.6570589", "fclt_longtd":"-121.186783", "fclt_ctgy_cd":"2", "fclt_distance":"8.9960609261835699863946424309422450653" }, { "fclt_name":"PARAGON INSURANCE", "fclt_addr":"301 NATOMA ST STE 104", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.353.1023", "fax_no":"916.353.1370", "fclt_url":"null", "fclt_lattd":"38.678047", "fclt_longtd":"-121.168827", "fclt_ctgy_cd":"2", "fclt_distance":"9.73781780936977222523189878525699239046" }, { "fclt_name":"CLINTON POLLEY GRO", "fclt_addr":"1675 CREEKSIDE DR STE 100", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.984.3000", "fax_no":"916.984.3100", "fclt_url":"null", "fclt_lattd":"38.6716438", "fclt_longtd":"-121.1446657", "fclt_ctgy_cd":"2", "fclt_distance":"11.07358533782419719432038848742812184727" }, { "fclt_name":"ALPHA BOND INSURAN", "fclt_addr":"3918 60TH ST", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95820", "tel_no":"866.313.3077", "fax_no":"916.429.7974", "fclt_url":"null", "fclt_lattd":"38.5393731", "fclt_longtd":"-121.4344591", "fclt_ctgy_cd":"2", "fclt_distance":"11.21762941497442801416098309046154379963" }, { "fclt_name":"HEBARD INSURANCE A", "fclt_addr":"3837 TAYLOR RD", "fclt_city":"LOOMIS", "fclt_state":"CA", "fclt_zip":"95650", "tel_no":"916.652.0404", "fax_no":"916.652.9123", "fclt_url":"null", "fclt_lattd":"38.81657", "fclt_longtd":"-121.197889", "fclt_ctgy_cd":"2", "fclt_distance":"12.08374482196660408349940289432841322946" }, { "fclt_name":"PILCHER INSURANCE", "fclt_addr":"3805 TAYLOR RD STE 1", "fclt_city":"LOOMIS", "fclt_state":"CA", "fclt_zip":"95650", "tel_no":"916.660.1670", "fax_no":"916.660.1672", "fclt_url":"null", "fclt_lattd":"38.817032", "fclt_longtd":"-121.197206", "fclt_ctgy_cd":"2", "fclt_distance":"12.13211505726556203701939114285606195057" }, { "fclt_name":"RUSSELL VANG INS &", "fclt_addr":"2751 FRUITRIDGE RD STE 15", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95824", "tel_no":"916.428.2267", "fax_no":"916.428.2341", "fclt_url":"null", "fclt_lattd":"38.517011", "fclt_longtd":"-121.4513314", "fclt_ctgy_cd":"2", "fclt_distance":"13.00258097375703227426814846084345607012" }, { "fclt_name":"PC INSURANCE AGENC", "fclt_addr":"6333 STOCKTON BLVD STE A", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95824", "tel_no":"916.391.5990", "fax_no":"916.391.5993", "fclt_url":"null", "fclt_lattd":"38.5111875", "fclt_longtd":"-121.4360945", "fclt_ctgy_cd":"2", "fclt_distance":"13.04926930736758364287316544823571444809" }, { "fclt_name":"GOLDENBEST INSURAN", "fclt_addr":"6830 STOCKTON BLVD # 100", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95823", "tel_no":"916.231.9955", "fax_no":"916.231.9954", "fclt_url":"null", "fclt_lattd":"38.502632", "fclt_longtd":"-121.43303", "fclt_ctgy_cd":"2", "fclt_distance":"13.54608070539524090996150854589636455506" }, { "fclt_name":"EDWARD C BRODIE IN", "fclt_addr":"2379 GATEWAY OAKS DR STE 150", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95822", "tel_no":"916.927.6343", "fax_no":"916.927.8848", "fclt_url":"null", "fclt_lattd":"38.5128714", "fclt_longtd":"-121.4970294", "fclt_ctgy_cd":"2", "fclt_distance":"14.46565232261373440674810015002201060961" }, { "fclt_name":"LINH DO INSURANCE", "fclt_addr":"6511 SAVINGS PL STE 115", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95828", "tel_no":"916.393.8383", "fax_no":"916.393.8382", "fclt_url":"null", "fclt_lattd":"38.4739858", "fclt_longtd":"-121.3884671", "fclt_ctgy_cd":"2", "fclt_distance":"14.89569563450147516294105371450235166475" }, { "fclt_name":"STRATTON AGENCY", "fclt_addr":"957 INDUSTRIAL RD STE C", "fclt_city":"SAN CARLOS", "fclt_state":"CA", "fclt_zip":"95762", "tel_no":"650.508.0124", "fax_no":"650.508.0121", "fclt_url":"null", "fclt_lattd":"38.6637192", "fclt_longtd":"-121.067907", "fclt_ctgy_cd":"2", "fclt_distance":"15.24924065635783489201051962237991277729" }, { "fclt_name":"PACIFIC INTERSTATE", "fclt_addr":"5072 HILLSDALE CIR STE 110", "fclt_city":"EL DORADO HILLS", "fclt_state":"CA", "fclt_zip":"95762", "tel_no":"916.941.0518", "fax_no":"916.941.0547", "fclt_url":"null", "fclt_lattd":"38.621938", "fclt_longtd":"-121.062804", "fclt_ctgy_cd":"2", "fclt_distance":"16.0891004210135393693458563137933030129" }, { "fclt_name":"AMAZING INSURANCE", "fclt_addr":"8398 LAPORTE WAY", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.719.6449", "fax_no":"916.258.6679", "fclt_url":"null", "fclt_lattd":"38.445406", "fclt_longtd":"-121.394576", "fclt_ctgy_cd":"2", "fclt_distance":"16.89751994304863412037777682922840849653" }, { "fclt_name":"WAHLA INSURANCE &", "fclt_addr":"4809 LAGUNA BLVD STE 100", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95758", "tel_no":"916.429.4741", "fax_no":"916.429.4743", "fclt_url":"null", "fclt_lattd":"38.424506", "fclt_longtd":"-121.449703", "fclt_ctgy_cd":"2", "fclt_distance":"18.95918985420010413223068782438653209117" }, { "fclt_name":"MOTHER LODE INS SE", "fclt_addr":"2514 CAMEO DR STE A", "fclt_city":"CAMERON PARK", "fclt_state":"CA", "fclt_zip":"95682", "tel_no":"530.677.8755", "fax_no":"530.677.8314", "fclt_url":"null", "fclt_lattd":"38.6578609", "fclt_longtd":"-120.999481", "fclt_ctgy_cd":"2", "fclt_distance":"18.96331840626573060295348092634463597585" }, { "fclt_name":"WOODEL INSURANCE", "fclt_addr":"8788 ELK GROVE BLVD STE P", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.714.5122", "fax_no":"916.714.5123", "fclt_url":"null", "fclt_lattd":"38.408374", "fclt_longtd":"-121.377051", "fclt_ctgy_cd":"2", "fclt_distance":"19.33537262024884176605153693999802777133" }, { "fclt_name":"AMAN INSURANCE AGE", "fclt_addr":"8788 ELK GROVE BLVD BLDG 3", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.213.1900", "fax_no":"800.714.6082", "fclt_url":"null", "fclt_lattd":"38.408374", "fclt_longtd":"-121.377051", "fclt_ctgy_cd":"2", "fclt_distance":"19.33537262024884176605153693999802777133" }, { "fclt_name":"MULHOLLAND INSURAN", "fclt_addr":"2358 MARITIME DR STE 100", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95758", "tel_no":"916.691.5555", "fax_no":"916.691.0555", "fclt_url":"null", "fclt_lattd":"38.413727", "fclt_longtd":"-121.483123", "fclt_ctgy_cd":"2", "fclt_distance":"20.24810658073937047943171540052851815376" }, { "fclt_name":"SILLECT INSURANCE", "fclt_addr":"100 KENTUCKY AVE", "fclt_city":"WOODLAND", "fclt_state":"CA", "fclt_zip":"95695", "tel_no":"530.662.9050", "fax_no":"888.613.5849", "fclt_url":"null", "fclt_lattd":"38.691387", "fclt_longtd":"-121.781223", "fclt_ctgy_cd":"2", "fclt_distance":"23.3148181263597264149496516029276053035" }, { "fclt_name":"VAUGHT WRIGHT & BO", "fclt_addr":"533 MAIN ST", "fclt_city":"PLACERVILLE", "fclt_state":"CA", "fclt_zip":"95667", "tel_no":"530.622.1835", "fax_no":"530.622.3860", "fclt_url":"null", "fclt_lattd":"38.7298", "fclt_longtd":"-120.798354", "fclt_ctgy_cd":"2", "fclt_distance":"29.83338181060752344743347837235784856168" }, { "fclt_name":"DARR INSURANCE AGE", "fclt_addr":"550 MAIN ST", "fclt_city":"PLACERVILLE", "fclt_state":"CA", "fclt_zip":"95667", "tel_no":"530.217.6002", "fax_no":"530.626.4590", "fclt_url":"null", "fclt_lattd":"38.728995", "fclt_longtd":"-120.797821", "fclt_ctgy_cd":"2", "fclt_distance":"29.85673424682092359769083672633797070566" } ] } I currently have an array called: $find[pagetext] In this array, there is going to be one to several instances where I am looking for a specific forum coding called: [url=http://megaupload.com/?d=X]http://megaupload.com/?d=X[/url] Everyone has used megaupload but what this script basically is going to do is check the validity of the upload site the user has chosen. Above I selected megaupload but there are about 6 sites I am going to check in the code I'm writing. I'm stuck on 1 part. How can I extract from $find[pagetext] all occurances of the website (In this case) megaupload and assign each instance to array. Once I assign it to an array I've already written a function that will check and see if the web link is valid I just need to basically extract each URL occurance of megaupload or whatever the upload site I am checking there is. All help is greatly appreciated. hello, I am trying to figure out how I can take only the v= in the youtube urls http://www.youtube.com/watch?v=nGawAhRjtoA&feature=topvideos i just want php to take v=nGawAhRjtoA and ignore everything else any ideas guys/gals? thanks Code: [Select] $sql= ("INSERT INTO custcards (username,Card_Number,Card_Type,Card_Name,Card_End) VALUES('$username','$cardnumber','$cardtype','$cardname','$cardend')"); if (isset($_GET['submitted'])) { if (checkCreditCard ($_GET['CardNumber'], $_GET['CardType'], $errornumber, $errortext)) { $errortext = 'This card has a valid format'; // Default text if card is VALID $result = mysql_query($sql)){ echo "$errortext"; // Echo/Show this text } } else { echo '<p align=center>';echo "$errortext"; // Display ERROR Type/Text echo "ERROR: ".mysql_error(); } } The code is to check details beign entered and to make sure thier correct and then print the correcrt message but i also want it to store the details into a table i know i havent got the syntax correct was wondering is anyone can help ? I need to perform a search of my DB using 6 fields. I want to progress thru the searches as so: Row: A B C D E F Select A, if A then select B, if B then select C if C then select D, if D select E, if E then select F I then want to extract the data from each field. if A then $a = A, if B then $b = B, etc etc. I don't want to have a whole bunch of different select statements or if conditions if I don't need to. Also, the DB is rather large so i think evaluating: $query = "SELECT * FROM table" Might be overkill. Is there anyway to do something like: $queryA = SELECT * FROM table WHERE A = subject1 if($queryA){$queryB = SELECT * FROM $queryA WHERE B = subject2} if($queryB){$queryC = SELECT * FROM $queryB WHERE C = subject3} etc etc etc So basically I just progressively filter down one original mysql query to get what I need. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=353645.0 I have insert image using this following code but i want to know where it is storing i want file path of the imahe what i have inserted Code: [Select] <html> <head><title>File Insert</title></head> <body> <h3>Please Choose a File and click Submit</h3> <form enctype="multipart/form-data" action= "<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000" /> <input name="userfile" type="file" /> <input type="submit" value="Submit" /> </form> </body> <?php // check if a file was submitted if(!isset($_FILES['userfile'])) { echo '<p>Please select a file</p>'; } else { try { upload(); //this will upload your image echo '<p>Thank you for submitting</p>'; //Message after uploading image } catch(Exception $e) { echo $e->getMessage(); echo 'Sorry, could not upload file'; } } // the upload function function upload(){ include "file_constants.php"; $maxsize = $_POST['MAX_FILE_SIZE']; if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { // check the file is less than the maximum file size if( $_FILES['userfile']['size'] < $maxsize) { // prepare the image for insertion $imgData =addslashes (file_get_contents($_FILES['userfile']['tmp_name'])); // put the image in the db... // database connection mysql_connect($host, $user, $pass) OR DIE (mysql_error()); // select the db mysql_select_db ($db) OR DIE ("Unable to select db".mysql_error()); // our sql query $sql = "INSERT INTO test_image (image, name) VALUES ('{$imgData}', '{$_FILES['userfile']['name']}');"; // insert the image mysql_query($sql) or die("Error in Query: " . mysql_error()); } } else { // if the file is not less than the maximum allowed, print an error echo '<div>File exceeds the Maximum File limit</div> <div>Maximum File limit is '.$maxsize.'</div> <div>File '.$_FILES['userfile']['name'].' is '.$_FILES['userfile']['size']. ' bytes</div> <hr />'; } } ?> </html> Ik probeer een online gehost .xml bestand in een database te plaatsen.
Ik heb inmiddels alle foutmeldingen weg weten te werken (door ze op te lossen :-)) maar heb nu een blanco pagina zonder errors en geen data in mijn database
Hier is wat ik tot nu toe heb gedaan.
<?php // Turn off all error reporting error_reporting(0); // Report simple running errors error_reporting(E_ERROR | E_WARNING | E_PARSE); // Reporting E_NOTICE can be good too (to report uninitialized // variables or catch variable name misspellings ...) error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // Report all errors except E_NOTICE error_reporting(E_ALL & ~E_NOTICE); // Report all PHP errors (see changelog) error_reporting(E_ALL); // Report all PHP errors error_reporting(-1); // Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL); // specify url of xml file $xmlData = file_get_contents(get_bloginfo('template_directory').'/import/external_db.xml'); // read XML data string $xml = simplexml_load_string($xmlData) or die("ERROR: Cannot create SimpleXML object"); // create and execute INSERT queries foreach ($xml->item as $item) { $id = $item->id; $name = mysqli_real_escape_string($item->name); $code = mysqli_real_escape_string($item->code); $email = mysqli_real_escape_string($item->email); $jobdescription = mysqli_real_escape_string($item->jobdescription); $salary = mysqli_real_escape_string($item->salary); $sql = "INSERT INTO wajv_employees (id, name, code, email, jobdescription, salary) VALUES ('$id', '$name', '$code', '$email', '$jobdescription', '$salary')"; mysqli_query($sql) or die ("ERROR:"); } //mysql_close($connection); ?>Dit is de XML: <?xml version="1.0" encoding="utf-8"?> <data> <Item> <field name="name">xxx</field> <field name="code">101</field> <field name="email">xxx@xxx.nl</field> <field name="jobdescription">Job Description</field> <field name="salary">1000</field> </Item> <Item> <field name="name">xxx</field> <field name="code">102</field> <field name="email">xxx@xxx.nl</field> <field name="jobdescription">Job Description</field> <field name="salary">1000</field> </Item> <Item> <field name="name">xxx</field> <field name="code">103</field> <field name="email">xxx@xxx.nl</field> <field name="jobdescription">Job Description</field> <field name="salary">1000</field> </Item> <Item> <field name="name">xxx</field> <field name="code">104</field> <field name="email">xxx@xxx.nl</field> <field name="jobdescription">Job Description</field> <field name="salary">1000</field> </Item> </data>Hoop dat iemand mijn fout over het hoofd ziet Hi All,
I need to get a small function working for a site I need to build for a group of friends.
I was able to get a login page, and a way to add data to the data base.
Now I am stuck on the search and show results fuctionalities.
I have found tens of scripts on the internet, but most of them are outdated, or I cant get them to work, either it sends me back a blank page, does nothing or sends me to an error page
The GOAL
User Inputs text in a text box, clicks submit, the data in the text box is looked for in the second collumn of the DB, The information of the collumns 2 to 7 of the DB for the name search are displayed either on the same page or on a new page.
Is there any chance you could hel me with that, taken into account that I dont need the html part of the code, I only need help with the php part...
Thanks in advance to all the people reading this and the ones helping me...
Hi guys, Im currently doing a project for college and i have experienced some problems with saving my php drop down values to my database. im am getting no error but my values are not being stored to my db.If anyone could help me or point me in the correct direction then id be grateful. Ive attached my code. Hi everyone, I do not know if this is the right place to ask the following, but I know all the php guru's read here. So please take a moment to read and please help point me in the right direction. I have a php website that I am developing, it is a job website, where my problem is that I need to be able to extract text from the following file formats: doc, docx, rtf, txt and maybe pdf. I have googled and done research on this subject, but I do not find any php scripts that can do the job properly. I have found a java app developed by apache that does the text extraction perfectly, called apache tika. (calling it using exec is really a problem, since most hosts don't provide root access.) I need a way to use this with php. If you know of any other method that I can do this, please help and suggest as this is a major bridge that I have to cross very urgently. your help will be much appreciated, thanks Problem: I'm trying to build a junction table for a many to many relationship. Table A contains a title string that contains in it names that are stored in Table B. Both tables have nearly a million rows. Bad solution: The method I'm using right now is using PHP I fetch and store one table into an associative array. I then do a mysql_fetch loop on the second table and run this code to populate an array that is used to build the multi-insert SQL. $title = preg_replace ($names, $keys, $title); if (preg_match_all ('/(\d+)/', $title, $matches)) foreach ($matches[1] as $m) $inserts[$row['id'].'-'.$m] = 1; This works, but I'm looking for possibly a less cpu/memory intensive method. My remote server can't handle it, and we're talking hours and hours on a local server. It seems the bottleneck is with the preg_replace. I've also tried str_replace, which is only slightly faster. So, a method where I wouldn't have to pass around such large arrays, or an entirely different approach is what I'm looking for. Any ideas? I am building a new web app and want to make sure I do everything right from the beginning. What is the best method of storing the date and time into a database using PHP along with the table field settings? hello, i want to extract the sender_id, sender_alias and text from the array that should be returned when requesting access to direct messages via API. I get the error "Fatal error: Call to undefined method TwitterOAuth::request() " referring to the line $direct_message = $OAuth->request('GET', $OAuth->url('https://api.twitter.com/1/direct_messages.json'), array('sender_id','screen_name' ,'text')); Code: [Select] // create new instance $OAuth = new TwitterOAuth($consumer_key,$consumer_secret, $oAuthToken, $oAuthSecret); $direct_message = $OAuth->request('GET', $OAuth->url('https://api.twitter.com/1/direct_messages.json'), array('sender_id','screen_name' ,'text')); $direct_message = json_decode($OAuth->response['response'], true); echo response; Dear all, Please help me. I have two sites and both run on separate DB, both have separate signup and login process, Now i want if any user login from any site can access both sites. There are separate session for both sites now i want to use any of the session for user authentication. Please give suggestions. Thanks, Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php $hostname='xxx'; $username='xxx'; $password='xxx'; $dbname='xxx; $usertable=xxx; $myconn=mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); if ((($_FILES["file"]["type"] =="image/gif") || ($_FILES["file"]["type"] =="image/jpeg") || ($_FILES["file"]["type"] == "image/png")) && ($_FILES["file"]["size"]< 200000)) { if ($_FILES["file"]["error"] >0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br/>"; } else { if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo "File already exists. Choose another name."; } else { move_uploaded_file($_FILES["file"]["tmp_name"],"uploads/" . $_FILES["file"]["name"]); } } } else { echo "Invalid file"; } $path="uploads/" . $_FILES["file"]["name"]; $desc=$_POST["desc"]; if (!myconn) { die ('Could not connect: ' . $mysql_error()); } $db_selected=mysql_select_db('xxx',$myconn); if (!$db_selected) { die ('Can\'t use xxxx : ' . mysql_error()); } mysql_query("INSERT INTO partners (desc,photopath,state) VALUES ('$desc','$path','$state')"); mysql_close($myconn); ?> </body> </html> |