Jump to content

PC Nerd

Members
  • Posts

    1,122
  • Joined

  • Last visited

    Never

Everything posted by PC Nerd

  1. *** I can read and write from CSV - and there are heaps of scripts on th net - so thats fine - but im looking for a simpler solution tha thavign that script do it. Any suggstions about conversions or programs etc???
  2. Ok thanks. are there any other methods apart from the manual PHP import. is there a way that i can convert the excel sheet ( and by extension the CSV file) - convert that into SQL inserts or similar methods? thanks
  3. Personally I jsut work it so that a lot or my reused code is included in wrapper functions: eg - my database link file has wrappers for a lot of the mysqli_/ mysql_ functions - and it have a variable at the top of the document that defines 4.1 - or 5.2 or somethign like that. So that if i have to changce servers ( which i have in teh past) - its easy to port across because it simply checks the version and then acts on it. as for clean code - simply think abut ways to save coding lines - and comment sections: eg - if you have to set a cookie with the same name - but a different value then its easier to read : if(condition) {$val = "";} if(condition) {$val = "";} if(condition) {$val = "";} if(condition) {$val = "";} ... setcookie("name", $val)....; than it is to read: if(condition) {setcookie('name', 'val1')...;} if(condition) {setcookie('name', 'val2')...;} if(condition) {setcookie('name', 'val3')...;} ... etc etc - becaquse its a shorter line therefore it seems like theres less to read. also - comment the more complecated stuff like regex and stuff liek that because they arent really human readable. as prefiosly mentioned - have a style and stick to it. youll get your own eventually and youll just be used to it. eg i like: if() { .............. } as oposed to: if() { .......; } gdlk - ( also - coding editors help you read code because you can easily tell where strings end and the variables are etc.) gdlk
  4. web hexadecimal color converter? basically just play with words. if you have photoshop you can choose a color - and then change to web safe colors , and it gives you the hexadecimal color. alternatively just choose a color and use it - and hte browser should convert it to somethign it can read or whatnot - just play with it a little. gdlk
  5. Hi, Im looking for a method if importing Excel Data into my MySQL database. I have a feeling that the only way will to have it exported as a CSV file - and then have PHP transfer it ( INSERT INTO) - my database - but Im looking for an easier option. If anyone can suggestion an easy way to do this I would be most grateful. I would cop the data across manually - excelt for that fact that Its over 800 records - so its a little un managable. The data comes from another database, however I dont have access to it ( to export as SQL in MySQL compatability mode - however Im looking at options) - so I only have a CSV file that comes out of that database. I can ensure that field names are the same as my MySQL database - all that isnt an issue - its just transfering the raw data across that is the issue. Once again - any suggestions would be great. Thanks in advance
  6. SOLVED!!!! thankyou thankyou thankyou thankyou thats fantastic looks like its now returning an XMl object.... now for me to generate hundreds of errors while learnign how to use it lol thanks
  7. echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; is what i have - and it works fine - as output. however im still getting it as html or text rather than XML - as noted previously. thanks anyway
  8. no my php is interpreting that as <? PHP CODE ?> - ie shot tags ive echoed it out and escaped characters and its still not working. eg: the page that AJAx connects to that returns XML is returnData.php if i go to it on firefox and i view the data in page source its all there. if i view page info in firefox... then i get: text/html if thats an issue - or its jsut firefox handling the xml then i dont know - but its just somethign I noticed. thaks for the suggestions- any other ideas?
  9. thats an issue- because its defined outside of PH - meanign tht php interprets it as an openin gphp tag - shot tag. ill play around with echoing it and escaping characters adn il let oyu knwo who i i go. thaks
  10. hi i tried removeing the <!-- --> line but it made no difference. I had commented out my original xml tag because i thoguth the current one might work better = however there is no difference. any other suggestions? thanks for oyu help so far
  11. frommy knowledge - the only way woudl be to use PHP to proccess it into an image - and then the only thing that the user could copy is the Image - but even then, they can stil copy the image. correct me if Im wrong - but i dont think its overly possible. btw - using the image technique will mean that your site wont appear on search engines because their bots cant proccess the contents of an image - which is why Flash sites get lower ratings ( generaly) gdlk
  12. Hi, -- your problem is rather strange - however I recomend "PHP Designer 2005". I dont usually use editors - juust notepad. I only really use it for finding what line line 506 is lol - and to print the colored syntax. However its nice and easy to use - and you can also attach your php directory to it so it will generate previews for you if setup correctly. gdlk.
  13. Hi, Im learnign AJAX - teaching myself, and Ive figured out that the PHP script isnt sending my data in XML format. My code is in following. <!--<xml version = '1.0'encoding = 'UTF-8' standalone = 'yes'>--> <xml version="1.0" encoding="utf-8"> <?php while($ROW = mysqli_fetch_assoc($QUERY)) { echo "<student id='".$ROW['Student_ID']."'>\n"; echo "<name>".$ROW['Name']."</name>\n"; ... ive had to block out the rest of the loop because it contains private ingformation - but I can garentee that it is returned as appearing as XML - ie the correct tags, and viewd in source etc. for those tha tknow AJAX - the responseXML is null, and then responseText returns what I want it to -= only its not in teh XML format. I have a feeling that its with the <xml> declaration at the topm but im not great with XML and Im not sure if there is an issue with that. Thanks for and all help
  14. Hi, Im getting this error : Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in Database_link.inc on line 22 that line is: $QUERY = mysql_query($SQL, $DB_Server) or die(mysql_error());# or die ("Failed Query"); now the entire DB Wrapper file ive created is here: <?php function CONNECT_MYSQL_DATABASE() { $host = "localhost"; #usually localhost $account = "<>"; # username for access. eg. root $password = "<>"; $db_name = "<>"; #name of database on the server that you want to connect. #global $db_type; #$db_type = 4.1; # MySQL version $DB_Server = mysql_connect($host, $account, $password) or die(mysql_error());# or die ("Cannot connect to a database. Please try again later"); $DB_Server = mysql_select_db($db_name, $DB_Server) or die("Cannot select the database. Please try again later."); return $DB_Server; } function MYSQL_DATABASE_QUERY($SQL, $DB_Server) { $QUERY = mysql_query($SQL, $DB_Server) or die(mysql_error());# or die ("Failed Query"); return $QUERY; } function MYSQL_GET_ARRAY($QUERY) { $ROW = mysql_fetch_array($QUERY) or die("Cannot retreive data"); return $ROW; } function CLOSE($DB_Server) { @mysql_close($DB_Server);# or die("Cannot close connection"); } $DB_Server = CONNECT_MYSQL_DATABASE(); ?> as you can see ive got the connection to diaplay the error if it fails. However I can seem to figure this out why its not working. im callling my function like this: $QUERY = MYSQL_DATABASE_QUERY($SQL, $DB_Server); so with other code in between its: require("Database_link.inc"); #the full fule above. $SQL = "THE SQL"; $QUERY = MYSQL_DATABASE_QUERY($SQL, $DB_Server); however its raising that error... : can anyone see what is happening?
  15. ok - thankyou. does anyone else know about using a second MySQL server with XAMPP?? Thanks ** i dont necicarily want to control it from teh control panel - jsut use it wiht the PHP installation thanks
  16. Hi, Just wanted to suggest a topic solved mod for the freelancing forum, so that once a requiremnt has been filled- it ca easily be stated so withought bumping the topic to the top of the page. This way people who have unsolved requirementes are still towards teh top adn not bumped ont a new page. Thankx PS - I LOVE PHP FREAKS!!!!!!!!!
  17. in your profile - you can view all posts made.. .and all posts created. it is possible to view all the posts youve ever made
  18. Hi, Im jsut wondeirng how to manage robot.txt files if Im hosting multiple websites aka domains on teh one account. if i place it in my root www... then my extra domains are addon domains are sub directoris of that folder.. so doe smy robots.txt effect teh addon domains. hhowever I cant see how the robot coudl tell that its an addon domain.... so that doesnt really work out. Could somone confirm this for me?? Thanks
  19. do you mean change it from 404.html from myerror.php?id=404 or something liek that?? the easiest way to customise error pages is a host that lets you write you own in teh www root. then you simply design your owh 404.html page.
  20. well m aybe safari stores the cookies but theres a problem with teh domain to which they are saved?? im not to good with cookie domains -0 the another thig could be that safari proccesses them differently and therefore th page is setting the cookie and then readig form teh cookie before its been written? either way , gdlk
  21. Hi, Im currently running XAMPP on my computer and accessing it through localhost. Im looking for a way to run teh MySQLv5 im currenty using - and being able to turn it off and use the MySQLv4 that I want. Im wondering if someoen could help me in the way of a tutorial - to install the v4 MySQL and then make it run with my current PHP/Apache instalation. It would be great if teh v4 could use the same databases but tis not esential. Thansk in advance
  22. *** now - they run more recent PHP ..like version 5...... however its the MySQL that is what I want. hey - i know its stupid but im trying to do stuff and i know its possible. does anyoen know a fre host that hosts MySQL previous to 4.1 so that it only supports the mysql_ functions Thanks
  23. I know that (cos tPHP 6 is well on its way to release)- however because i do web developmetn for friends etc etc. - they still run on old technology and i cant convince them to move - so i see it to be simple to easily write a wrapper for both new and old versions and tehn just use that. basically i want a MySQL 4 host - one that is not compatable wiht mysqli_ 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.